question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using WinUI 2.6.1 in a .net core 3.1 app (XAML island) crashes at startup on older Windows version

See original GitHub issue

Describe the bug

The application based on .net core 3.1 crashes during launch on Windows version 1903 when using WinUI 2.6.1 while version 2.6.0 works fine (just replacing the winui dll in the output directory is sufficient to make it work). The bug does not occur on the latest Windows version (21H1). Attached is the stack trace from windbg:

Access violation - code c0000005

[0x0]   Microsoft_UI_Xaml_7ffbfc0d0000!winrt::Windows::Foundation::IUnknown::unconditional_release_ref + 0x10   
[0x1]   Microsoft_UI_Xaml_7ffbfc0d0000!winrt::Windows::Foundation::IUnknown::release_ref + 0xf   
[0x2]   Microsoft_UI_Xaml_7ffbfc0d0000!winrt::Windows::Foundation::IUnknown::{dtor} + 0xf   
[0x3]   Microsoft_UI_Xaml_7ffbfc0d0000!XamlControlsResources::UpdateAcrylicBrushesDarkTheme + 0xea   
[0x4]   Microsoft_UI_Xaml_7ffbfc0d0000!XamlControlsResources::UpdateSource + 0x1ba   
[0x5]   Microsoft_UI_Xaml_7ffbfc0d0000!XamlControlsResources::{ctor} + 0x38   
[0x6]   Microsoft_UI_Xaml_7ffbfc0d0000!winrt::impl::heap_implements<XamlControlsResources>::heap_implements<XamlControlsResources> + 0x45   
[0x7]   Microsoft_UI_Xaml_7ffbfc0d0000!winrt::make + 0x26   
[0x8]   Microsoft_UI_Xaml_7ffbfc0d0000!winrt::Microsoft::UI::Xaml::Controls::factory_implementation::XamlControlsResourcesT<winrt::Microsoft::UI::Xaml::Controls::XamlControlsResourcesFactory,XamlControlsResources>::ActivateInstance + 0x26   
[0x9]   Microsoft_UI_Xaml_7ffbfc0d0000!winrt::impl::produce<winrt::Microsoft::UI::Xaml::Controls::XamlControlsResourcesFactory,winrt::Windows::Foundation::IActivationFactory>::ActivateInstance + 0x42   
[0xa]   0x7ffba5aaa14c   
[0xb]   0x7ffba5aa915e   
[0xc]   0x7ffba37d95e7   
[0xd]   System_Windows_Forms!System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)$##60012A5 + 0xf0   
[0xe]   System_Windows_Forms!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(System.Object)$##60012A4 + 0x3c   
[0xf]   System_Private_CoreLib!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)$##6001E8E + 0x76   
[0x10]   System_Private_CoreLib!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)$##6001E8D + 0x10   
[0x11]   System_Windows_Forms!System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry)$##60012A3 + 0x80   
[0x12]   System_Windows_Forms!System.Windows.Forms.Control.InvokeMarshaledCallbacks()$##60012A6 + 0xf7   
[0x13]   System_Windows_Forms!System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)$##60013CC + 0xa03   
[0x14]   System_Windows_Forms!System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)$##6005621 + 0x1f   
[0x15]   System_Windows_Forms!System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)$##6005624 + 0x102   
[0x16]   System_Windows_Forms!System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)$##6002E1C + 0xa1   
[0x17]   0x7ffba34252e0   
[0x18]   coreclr!coreclr_shutdown_2 + 0xbc5b   
[0x19]   USER32!UserCallWinProcCheckWow + 0x2bd   
[0x1a]   USER32!DispatchMessageWorker + 0x1e2   
[0x1b]   0x7ffba37d5337   
[0x1c]   System_Windows_Forms!System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)$##600537C + 0x391   
[0x1d]   System_Windows_Forms!System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)$##60053AA + 0x416   
[0x1e]   System_Windows_Forms!System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)$##60053A9 + 0x46   
[0x1f]   System_Windows_Forms!System.Windows.Forms.Application.Run(System.Windows.Forms.Form)$##6000AEC + 0x3b   
[0x20]   0x7ffba341630e   
[0x21]   coreclr!coreclr_shutdown_2 + 0xbb43   
[0x22]   coreclr!coreclr_initialize + 0xda772   
[0x23]   coreclr!coreclr_initialize + 0xe1739   
[0x24]   coreclr!coreclr_initialize + 0xe1bc7   
[0x25]   coreclr!coreclr_initialize + 0xe2371   
[0x26]   coreclr!coreclr_execute_assembly + 0x101   
[0x27]   hostpolicy!coreclr_t::execute_assembly + 0x2d   
[0x28]   hostpolicy!run_app_for_context + 0x387   
[0x29]   hostpolicy!run_app + 0x46   
[0x2a]   hostpolicy!corehost_main + 0x132   
[0x2b]   hostfxr!execute_app + 0x2e3   
[0x2c]   hostfxr!`anonymous namespace'::read_config_and_execute + 0xa8   
[0x2d]   hostfxr!fx_muxer_t::handle_exec_host_command + 0x15d   
[0x2e]   hostfxr!fx_muxer_t::execute + 0x1fc   
[0x2f]   hostfxr!hostfxr_main_startupinfo + 0x9c   
[0x30]   apphost!exe_start + 0x651   
[0x31]   apphost!wmain + 0x88   
[0x32]   apphost!invoke_main + 0x22   
[0x33]   apphost!__scrt_common_main_seh + 0x10c   
[0x34]   KERNEL32!BaseThreadInitThunk + 0x14   
[0x35]   ntdll!RtlUserThreadStart + 0x21   

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Go to ‘…’
  2. Click on ‘…’

Expected behavior

The application should launch properly

Screenshots

Version Info

NuGet package version:

[Microsoft.UI.Xaml 2.6.1]

Windows app type:

UWP Win32
Yes
Windows 10 version Saw the problem?
21H1 (19043) No
October 2020 Update (19042)
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362) Yes
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
jaimecbernardocommented, Sep 15, 2021

I can confirm the latest release “2.7.0-prerelease.210913003” fixes this issue for me.

1reaction
jaimecbernardocommented, Aug 23, 2021

@asklar , I had opened the duplicate issue https://github.com/microsoft/microsoft-ui-xaml/issues/5546 .

I’ve tested 2.6.2-prerelease.210818003. The issue is still present. I’ve tested 2.7.0-prerelease.210816001. The issue is still present.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WinUI 3 App Runs on Development Machine, Crashes ...
I have a WinUI3/Windows App executable which runs fine on my development machine. After it's signed it can be installed on the development ......
Read more >
c# - .NET Core 3 using WinUI
You can use these WinUI 2 controls inside of a XAML Island in WinForms or WPF .NET Core 3, and not with the...
Read more >
XAML Controls Gallery crashes with unhandled Win32 ...
After Windows upgraded on fast ring, some applications started to crash on startup. I am not sure, what is the reason of crash....
Read more >
WinUI3 in Existing Win32 Applications
UWP failed to propagate within Win32. They tried with XAML Islands - I created a small library which (tries to) use it. It...
Read more >
WinUI 3 Preview 4 is available
Windows Community Toolkit DataGrid control crashes app on start/when scrollbars appear; Page rendering gets into a bad state when display mode ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found