Closed Bug 775378 Opened 10 years ago Closed 10 years ago

Exceptions in winrt event callbacks fail to trigger the exception handler


(Toolkit :: Crash Reporting, defect)

Windows 8.1
Not set





(Reporter: jimm, Assigned: jimm)



(Whiteboard: completed-elm)


(1 file)

Haven't had a chance to dig into this yet. Basically when we're in winrt callbacks, the runtime handles exceptions directly rather than calling our handlers. try-catch com exception handling doesn't avoid this. Typical stacks:

msvcr110.dll!_invoke_watson(const wchar_t * pszExpression=0x02c307d0, const wchar_t * pszFunction=0x005ea040, const wchar_t * pszFile=0x05541b58, unsigned int nLine=47643288, unsigned int pReserved=47643316) Line 131	C++
vccorlib110.dll!__abi_FailFast() Line 18	C++
xul.dll!?__abi_Windows_Foundation_?$TypedEventHandler@P$AAVCoreWindow@Core@UI@Windows@@P$AAVKeyEventArgs@234@___abi_IDelegate____abi_Invoke@?Q__abi_IDelegate@?$TypedEventHandler@P$AAVCoreWindow@Core@UI@Windows@@P$AAVKeyEventArgs@234@@Foundation@Windows@@234@U$AAGJP$AAVCoreWindow@Core@UI@4@P$AAVKeyEventArgs@674@@Z(Windows::UI::Core::CoreWindow ^ __param0=0x005ea040, Windows::UI::Core::KeyEventArgs ^ __param1=0x05541b58)	C++
Windows.UI.dll!660a1871()	Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for Windows.UI.dll]	
Windows.UI.dll!660b3c3c()	Unknown
Windows.UI.dll!660adf1e()	Unknown
user32.dll!_InternalCallWinProc@20()	Unknown
user32.dll!_UserCallWinProcCheckWow@36()	Unknown
user32.dll!_CallWindowProcAorW@24()	Unknown
user32.dll!_CallWindowProcW@20()	Unknown
xul.dll!MetroWidget::WindowProcedure(HWND__ * aWnd=0x000f0418, unsigned int aMsg=256, unsigned int aWParam=68, long aLParam=2097153) Line 282	C++
user32.dll!_InternalCallWinProc@20()	Unknown
user32.dll!_UserCallWinProcCheckWow@36()	Unknown
user32.dll!_DispatchMessageWorker@8()	Unknown
user32.dll!_DispatchMessageW@4()	Unknown
Windows.UI.dll!660a1916()	Unknown
ntdll.dll!_RtlReleaseSRWLockExclusive@4()	Unknown
0068e365()	Unknown
xul.dll!Windows::ApplicationModel::DataTransfer::IDataPackagePropertySet::Title::set(Platform::String ^ __param0=0x00000002)	C++
xul.dll!mozilla::widget::winrt::FrameworkView::[Windows::ApplicationModel::Core::IFrameworkView]::Run() Line 85	C++

for a null deref in the key down event handler. We'll need to figure out what's going on here and fix it, the resulting exception brings up windows error reporting.
The generated code traps these:

namespace Windows
  namespace Foundation
    __declspec ( no_refcount ) inline long __stdcall :: Windows :: Foundation :: ?$TypedEventHandler...
      long __hr = 0 ;
        Invoke ( __param0 , __param1 ) ;
      catch ( :: Platform :: Exception ^ __param0 )
        __hr = Platform :: Details :: ReCreateFromException ( __param0 ) ;
      catch ( ... )
        __abi_FailFast ( ) ;
      return __hr ;
Horrible. Can we override __abi_FailFast?
(and just have it mozalloc_abort()?)
(In reply to Ted Mielczarek [:ted] from comment #2)
> Horrible. Can we override __abi_FailFast?

I was searching the net yesterday for a clean way to do this but didn't find much. We already do something like this for free but it requires some ugly link hacking.

Any ideas?
Since we delay load vccorlib, I think we can trap this in our DelayDllLoadHook.
Attached patch patchSplinter Review
Assignee: nobody → jmathies
Attachment #644763 - Flags: review?(ted.mielczarek)
Comment on attachment 644763 [details] [diff] [review]

Review of attachment 644763 [details] [diff] [review]:

Looks sensibly crazy.
Attachment #644763 - Flags: review?(ted.mielczarek) → review+
Whiteboard: completed-elm
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
OS: Windows 8 Metro → Windows 8.1
You need to log in before you can comment on or make changes to this bug.