Closed nik9play closed 1 year ago
I think I've found the problem. When WebAuthenticator
is initialized, it gets activated arguments:
However, as stated in the Microsoft docs (https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/notifications/app-notifications/app-notifications-quickstart?tabs=cs#step-3-register-to-handle-an-app-notification), you cannot call GetActivatedEventArgs()
before the AppNotificationManager is registered. If OnAppCreation
is commented out in the Init
method, everything works fine.
Maybe we should make WebAuthenticator
initialization optional or manual?
You cannot call GetActivatedEventArgs() before the AppNotificationManager is registered.
According to https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.appinstance.getactivatedeventargs?view=winrt-22621 you can call it before even App.xaml gets called and samples shows it called in the main method:
I think the above statement only applies if you use app notifications.
If there is a
WindowEx
window in the project, the application that is not running crashes when the notification is clicked and also when the application is started with the argument----AppNotificationActivated:
.When Native Code Debugging is enabled it gets me there:![изображение](https://user-images.githubusercontent.com/13693620/227712851-7137ed06-d624-4172-aa86-beaaf1541319.png)
Seems like
m_activatedEventArgs
andm_waitHandleForArgs
are null.Looks like the window object does not even have to be created for the bug to happen. This happens in packaged in unpackaged modes.
I'm also created issue in WinAppSDK repo (https://github.com/microsoft/WindowsAppSDK/issues/3535) before I knew about the
WindowEx
bug.