Preview2: Crash during drag & drop (0x00007FFBCFD8B362 KernelBase.dll)
See original GitHub issueDescribe the bug
Fatal exception during drag & drop with WinUI 1.1.0 Preview2 during either get_DataView() or get_Modifiers(). The same code works fine for WinUI 1.0.3.
Besides the hard crash, the drop area seems to be in the incorrect position.
Steps to reproduce the bug
See attached minimal project. WinUIDragOverCrash.zip
Note: As extracted from a large failing project, the individual blocks may miss functionality (especially the drop handler). The drop handler of the original project contains o lot of async processing of the dropped data.
Compile and start project. Perform several a drag & drop operation. The drop area for WinUI 1.1.0 Preview 2 is not where it should be. On my screen it was on the lower right corner of the application. Move it around on the drop area to provoke calls to OnDragOver().
Debug Output
onecoreuap\shell\dataexchange\winrt\lib\droptargetinternal.cpp(306)\DataExchange.dll!00007FFB95466B58: (caller: 00007FFBD10295D3) ReturnHr(41) tid(95d4) 80070490 Element not found.
OnDragOver.
onecoreuap\shell\dataexchange\winrt\lib\droptargetinternal.cpp(306)\DataExchange.dll!00007FFB95466B58: (caller: 00007FFBD10295D3) ReturnHr(42) tid(3c68) 80070490 Element not found.
OnDragOver.
onecoreuap\shell\dataexchange\winrt\lib\droptargetinternal.cpp(306)\DataExchange.dll!00007FFB95466B58: (caller: 00007FFBD10295D3) ReturnHr(43) tid(3c68) 80070490 Element not found.
OnDragOver.
Exception thrown at 0x00007FFBCFCB4F69 (KernelBase.dll) in WinUIDragOverCrash.exe: WinRT originate error - 0x80004005 : 'Reentrancy was detected in this XAML application. Use a debugger to locate the reentrant code and, if necessary, move that code to an asynchronous event handler. Press OK to exit the application.'.
Unhandled exception at 0x00007FFBCFD8B362 (KernelBase.dll) in WinUIDragOverCrash.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0000017057BA4A00, 0x0000000000000001).
Stack Trace
KernelBase.dll!00007ffbcfd8b362() Unknown
combase.dll!00007ffbd1abcd7a() Unknown
Microsoft.ui.xaml.dll!00007ffb1d54df38() Unknown
Microsoft.ui.xaml.dll!00007ffb1d34250e() Unknown
Microsoft.ui.xaml.dll!00007ffb1d416a3e() Unknown
Microsoft.ui.xaml.dll!00007ffb1d416986() Unknown
CoreMessagingXP.dll!00007ffb753e3f98() Unknown
CoreMessagingXP.dll!00007ffb753e419e() Unknown
CoreMessagingXP.dll!00007ffb753e3d6b() Unknown
CoreMessagingXP.dll!00007ffb753bf808() Unknown
CoreMessagingXP.dll!00007ffb753bf6db() Unknown
CoreMessagingXP.dll!00007ffb7539c470() Unknown
CoreMessagingXP.dll!00007ffb75369b54() Unknown
CoreMessagingXP.dll!00007ffb75369406() Unknown
CoreMessagingXP.dll!00007ffb7535ed7b() Unknown
CoreMessagingXP.dll!00007ffb75361010() Unknown
CoreMessagingXP.dll!00007ffb753614e6() Unknown
CoreMessagingXP.dll!00007ffb7536140a() Unknown
CoreMessagingXP.dll!00007ffb753b466f() Unknown
CoreMessagingXP.dll!00007ffb753b460f() Unknown
user32.dll!00007ffbd168e858() Unknown
user32.dll!00007ffbd168e3dc() Unknown
user32.dll!00007ffbd16a0bc3() Unknown
ntdll.dll!00007ffbd2230ba4() Unknown
win32u.dll!00007ffbd0001064() Unknown
user32.dll!00007ffbd168a5c3() Unknown
user32.dll!00007ffbd168a523() Unknown
combase.dll!00007ffbd192e29b() Unknown
combase.dll!00007ffbd192e205() Unknown
combase.dll!00007ffbd192ec0a() Unknown
combase.dll!00007ffbd192e57f() Unknown
combase.dll!00007ffbd192ca5a() Unknown
combase.dll!00007ffbd192c73b() Unknown
combase.dll!00007ffbd19044d6() Unknown
combase.dll!00007ffbd192ccc3() Unknown
combase.dll!00007ffbd194051b() Unknown
combase.dll!00007ffbd192c014() Unknown
combase.dll!00007ffbd197950e() Unknown
rpcrt4.dll!00007ffbd108c334() Unknown
combase.dll!00007ffbd1974fd8() Unknown
combase.dll!00007ffbd19eaea2() Unknown
DataExchange.dll!00007ffb954688f2() Unknown
Microsoft.ui.xaml.dll!00007ffb1da03018() Unknown
Microsoft.ui.xaml.dll!00007ffb1d7d259d() Unknown
> WinUIDragOverCrash.exe!winrt::impl::consume_Microsoft_UI_Xaml_IDragEventArgs<winrt::Microsoft::UI::Xaml::IDragEventArgs>::DataView() Line 914 C++
WinUIDragOverCrash.exe!winrt::WinUIDragOverCrash::implementation::MainWindow::OnDragOver(const winrt::Windows::Foundation::IInspectable & __formal, const winrt::Microsoft::UI::Xaml::DragEventArgs & args) Line 38 C++
[External Code]
WinUIDragOverCrash.exe!winrt::impl::delegate<winrt::Microsoft::UI::Xaml::DragEventHandler,void <lambda>(const winrt::Windows::Foundation::IInspectable &, const winrt::Microsoft::UI::Xaml::DragEventArgs &)>::Invoke(void * sender, void * e) Line 4736 C++
[External Code]
WinUIDragOverCrash.exe!winrt::impl::consume_Microsoft_UI_Xaml_IApplicationStatics<winrt::Microsoft::UI::Xaml::IApplicationStatics>::Start(const winrt::Microsoft::UI::Xaml::ApplicationInitializationCallback & callback) Line 157 C++
WinUIDragOverCrash.exe!winrt::Microsoft::UI::Xaml::Application::Start::__l2::<lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics & f) Line 12146 C++
WinUIDragOverCrash.exe!winrt::impl::factory_cache_entry<winrt::Microsoft::UI::Xaml::Application,winrt::Microsoft::UI::Xaml::IApplicationStatics>::call<void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &) &>(winrt::Microsoft::UI::Xaml::Application::Start::__l2::void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &) & callback) Line 6331 C++
WinUIDragOverCrash.exe!winrt::impl::call_factory<winrt::Microsoft::UI::Xaml::Application,winrt::Microsoft::UI::Xaml::IApplicationStatics,void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &)>(winrt::Microsoft::UI::Xaml::Application::Start::__l2::void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &) && callback) Line 6354 C++
WinUIDragOverCrash.exe!winrt::Microsoft::UI::Xaml::Application::Start(const winrt::Microsoft::UI::Xaml::ApplicationInitializationCallback & callback) Line 12147 C++
Expected behavior
I would expect that winrt::Microsoft::UI::Xaml::DragEventArgs::DataView() and winrt::Microsoft::UI::Xaml::DragEventArgs::Modifiers() can be accessed in the DragOver event handler without need of switching between threads.
Screenshots
Wrong Drop Area of WinUI 1.1.0 Preview 2

NuGet package version
No response
Windows app type
- UWP
- Win32
Device form factor
Desktop
Windows version
Windows 10 (21H2): Build 19044, Windows 10 (20H2): Build 19042
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:30 (7 by maintainers)

Top Related StackOverflow Question
fix is now available in Windows App SDK 1.2 Preview 1
@Scottj1s That’s not an option. I looked into that, but I need to change lots of code for this to work. It is a big app that touches every aspect of the life cycle. We also use appinstaller technology for getting updates.