Describe the bug
Closing the sign in popup window with title bar close button causes unhandled exception. I'm using Microsoft.Toolkit.Uwp.UI.Controls.Graph library version 5.1.0.
Steps to Reproduce
- Open a solution containing the AadLogin control. For example Microsoft Graph Training Module solution.
- Start debugging the solution and click the AadLogin button. A sign in page should appear on a popup window.
- Close the window by clicking the close button on the title bar.

- An unhandled exception of type "Microsoft.Identity.Client.MsalClientException" crashes the software with message: "User canceled authentication. On an Android device, this could be due to the lack of capabilities, such as custom tabs, for the system browser. See https://aka.ms/msal-net-system-browsers for more information."

Expected behavior
The window should close without exception being thrown.
Environment
NuGet Package(s):
Microsoft.Graph v1.19.0
Microsoft.NETCore.UniversalWindowsPlatform v6.2.9
Microsoft.Toolkit.Uwp.UI.Controls v5.1.1
Microsoft.Toolkit.Uwp.UI.Controls.DataGrid v5.1.0
Microsoft.Toolkit.Uwp.UI.Controls.Graph v5.1.0
Package Version(s):
Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (build number: )
- [x] Version 1903 OS Build 18362.418
App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (xxxxx)
- [x] Windows 10, version 1809 (10.0; Build 17763)
Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT
Visual Studio
- [x] 2017 (version: 15.9.17)
- [ ] 2019 (version: )
- [ ] 2019 Preview (version: )
Additional context
Another issue I created about this earlier Unhandled exception when login window is closed
Describe the bug
Closing the sign in popup window with title bar close button causes unhandled exception. I'm using Microsoft.Toolkit.Uwp.UI.Controls.Graph library version 5.1.0.
Steps to Reproduce
Expected behavior
The window should close without exception being thrown.
Environment
Additional context
Another issue I created about this earlier Unhandled exception when login window is closed