I did not find a proper solution for this error but eventually I deleted any ad plugin from unity ads i downloaded form unity asset store and wrote the code again.
Somehow that was ok but in the previous attempts I could not use the using UnityEngine.Advertisments namespace.
Also make shure that you switch to one of the platforms, either Android or Iphone in editor so you cant test if your (test) ads are working in editor.