TorbenK / TK.CustomMap

Extended Map Control
MIT License
142 stars 109 forks source link

iOS Crash: NullReferenceException after VS 2019 update. #363

Closed busec0 closed 5 years ago

busec0 commented 5 years ago

I'm encountering an issue on iOS after the update to VS 2019. I'm using XF 3.6.0 and Xamarin.iOS 12.8.0.0. It happens when an instance of TKCustomMap gets disposed.

Within the iOS's TKCustomMapRenderer the app crashes with NullReferenceException when base.Dispose(disposing) is called in the overridden method: protected override void Dispose(bool disposing)

It can easily be reproduced by pushing a page which contains a Map instance and then popping it from the Navigation.

You can download a sample app from here:

TKMaps_DisposeFailsSampleProject.zip

It opens two different pages:

  1. A Map Page using the default TKCustomMap implementation. Pushing and then popping the page will crash with NullReferenceException.
  2. Custom Maps Page. I've manually added the content from TKCustomMapRenderer in my iOS project (named it MapViewRenderer.cs) and commented out the call to base.Dispose() within the protected override void Dispose(bool disposing). App wont crash now.

The same issue is also opened here: https://github.com/xamarin/xamarin-macios/issues/5899

pamela032709 commented 5 years ago

Have you found any workaround for this issue?

busec0 commented 5 years ago

Unfortunately no. In my debug builds I've manually added the iOS map view renderer and commented out the call to base.Dispose() (you can check my sample app, did the same thing there).

It will prevent it from crashing and let me work "normally", but it is not a reliable solution for production builds.

I'm still waiting for a fix and hope we'll get one soon, might be an issue with Xamarin.iOS as it worked just fine with the previous version.

pamela032709 commented 5 years ago

same here! android is fine as well just tested.
lets just hope they can provide a fix. but not to enthusiastic about it since they havent provide any update or release in about a year.

On Apr 18, 2019, at 1:56 PM, Bulzan Sergiu notifications@github.com wrote:

Unfortunately no. In my debug builds I've manually added the iOS map view renderer and commented out the call to base.Dispose() (you can check my sample app, did the same thing there).

It will prevent it from crashing and let me work "normally", but it is not a reliable solution for production builds.

I'm still waiting for a fix and hope we'll get one soon, might be an issue with Xamarin.iOS as it worked just fine with the previous version.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

busec0 commented 5 years ago

Closing this as it was a Xamarin.iOS bug, the fix is ready and will soon be released.

Check for more info: https://github.com/xamarin/xamarin-macios/issues/5899