Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Xamarin.iOS application freezes on iOS 13

KG_uaKG_ua Member ✭✭

I have Xamarin Native (iOS/Android) application. The application works without problems on iOS 12 and below. If you run the application on the device with iOS 13, then it starts to freeze for unknown reasons and this bug doesn't have clear steps to reproduce, it occurs on different screens.

This is stacktrace from Visual Studio for Mac

=================================================================
    Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================
    0x1003ea775 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_dump_native_crash_info
    0x1003de6b5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_handle_native_crash
    0x1003f19f1 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_sigsegv_signal_handler_debug
    0x10790bb1d - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    0x111ab5e38 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : OBJC_CLASS_$_UIView
    0x122711c6b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN3ggl6BufferEED2Ev
    0x1227397f3 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN3ggl12ConstantDataEED2Ev
    0x122c98778 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__113__vector_baseIN3ggl19ConstantDataElementEN3geo12StdAllocatorIS2_NS1_9AllocatorEEEED2Ev
    0x122c9850c - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZN3ggl13PipelineSetupD2Ev
    0x1227b3d24 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZN3ggl6Circle17FillPipelineSetupD0Ev
    0x122b3059d - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__120__shared_ptr_emplaceIN2md23CircleOverlayRenderableENS_9allocatorIS2_EEE16__on_zero_sharedEv
    0x12281c40b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : _ZNSt3__110shared_ptrIN2md23CircleOverlayRenderableEED2Ev
    0x1068eff02 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class
    0x1068ff3c9 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : objc_destructInstance
    0x10690598f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : -[NSObject dealloc]
    0x122b2eb22 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/VectorKit.framework/VectorKit : -[VKVectorOverlayCircle dealloc]
    0x106906116 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZN11objc_object17sidetable_releaseEb
    0x1068eff02 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class
    0x1068ff3c9 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : objc_destructInstance
    0x10690598f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : -[NSObject dealloc]
    0x101d63e52 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MapKit.framework/MapKit : -[MKOverlayRenderer dealloc]
    0x101d63d9b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/MapKit.framework/MapKit : -[MKOverlayPathRenderer dealloc]
    0x106906116 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZN11objc_object17sidetable_releaseEb
    0x100640abd - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_release_managed_ref
    0x12a596bbc - Unknown
    0x132b427b9 - Unknown
    0x1003f4dd5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_runtime_invoke
    0x1005210e7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke_checked
    0x100524a6e - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke
    0x10064a822 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_invoke_trampoline
    0x10065257b - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_arch_trampoline
    0x100653782 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_x86_64_common_trampoline
    0x100dd0d10 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : __NSThreadPerformPerform
    0x105b2e271 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_
    0x105b2e19c - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSource0
    0x105b2d974 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSources0
    0x105b2867f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopRun
    0x105b27e66 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : CFRunLoopRunSpecific
    0x10ca74bb0 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices : GSEventRunModal
    0x110d41dd0 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
    0x12a4abae2 - Unknown
    0x12a4ab833 - Unknown
    0x12940fae3 - Unknown
    0x12940ffb9 - Unknown
    0x1003f4dd5 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_runtime_invoke
    0x1005210e7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_invoke_checked
    0x10052756c - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_runtime_exec_main_checked
    0x100354a22 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : mono_jit_exec
    0x100651a1e - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : xamarin_main
    0x10030f4a7 - /Users/konstya.gerasymenko/Library/Developer/CoreSimulator/Devices/95B31EC1-0A24-474B-858E-024385DE8FFA/data/Containers/Bundle/Application/216D0956-E0D0-40AD-A6F0-838AE3A49926/MyAppiOS.app/MyAppiOS : main
    0x107528d29 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start
    0x3 - Unknown

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x122cb448d):0x122cb447d  48 8b 7f 08 48 85 ff 74 13 48 8b 73 10 48 8b 07  H...H..t.H.s.H..
0x122cb448d  ff 50 10 b8 ad ba ad de 48 89 43 10 48 83 c4 08  .P......H.C.H...
0x122cb449d  5b 5d c3 55 48 89 e5 53 50 48 89 fb 48 8d 05 90  [].UH..SPH..H...
0x122cb44ad  f2 29 00 48 89 07 48 8b 7f 08 48 85 ff 74 0a 48  .).H..H...H..t.H

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at Foundation.NSObject:xamarin_release_managed_ref <0x000cb>
      at Foundation.NSObject:ReleaseManagedRef <0x0007a>
      at NSObject_Disposer:Drain <0x00392>
      at <Module>:runtime_invoke_void_object <0x001a8>
      at <unknown> <0xffffffff>
      at UIKit.UIApplication:UIApplicationMain <0x00251>
      at UIKit.UIApplication:Main <0x000b2>
      at UIKit.UIApplication:Main <0x00132>
      at MyApp.iOS.Application:Main <0x00202>
      at <Module>:runtime_invoke_void_object <0x001a8>
