Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Strange error when removing event handlers using -=

$
0
0

Hi Everyone, wondering if anyone can help.

I have been removing assignment to event handler on ViewDidDissapear event handler by calling:

var.someevent -= HandleSomeEvent;

This has been working great and as expected until I ran a adhoc profile in Iphone simulator mode. After this, even in debug mode, my code (which has been running pretty stable for a while) is now throwing null ref error when unassigning event handlers. Now, to fix this I found I could do the following:

    1. Try Catch the offending code
    2. Run on device
    3. Clean -> Rebuild in Release mode -> Rebuild in Debug mode 

Strangely enough, #3 brought everything back to normal.

So my question is: Is this a quirk of the product or should I wrap all unassign code with Try Catch??

Thanks!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>