Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding MKTileOverlay.LoadTileAtPath crashes my app with SIGSEGV #22196

Open
ericmlowry opened this issue Feb 16, 2025 · 5 comments · May be fixed by #22209
Open

Overriding MKTileOverlay.LoadTileAtPath crashes my app with SIGSEGV #22196

ericmlowry opened this issue Feb 16, 2025 · 5 comments · May be fixed by #22209
Assignees
Labels
bug If an issue is a bug or a pull request a bug fix
Milestone

Comments

@ericmlowry
Copy link

ericmlowry commented Feb 16, 2025

Apple platform

iOS

Framework version

net8.0-*

Affected platform version

iPadOS: 18.3, Target Framework: net8.0-ios, dotnet: 9.0.101, VS Community 2022: 17.12.3

Description

I'm making a custom map control in MAUI just for iOS. I'm using a ViewHandler and an MKMapViewDelegate to operate the MapKit API for my map controls. If I override the MKTileOverlay class, I'm able to override properties but when I try to override LoadTileAtPath, my application crashes with a SIGSEGV when my map control loads. I noticed also that the callback function is one of very few instances of properties that have a BlockProxy which I've been told probably maps the callback's class to it's appropriate pair in Objective-C. Is there a mapping issue?

Steps to Reproduce

  1. Create new MAUI project.
  2. Remove all frameworks besides net8.0-ios
  3. Create a new ContentView named MapControl and clean it.
  4. Add MapControl with a HeightRequest to MainPage.
  5. Create TestTileOverlay, extend MKTileOverlay, and override LoadTileAtPath (removing BlockProxy attribute)Image
  6. Create a new MapDelegate that extends MKMapViewDelegate and override OverlayRenderer Image
  7. Create a new MapControlHandler that extends ViewHandler<MapControl, MKMapView> and add bare minimum Image
  8. Add handler in MauiProgram Image
  9. Run on iOS.
  10. When map loads, SIGSEGV error shows.

Did you find any workaround?

I know stuff works internally because if I don't have a sub-class and give MKTileOverlay a proper url with an active tile server, tiles load properly. I want to override LoadTileAtPath so I can load tiles from my local files.

Relevant logs

as occurred in the native fault reporting. Some diagnostic information will be unavailable.

=================================================================
Native stacktrace:

0x103323f08 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : AppleCryptoNative_X509ImportCollection
0x10330edf4 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : AppleCryptoNative_X509ImportCollection
0x1032f10b0 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : AppleCryptoNative_X509ImportCollection
0x22cd89ca8 - /usr/lib/system/libsystem_platform.dylib : <redacted>
0x102ff54b0 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : xamarin_release_block_on_main_thread
0x102ff54b0 - /private/

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:

arin.PreBuilt.iOS : xamarin_get_original_working_directory_path
0x103007b90 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : xamarin_get_original_working_directory_path
0x1ab2fd74c - /System/Library/Frameworks/MapKit.framework/MapKit :
0x1a9f85248 - /usr/lib/system/libdispatch.dylib :
0x1a9f86fa8 - /usr/lib/system/libdispatch.dylib :
0x1a9f8e5cc - /usr/lib/system/libdispatch.dylib :
0x1a9f8f158 - /usr/lib/system/libdispatch.dylib :
0x1a9f905c0 - /usr/lib/system/libdispatch.dylib :
0x1a9f9a38c - /usr/lib/system/libdispatch.dylib :
0x1a9f99bd8 - /usr/lib/system/libdispatch.dylib :
0x22ce34680 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
0x22ce32474 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread

=================================================================
Basic Fault Address Reporting

0x10330edf4 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : AppleCryptoNative_X509ImportCollection
0x1032f10b0 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : AppleCryptoNative_X509ImportCollection
0x22cd89ca8 - /usr/lib/system/libsystem_platform.dylib : <redacted>
0x102ff54b0 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : xamarin_release_block_on_main_thread
0x102ff54b0 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : xamarin_release_block_on_main_thread
0x103000240 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : xamarin_get_runtime_arch
0x103006dac - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xam

