WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

GetActivatedEventArgs throws when activated by App/PushNotifications without calling Register

Open pmpurifoy opened this issue 3 years ago • 2 comments

Describe the bug

An app activated by App/PushNotifications but does not call App/PushNotificationManager.Default.Register, will throw on GetActivatedEventArgs.

Instead, the app shouldn't throw and should return null args.

Steps to reproduce the bug

  1. Build an unpackaged/packaged app with a dependency on the WinAppSDK.
  2. Follow the quickstart to enable app to receive Push/AppNotifications.
  3. Activate the app with either Push or AppNotification.
  4. Call GetActivatedEventArgs without Push/AppNotificationManager.Default.Register.
  5. App throws due to the wait event not being initialized.

Expected behavior

No response

Screenshots

No response

NuGet package version

No response

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

No response

pmpurifoy avatar Sep 10 '22 17:09 pmpurifoy

Thanks for filling this issue. Just want to add that it wasn't ERROR_TIMEOUT.

[0x0]   KERNELBASE!RaiseFailFastException + 0x152   
[0x1]   Microsoft_WindowsAppRuntime!wil::details::WilDynamicLoadRaiseFailFastException + 0x49   
[0x2]   Microsoft_WindowsAppRuntime!wil::details::WilRaiseFailFastException + 0x18   
[0x3]   Microsoft_WindowsAppRuntime!wil::details::WilFailFast + 0xa8   
[0x4]   Microsoft_WindowsAppRuntime!wil::details::ReportFailure_NoReturn<3> + 0x273   
[0x5]   Microsoft_WindowsAppRuntime!wil::details::ReportFailure_Base<3,0> + 0x30   
[0x6]   Microsoft_WindowsAppRuntime!wil::details::ReportFailure_Hr<3> + 0x5a   
[0x7]   Microsoft_WindowsAppRuntime!wil::details::in1diag3::_FailFast_Unexpected + 0x22   
[0x8]   Microsoft_WindowsAppRuntime!wil::handle_wait + 0x56   
[0x9]   Microsoft_WindowsAppRuntime!wil::event_t<wil::details::unique_storage<wil::details::resource_policy<void *,void (__cdecl*)(void *) noexcept,&wil::details::CloseHandle,wistd::integral_constant<unsigned __int64,0>,void *,void *,0,std::nullptr_t> >,wil::err_exception_policy>::wait + 0x56   
[0xa]   Microsoft_WindowsAppRuntime!winrt::Microsoft::Windows::AppNotifications::implementation::AppNotificationManager::Deserialize + 0x77   
[0xb]   Microsoft_WindowsAppRuntime!winrt::Microsoft::Windows::AppNotifications::implementation::AppNotificationManager::AppNotificationDeserialize + 0x84   
[0xc]   Microsoft_WindowsAppRuntime!winrt::Microsoft::Windows::AppLifecycle::implementation::DecodeActivatedEventArgs + 0x20b   
[0xd]   Microsoft_WindowsAppRuntime!winrt::Microsoft::Windows::AppLifecycle::implementation::GetEncodedLaunchActivatedEventArgs + 0x40   
[0xe]   Microsoft_WindowsAppRuntime!winrt::Microsoft::Windows::AppLifecycle::implementation::AppInstance::GetActivatedEventArgs + 0x5ac   
[0xf]   Microsoft_WindowsAppRuntime!winrt::impl::produce<winrt::Microsoft::Windows::AppLifecycle::implementation::AppInstance,winrt::Microsoft::Windows::AppLifecycle::IAppInstance>::GetActivatedEventArgs + 0x1b   
[0x10]   0x7ffddc6f4eb0   
[0x11]   Microsoft_Windows_AppLifecycle_Projection!ABI.Microsoft.Windows.AppLifecycle.IAppInstanceMethods.GetActivatedEventArgs + 0x7b   
[0x12]   Microsoft_Windows_AppLifecycle_Projection!Microsoft.Windows.AppLifecycle.AppInstance.GetActivatedEventArgs + 0x21   

nxtn-staged avatar Sep 11 '22 03:09 nxtn-staged

Woops! Just updated the bug to correctly describe the error of m_waitHandleForArgs not being initialized. Thanks for the correction!

pmpurifoy avatar Sep 11 '22 03:09 pmpurifoy