microsoft / microsoft/microsoft-ui-xaml

App crashes with native error "Indirect call guard check detected invalid control transfer."

Open
#10,083 0 comments 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

Since we switched our App from UWP to WinUI it randomly crashes. When I open the dump it's always the same exception:
Unhandled exception at 0x772D9D40 (ntdll.dll) in Dump.dmp: Indirect call guard check detected invalid control transfer.

The call stack locks like this:
> ntdll.dll!@RtlFailFast2@8() Unknown
ntdll.dll!@RtlpHandleInvalidUserCallTarget@4() Unknown
ntdll.dll!_LdrpValidateUserCallTargetBitMapRet@0() Unknown
[Inline Frame] Microsoft.UI.Xaml.Phone.dll!Microsoft::WRL::Callback::__l2::::operator()(IInspectable * &&) Line 479 C++
Microsoft.UI.Xaml.Phone.dll!Microsoft::WRL::Details::DelegateArgTraits::DelegateInvokeHelper'::`2'::,1,IInspectable *,ABI::Microsoft::UI::Xaml::IRoutedEventArgs *>::Invoke(IInspectable * , ABI::Microsoft::UI::Xaml::IRoutedEventArgs * ) Line 354 C++
Microsoft.UI.Xaml.dll!DirectUI::CEventSourceBase,ABI::Microsoft::UI::Xaml::Documents::ITextElement,ABI::Microsoft::UI::Xaml::Input::IAccessKeyDisplayDismissedEventArgs>::Raise(ABI::Microsoft::UI::Xaml::Documents::ITextElement * pSource, ABI::Microsoft::UI::Xaml::Input::IAccessKeyDisplayDismissedEventArgs * pArgs) Line 271 C++
Microsoft.UI.Xaml.dll!DirectUI::CEventSourceBase::UntypedRaise(IInspectable * pSource, IInspectable * pArgs) Line 243 C++
Microsoft.UI.Xaml.dll!DirectUI::DependencyObject::FireEvent(KnownEventIndex nEventId, IInspectable * pSender, IInspectable * pArgs) Line 3452 C++
Microsoft.UI.Xaml.dll!DirectUI::DXamlCore::FireEvent(CDependencyObject * pCoreListener, KnownEventIndex eventId, CDependencyObject * pCoreSender, CEventArgs * pCoreArgs, unsigned int flags) Line 2040 C++
[Inline Frame] Microsoft.UI.Xaml.dll!AgCoreCallbacks::FireEvent(CDependencyObject *) Line 89 C++
[Inline Frame] Microsoft.UI.Xaml.dll!FxCallbacks::JoltHelper_FireEvent(CDependencyObject *) Line 877 C++
Microsoft.UI.Xaml.dll!CCoreServices::CLR_FireEvent(CDependencyObject * pListener, EventHandle hEvent, CDependencyObject * pSender, CEventArgs * pArgs, unsigned int flags) Line 3181 C++
Microsoft.UI.Xaml.dll!CommonBrowserHost::CLR_FireEvent(CDependencyObject * pListener, EventHandle hEvent, CDependencyObject * pSender, CEventArgs * pArgs, unsigned int flags) Line 680 C++
Microsoft.UI.Xaml.dll!CControlBase::ScriptCallback(void * pControl, CDependencyObject * pListener, EventHandle hEvent, CDependencyObject * pSender, CEventArgs * pArgs, int flags, IScriptObject * pScriptObject, HRESULT(__stdcall*)(CDependencyObject *, CEventArgs *) pInternalHandler) Line 213 C++
Microsoft.UI.Xaml.dll!CXcpDispatcher::OnScriptCallback(CEventInfo * pEventInfo) Line 1019 C++
Microsoft.UI.Xaml.dll!CXcpDispatcher::OnWindowMessage(unsigned int msg, unsigned int wParam, long lParam) Line 874 C++
Microsoft.UI.Xaml.dll!CXcpDispatcher::ProcessMessage(unsigned int msg, unsigned int wParam, long lParam) Line 630 C++
Microsoft.UI.Xaml.dll!CDeferredInvoke::DispatchQueuedMessage(bool * dispatchedWork, bool * hasMoreWork) Line 147 C++
Microsoft.UI.Xaml.dll!CXcpDispatcher::MessageTimerCallback() Line 1215 C++
[Inline Frame] Microsoft.UI.Xaml.dll!CXcpDispatcher::MessageTimerCallbackStatic(void *) Line 1203 C++
[Inline Frame] Microsoft.UI.Xaml.dll!CXcpDispatcher::Init::__l46::::operator()(ABI::Microsoft::UI::Dispatching::IDispatcherQueueTimer *) Line 313 C++
Microsoft.UI.Xaml.dll!Microsoft::WRL::Details::DelegateArgTraits,IInspectable *>::*)(ABI::Microsoft::UI::Dispatching::IDispatcherQueueTimer *,IInspectable *)>::DelegateInvokeHelper,ABI::Windows::Foundation::ITypedEventHandler,Microsoft::WRL::FtmBase>,`CXcpDispatcher::Init'::`46':: &,1,ABI::Microsoft::UI::Dispatching::IDispatcherQueueTimer *,IInspectable *>::Invoke(ABI::Microsoft::UI::Dispatching::IDispatcherQueueTimer * , IInspectable * ) Line 354 C++

### Steps to reproduce the bug

I can't reproduce it. It appears randomly

### Expected behavior

_No response_

### Screenshots

![Image](https://github.com/user-attachments/assets/10923660-14ac-4e63-a37f-6e32e95a0522)

### NuGet package version

WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002

### Windows version

Windows 11 (22H2): Build 22621

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the supplied dump and call stack, focusing on the WinUI 3 DatePickerFlyout event path and the indirect call guard failure on Windows 11 22H2. Since the report has no reproduction steps or named source files/tests, investigate how to obtain a reproducible trigger; done means identifying the cause and validating a fix against the random crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.