=================================================================

The first thing that comes to mind is problems with disposing of some NSObject (possible some memory leak), but it is very strange that this problem doesn't reproduce on slower devices with a lower version of iOS.

Please tell me if anyone else has encountered a similar problem. Are there any assumptions about the source of the problem?

Best Answer

  • KG_uaKG_ua Member ✭✭
    Accepted Answer

    Thank you BobWhitten for your answer, I also saw that there was a problem with bluetooth that you wrote about, but in my application I do not use bluetooth API.

    I found the reason of this bug and it related to disposing of MKMapView. On few screens where I display map I added Overlays (MKCircle) and OverlayRenderers (MKCircleRenderer) to the map and references to those Overlays and OverlayRenderers contains in private variables. So the main problem was is that during of screen disposing was disposed only map (MKMapView) object but not private variables with references to map Overlay and OverlayRenderer. After adding explicit disposing of this variables this bug has disappeared.

Answers

  • BobWhittenBobWhitten USMember ✭✭
    edited October 2019

    I was having the same problem yesterday, seemingly out of nowhere. I had updated VS (PC ver, to 16.3.2) and also XCode (turned it to 11), then Apple auto-updated my iPad and my app quit working. But there were other apps that worked.

    I tried things (updated to 16.3.3, changing linker options, etc), but nothing worked. Then I saw a comment like "does your app use bluetooth?", which mine does. I was getting nuisance reports from Apple that I needed to add a permission string, and pop-ups at start about bluetooth.

    I added this to info.plist (note: edited from original response):
    NSBluetoothAlwaysUsageDescription
    Allow App to use Bluetooth to access MyCompany Wireless Devices

    And things started to work. My suspicion is that there is a bug in the pop-up making that causes this. So, the same effect could happen for something unrelated to bluetooth.

    Additional note: Of course, today, retrying with newer code, I have the same issue. Retrying after deleting the app from my iPad -- works now. I believe this is still related to the permissions thing (and that removing the app removed the memory of the permission, so enabled it to work).

  • BobWhittenBobWhitten USMember ✭✭

    Update for deployed apps -- When the user updates to iOS 13, the bluetooth app permission pops up. If they click "Don't Allow", the bluetooth will not be available in the app. This can get undone by going to Privacy, the Bluetooth and turning app to ON.

  • KG_uaKG_ua Member ✭✭
    Accepted Answer

    Thank you BobWhitten for your answer, I also saw that there was a problem with bluetooth that you wrote about, but in my application I do not use bluetooth API.

    I found the reason of this bug and it related to disposing of MKMapView. On few screens where I display map I added Overlays (MKCircle) and OverlayRenderers (MKCircleRenderer) to the map and references to those Overlays and OverlayRenderers contains in private variables. So the main problem was is that during of screen disposing was disposed only map (MKMapView) object but not private variables with references to map Overlay and OverlayRenderer. After adding explicit disposing of this variables this bug has disappeared.

  • LandLuLandLu Member, Xamarin Team Xamurai

    Glad to hear you've resolved it by yourself. Try to mark it to end this discussion.

  • hi @KG_ua , can you give us more details on how you solved it ? (with code examples) I'm suffering the same problem and cannot make it work. Disposal of overlays was already done so I'm struggling to find alternatives.

  • KG_uaKG_ua Member ✭✭

    Hi @ignacardel! Here is some initialising stuff:

    _mapView = new MKMapView().WithoutConstraints();
    _mapView.OverlayRenderer = OverlayRenderer;
    …
    MKCircleRenderer _circleRenderer;
    
    private MKOverlayRenderer OverlayRenderer(MKMapView mapView, IMKOverlay overlay)
    {
        if (_circleRenderer == null)
        {
            _circleRenderer = new MKCircleRenderer(overlay as MKCircle)
            {
                FillColor = Theme.MapCircleBackgroundColor,
                StrokeColor = Theme.MapCircleBorderColor,
                LineWidth = 3
            };
        }
        return _circleRenderer;
    }
    

    And here code to dispose this objects:

    _mapView.OverlayRenderer = null;
    
    if (_circleRenderer != null)
    {
        _circleRenderer?.Dispose();
        _circleRenderer = null;
    }
    
    _mapView.Dispose();
    _mapView = null;
    
  • @KG_ua said:
    Thank you BobWhitten for your answer, I also saw that there was a problem with bluetooth that you wrote about, but in my application I do not use bluetooth API.

    I found the reason of this bug and it related to disposing of MKMapView. On few screens where I display map I added Overlays (MKCircle) and OverlayRenderers (MKCircleRenderer) to the map and references to those Overlays and OverlayRenderers contains in private variables. So the main problem was is that during of screen disposing was disposed only map (MKMapView) object but not private variables with references to map Overlay and OverlayRenderer. After adding explicit disposing of this variables this bug has disappeared.

    I have a similar issue:

    objc[10020]: Attempt to use unknown class 0xcc7176f5b6b0.
        
        =================================================================
            Native Crash Reporting
        =================================================================
        Got a SIGABRT while executing native code. This usually indicates
        a fatal error in the mono runtime or one of the native libraries 
        used by your application.
        =================================================================
        
        =================================================================
            Basic Fault Adddress Reporting
        =================================================================
        Memory around native instruction pointer (0x1190aceb6):0x1190acea6  ff ff c3 90 90 90 b8 09 02 00 02 49 89 ca 0f 05  ...........I....
        0x1190aceb6  73 08 48 89 c7 e9 29 7c ff ff c3 90 90 90 b8 1e  s.H...)|........
        0x1190acec6  00 00 02 49 89 ca 0f 05 73 08 48 89 c7 e9 36 7c  ...I....s.H...6|
        0x1190aced6  ff ff c3 90 90 90 b8 94 01 00 02 49 89 ca 0f 05  ...........I....
        
        =================================================================
            Native stacktrace:
        =================================================================
            0x1098a9960 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/AC3B85A5-020B-4B42-B523-A98015CA4562/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : mono_dump_native_crash_info
            0x1098530c5 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/AC3B85A5-020B-4B42-B523-A98015CA4562/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : mono_handle_native_crash
            0x1190d2f5a - /usr/lib/system/libsystem_platform.dylib : _sigtramp
            0x700008bee1e0 - Unknown
            0x1190a725f - /usr/lib/system/libsystem_kernel.dylib : abort_with_payload_wrapper_internal
            0x117eba1f5 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : _ZL12_objc_fatalvyyPKcP13__va_list_tag
            0x117eba11e - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : __objc_error
            0x117ec1c18 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib : class_copyProtocolList
            0x1093e5a53 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/AC3B85A5-020B-4B42-B523-A98015CA4562/Elysios.Demetra.App.iOS.app/Elysios.Demetra.App.iOS : _ZL22get_method_descriptionP10objc_classP13objc_selector
            0x1093e56cb - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/AC3B85A5-020B-4B42-B523-A98015CA4562/Elysios.Demetra.App.iOS.app/Elysios.Demetra.App.iOS : xamarin_get_frame_length
            0x1093f467c - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/AC3B85A5-020B-4B42-B523-A98015CA4562/Elysios.Demetra.App.iOS.app/Elysios.Demetra.App.iOS : xamarin_dyn_objc_msgSend
            0x13d236c80 - Unknown
            0x13cea6d7a - Unknown
            0x109a0b14f - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/AC3B85A5-020B-4B42-B523-A98015CA4562/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : mono_gc_run_finalize
            0x109a2abda - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/AC3B85A5-020B-4B42-B523-A98015CA4562/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : sgen_gc_invoke_finalizers
            0x109a0cf03 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/AC3B85A5-020B-4B42-B523-A98015CA4562/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : finalizer_thread
            0x1099ba409 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/AC3B85A5-020B-4B42-B523-A98015CA4562/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : start_wrapper_internal
            0x1099ba267 - /Users/matheuscrespischenfeld/Library/Developer/CoreSimulator/Devices/A1EADC21-E4A6-4A0D-BFBB-23326D7380BE/data/Containers/Bundle/Application/AC3B85A5-020B-4B42-B523-A98015CA4562/Elysios.Demetra.App.iOS.app/Frameworks/Mono.framework/Mono : start_wrapper
            0x1190e4661 - /usr/lib/system/libsystem_pthread.dylib : _pthread_body
            0x1190e450d - /usr/lib/system/libsystem_pthread.dylib : _pthread_body
            0x1190e3bf9 - /usr/lib/system/libsystem_pthread.dylib : thread_start
        
        =================================================================
            Managed Stacktrace:
        =================================================================
              at <unknown> <0xffffffff>
              at ObjCRuntime.Messaging:void_objc_msgSend <0x000bf>
              at ObjCRuntime.BaseWrapper:Dispose <0x00162>
              at ObjCRuntime.BaseWrapper:Finalize <0x0006b>
              at System.Object:runtime_invoke_virtual_void__this__ <0x000c9>
    =================================================================
    

    I have some polygons on a mapView according to the image:

    If I select some of the sector, this sector changes the color. This error occurs when I open this map page for the second time, so it makes me think that my problem is in my e.OldElement that is:

        if (e.OldElement != null)
                {
                    if (nativeMap != null && formsMap != null)
                    {
                        formsMap = new CustomMap();
                        nativeMap = Control as MKMapView;
                    }
                }
    
        if (e.NewElement != null)
        {
            formsMap = (CustomMap)e.NewElement;
            nativeMap = Control as MKMapView;
            List<App.Graphic.Polygon> Polygons; if (nativeMap != null && formsMap != null)
                    {
                        try
                        {
                            Polygons = formsMap.Polygons;
                            nativeMap.OverlayRenderer = GetOverlayRenderer;
                            for (int i = 0; i < Polygons.Count; i++)
                            {
                                CLLocationCoordinate2D[] coords = new CLLocationCoordinate2D[Polygons[i].Vertices.Count];
                                int index = 0;
                                foreach (var position in Polygons[i].Vertices)
                                {
                                    coords[index] = new CLLocationCoordinate2D(latitude: position.Latitude, longitude: position.Longitude);
                                    index++;
                                }
                                PolygonIOS blockOverlay = new PolygonIOS(MKPolygon.FromCoordinates(coords));
                                blockOverlay.FillColor = Color.FromUint((uint)Polygons[i].Color).ToUIColor();
                                blockOverlay.StrokeColor = Color.FromUint((uint)Polygons[i].StrokeColor).ToUIColor();
                                nativeMap.AddOverlay(blockOverlay);
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine(ex);
                        }
                    }
    
                    UITapGestureRecognizer tap = new UITapGestureRecognizer(g =>
                    {
                        var pt = g.LocationInView(nativeMap);
                        CLLocationCoordinate2D tapCoord = nativeMap.ConvertPoint(pt, nativeMap);
                        Console.WriteLine("new CLLocationCoordinate2D({0}, {1}),", tapCoord.Latitude, tapCoord.Longitude);
                        Position clickedPos = new Position(tapCoord.Latitude, tapCoord.Longitude);
                        formsMap.OniOSMapClicked(this, clickedPos, e);
                        RefreshPolygons(formsMap);
                    });
                    nativeMap.AddGestureRecognizer(tap);
    
    
                    MKOverlayRenderer GetOverlayRenderer(MKMapView mapView, IMKOverlay overlayWrapper)
                    {
                        return new MKPolygonRenderer(overlayWrapper as MKPolygon)
                        {
                            FillColor = (overlayWrapper as PolygonIOS).FillColor,
                            StrokeColor = (overlayWrapper as PolygonIOS).StrokeColor,
                            Alpha = 0.4f,
                            LineWidth = 2
                        };
                    }
    
        }
    
Sign In or Register to comment.