amay077 / Xamarin.Forms.GoogleMaps

Map library for Xamarin.Forms using Google maps API
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/
MIT License
546 stars 349 forks source link

Cannot access a disposed object #779

Open AhmedAdelGadElkareeem opened 3 years ago

AhmedAdelGadElkareeem commented 3 years ago

VERSIONS

PLATFORMS

ACTUAL BEHAVIOR

System.ObjectDisposedException:** 'Cannot access a disposed object. Object name: 'Google.Maps.MapView'.' The app has been terminated

EXPECTED BEHAVIOR

map open in debug mode on real device

HOW TO REPRODUCE

try to open map with user current location in debug mode in ios project using real device (iPhone)

SeriousGeorge commented 2 years ago

Any news on this?

Having exactly the same issue... wether VisualStudio 2021 or 2022 preview, dosent matter. Also tested installing Xamarin.Forms.GoogleMaps 3.3.0 or 4.0.0-Beta1, no difference.

Also solutions for referring bugs and problems from here do not provide a working solution: https://github.com/amay077/Xamarin.Forms.GoogleMaps/issues/666#issuecomment-572631289

Additionally should be said whats leading to the disposed object message. For me it originated from another problem... "An error occurred: 'Could not create an native instance of the type 'Google.Maps.MapView': the native class hasn't been loaded." (https://community.esri.com/t5/arcgis-runtime-sdk-for-net-questions/mapview-objectdisposedexception-ios/m-p/668849#M8426) The solutions for this was to set ObjCRuntime.Class.ThrowOnInitFailure = false;

If I then try to set ObjCRuntime.Class.ThrowOnInitFailure to false I'll get the disposed exception. Also tried custom renderer for ios... no difference.

PontusHolmberg commented 10 months ago

Any updates on this. Still having this issue. Worked before, then I put down the project for a year and when I came back to it I get this issue.