var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : xamarin_release_block_on_main_thread
0x103000240 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : xamarin_get_runtime_arch
0x103006dac - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : xamarin_get_original_working_directory_path
0x103007b90 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : xamarin_get_original_working_directory_path
0x1ab2fd74c - /System/Library/Frameworks/MapKit.framework/MapKit :
0x1a9f85248 - /usr/lib/system/libdispatch.dylib :
0x1a9f86fa8 - /usr/lib/system/libdispatch.dylib :
0x1a9f8e5cc - /usr/lib/system/libdispatch.dylib :
0x1a9f8f158 - /usr/lib/system/libdispatch.dylib :
0x1a9f905c0 - /usr/lib/system/libdispa

=================================================================
Native Crash Reporting

========================================
Memory around native instruction pointer (0x22ce2efcc):0x22ce2efbc 88 0a 40 b9 28 09 e0 37 88 0e 40 f9 e8 47 c1 da ..@.(..7..@..G..
0x22ce2efcc 15 05 40 f9 e0 03 15 aa 01 6a 92 52 81 ca a6 72 ..@......j.R...r
0x22ce2efdc 05 4d b5 94 f3 03 00 aa 20 08 00 b4 f6 03 14 aa .M...... .......
0x22ce2efec d0 0e 41 f8 50 0b 00 b4 d0 12 c1 da f1 03 10 aa ..A.P...........

=================================================================
Managed Stacktrace:

=================================================================

=================================================================
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.

An error h
0x103323f08 - /private/var/containers/Bundle/Application/3BA5AB5D-2227-4519-B85B-21011DC52163/HelloWorld.app/Xamarin.PreBuilt.iOS : AppleCryptoNative_X509ImportCollection

tch.dylib :
0x1a9f9a38c - /usr/lib/system/libdispatch.dylib :
0x1a9f99bd8 - /usr/lib/system/libdispatch.dylib :
0x22ce34680 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
0x22ce32474 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread

Exiting early due to double fault.

The app has been terminated.

@rolfbjarne
Copy link
Member

Just by looking at our bindings I can't see anything obviously wrong, so could you please attach your test project so that we reproduce this ourselves?

@rolfbjarne rolfbjarne added this to the Future milestone Feb 17, 2025
@rolfbjarne rolfbjarne added the need-repro Waiting for a test case before the bug can be investigated label Feb 17, 2025
@ericmlowry
Copy link
Author

ericmlowry commented Feb 17, 2025

Here you go! Though could you add the preference of a repo to the new issue form framework so that we know we don't need to type out full steps?
https://github.com/ericmlowry/TestLoadTileAtPath

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-repro Waiting for a test case before the bug can be investigated labels Feb 17, 2025
@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label Feb 17, 2025
@rolfbjarne
Copy link
Member

rolfbjarne commented Feb 17, 2025

I can reproduce the crash, thanks for the test case.

Adding this to the csproj seems to work around it:

<PropertyGroup>
    <Registrar>managed-static</Registrar>
</PropertyGroup>

@ericmlowry
Copy link
Author

ericmlowry commented Feb 18, 2025

Can you elaborate on the work around? Or even commit it to the repo I made? It still crashes after adding that on my end. Also, no rush but just so I know, when can I expect a fix?

@rolfbjarne
Copy link
Member

Can you elaborate on the work around? Or even commit it to the repo I made? It still crashes after adding that on my end.

This worked for me: ericmlowry/TestLoadTileAtPath@c888f79

Also, no rush but just so I know, when can I expect a fix?

I'm not sure yet, once I've implemented a fix I'll know more.

@rolfbjarne rolfbjarne removed the bug If an issue is a bug or a pull request a bug fix label Feb 19, 2025
@rolfbjarne rolfbjarne self-assigned this Feb 20, 2025
@rolfbjarne rolfbjarne added bug If an issue is a bug or a pull request a bug fix and removed need-attention An issue requires our attention/response labels Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants