System.InvalidOperationException: 'Cannot assign a native control without an Element;

DhruvKanojiaDhruvKanojia USMember ✭✭

I am working on a project "CoManga" and I wanted to add advertisements in it. Implementing ads on UWP seemed straight forward, like Android and iOS. However, I'm stuck now.

Anyways, I followed this tutorial by James Montemagno and added everything. I even see the test advertisements, which is great. However, when I try to move away from that page (when I press "BACK Button") and go to previous page, I get an error.

This is the error :

Setting up AdControlView in UWP throws System.InvalidOperationException: 'Cannot assign a native control without an Element; Renderer unbound and/or disposed. Please consult Xamarin.Forms renderers for reference implementation of OnElementChanged.'.

It is thrown at line number 50, where I set the SetNativeControl(adView);. I've commented it out right now, but as soon as I un-comment it, I see this error.

Can someone help me out here with this.

Best Answer

Answers

  • DhruvKanojiaDhruvKanojia USMember ✭✭
    Accepted Answer

    If anyone stumbles upon this, refer to this answer on StackOverflow, it worked.

    URL : https://stackoverflow.com/a/55389724/2408212

  • misterrymisterry Member

    @DhruvKanojia said:
    If anyone stumbles upon this, refer to this answer on StackOverflow, it worked.

    I saw your post on Reddit but there's no answer.
    Fortunately, my friend in Apknite company introduced me to this forum.
    Thank you for this solution.

Sign In or Register to comment.