Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ObjectDisposedException crashes app using WindowsFormsWebAuthenticationDialog #4924

Open
ryanmolden opened this issue Sep 11, 2024 · 0 comments

Comments

@ryanmolden
Copy link

ryanmolden commented Sep 11, 2024

Library version used

4.61.3

.NET version

net462

Scenario

PublicClient - desktop app

Is this a new or an existing app?

The app is in production, and I have upgraded to a new version of MSAL

Issue description and reproduction steps

This is a crash in Perfview. Specifically, this (abbreviated, simplified) callstack tries to show a dialog:

<snip>
mscorlib_ni!System.ObjectDisposedException..ctor()
System_Windows_Forms_ni!System.Windows.Forms.Control.DestroyHandle(...)
System_Windows_Forms_ni!System.Windows.Forms.Form.ShowDialog(...)
System_Windows_Forms_ni!System.Windows.Forms.Form.ShowDialog(...)
Microsoft_Identity_Client!Microsoft.Identity.Client.Platforms.Features.WinFormsLegacyWebUi.WindowsFormsWebAuthenticationDialog.<>c__DisplayClass5_0.<ShowBrowser>b__0(...)
Microsoft_Identity_Client!Microsoft.Identity.Client.Platforms.Features.WinFormsLegacyWebUi.WindowsFormsWebAuthenticationDialogBase.InvokeHandlingOwnerWindow(...)
Microsoft_Identity_Client!Microsoft.Identity.Client.Platforms.Features.WinFormsLegacyWebUi.WindowsFormsWebAuthenticationDialog.ShowBrowser(...)
<snip>

In doing so it decides it already has created an HWND (not sure why, this is the first time it tried to show me any authentication dialog). Because of that it creates an ObjectDisposedException (but does not throw it).

It then queues the ObjectDisposedException as a result for anyone waiting on UI thread callbacks registered through the control (presumably because they were tied to the window it is about to destroy).

Then, one such callback encounters the exception, it is thrown, and crashes PerfView along this (abbreviated, simplified) callstack:

KERNELBASE!RaiseException(...)
clr!RaiseTheExceptionInternalOnly(...)
clr!IL_Throw(...)
mscorlib_ni!System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(...)
mscorlib_ni!System.Threading.CancellationTokenSource.NotifyCancellation(...)
mscorlib_ni!System.Threading.CancellationTokenSource.TimerCallbackLogic(...)
mscorlib_ni!System.Threading.ExecutionContext.RunInternal(...)
mscorlib_ni!System.Threading.ExecutionContext.Run(...)
mscorlib_ni!System.Threading.TimerQueueTimer.CallCallback(...)
mscorlib_ni!System.Threading.TimerQueueTimer.Fire(...)
mscorlib_ni!System.Threading.TimerQueue.FireNextTimers(...)
<snip>

I am MSFT internal and have heap dumps both when the ODE is created and when the app crashes due to it getting thrown and no one handling it. You can contact me internally at rmolden.

Relevant code snippets

No response

Expected behavior

Not to crash the app using the dialog

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

No response

@ryanmolden ryanmolden added needs attention Delete label after triage untriaged Do not delete. Needed for Automation labels Sep 11, 2024
@ryanmolden ryanmolden changed the title ObjectDisposedException crashes app using WindowsFormsWebAuthenticationDialog [Bug] ObjectDisposedException crashes app using WindowsFormsWebAuthenticationDialog Sep 11, 2024
@ashok672 ashok672 added tracked-ado and removed untriaged Do not delete. Needed for Automation needs attention Delete label after triage labels Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants