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

WinUI 3 app hangs on exit: MapGeocoder.dll is unwisely running destructors in DllMain DLL_PROCESS_DETACH #10229

Open
mfeingol opened this issue Dec 11, 2024 · 3 comments
Labels
area-External Not owned by the WinUI team, not actionable in this repository. bug Something isn't working

Comments

@mfeingol
Copy link

Describe the bug

I have a WinUI app that hangs on shutdown during ExitProcess(). The hang appears to occur when I use the Bing Maps geocoding functionality in the Windows.Services.Maps namespace, specifically MapLocationFinder.FindLocationsAsync or MapLocationFinder.FindLocationsAtAsync. Calling something else like MapRouteFinder.GetDrivingRouteAsync doesn't seem to have the same problem.

Given that calling a .NET API shouldn't result in a corrupted process, it seemed worth filing the issue. This impacts single-instance apps because they will detect a running instance but won't be able to redirect activation parameters, resulting in a hang on the new process as well.

Stack trace and minidump follow:

Hang.zip

0:000> k
 # Child-SP          RetAddr               Call Site
00 000000d9`0877f6a8 00007ffb`94e9c89f     ntdll!NtWaitForSingleObject+0x14
01 000000d9`0877f6b0 00007ffa`a09e59a4     KERNELBASE!WaitForSingleObjectEx+0xaf
02 000000d9`0877f750 00007ffa`a09f2839     MapConfiguration!Pal::TimerImplWinRT::cancel+0xc4
03 000000d9`0877f790 00007ffa`a09efacf     MapConfiguration!MapControl::ConfigurationManager::stopTimer+0x25
04 000000d9`0877f7c0 00007ffa`a09db52d     MapConfiguration!MapControl::ConfigurationManager::~ConfigurationManager+0x3f
05 000000d9`0877f7f0 00007ffa`a09ed06b     MapConfiguration!std::default_delete<MapControl::ConfigurationManager>::operator()+0x15
06 000000d9`0877f820 00007ffa`a09db5d4     MapConfiguration!ConfigurationManagerAdapter::~ConfigurationManagerAdapter+0x37
07 000000d9`0877f850 00007ffa`a09dba5e     MapConfiguration!ConfigurationManagerAdapter::`vector deleting destructor'+0x14
08 000000d9`0877f880 00007ffa`77fb0a64     MapConfiguration!Microsoft::WRL::Details::RuntimeClassImpl<Microsoft::WRL::RuntimeClassFlags<1>,1,1,0,IConfigurationManager>::Release+0x5e
09 000000d9`0877f8b0 00007ffa`77fd512d     MapGeocoder!Microsoft::WRL::ComPtr<Windows::Foundation::IAsyncOperation<Windows::Services::Maps::LocalSearch::LocalLocationFinderResult * __ptr64> >::InternalRelease+0x20
0a 000000d9`0877f8e0 00007ffa`77fd5164     MapGeocoder!MapControl::Finder::SearchManager::~SearchManager+0x21
0b 000000d9`0877f910 00007ffa`77fb3e35     MapGeocoder!MapControl::Finder::SearchManager::`vector deleting destructor'+0x14
0c 000000d9`0877f940 00007ffa`77fae866     MapGeocoder!DllMain+0x51
0d 000000d9`0877f970 00007ffb`978bd860     MapGeocoder!dllmain_dispatch+0x8e
0e 000000d9`0877f9d0 00007ffb`97980bc0     ntdll!LdrpCallInitRoutine+0xb0
0f 000000d9`0877fcb0 00007ffb`9797fd84     ntdll!LdrShutdownProcess+0x260
10 000000d9`0877fdc0 00007ffb`968618ab     ntdll!RtlExitUserProcess+0x114
11 000000d9`0877fdf0 00007ffb`952b0543     kernel32!ExitProcessImplementation+0xb
12 000000d9`0877fe20 00007ff7`e34f225f     ucrtbase!common_exit+0xc7
13 000000d9`0877fe80 00007ffb`9684e8d7     Sideroads_exe!__scrt_common_main_seh+0x173 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 295] 
14 000000d9`0877fec0 00007ffb`9797fbcc     kernel32!BaseThreadInitThunk+0x17
15 000000d9`0877fef0 00000000`00000000     ntdll!RtlUserThreadStart+0x2c

Steps to reproduce the bug

In a WinUI3 app, use geocoding services from Windows.Services.Maps, then exit the process normally.

Expected behavior

No hangs on shutdown.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003

Windows version

Windows 11 (24H2): Build 26100

Additional context

No response

@mfeingol mfeingol added the bug Something isn't working label Dec 11, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Dec 11, 2024
@karkarl karkarl added area-MapControl area-External Not owned by the WinUI team, not actionable in this repository. and removed needs-triage Issue needs to be triaged by the area owners area-MapControl labels Dec 12, 2024
@karkarl
Copy link
Contributor

karkarl commented Dec 12, 2024

The MapServices api is with Bing API and not WinAppSDK.

@mfeingol
Copy link
Author

The MapServices api is with Bing API and not WinAppSDK.

OK. Any ideas on where this bug should be filed?

@riverar
Copy link
Contributor

riverar commented Dec 13, 2024

These APIs are deprecated. They are not likely to get fixed and you're not likely to get any support for them. Time to find an alternative I'm afraid.

Here's a migration guide: https://learn.microsoft.com/azure/azure-maps/migrate-bing-maps-overview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-External Not owned by the WinUI team, not actionable in this repository. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants