dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.4k stars 976 forks source link

Intermittent fatal exception opening file dialog #12305

Open blusteryDay opened 1 week ago

blusteryDay commented 1 week ago

Description

One of our testers is seeing a very intermittent fatal exception attempting to open a file dialog to browse the file system. The application simply terminates, bypassing our main exception handler. Restarting the application and opening the file dialog in the same way with the same initial folder and filter is successful. This exception has occurred 3 times in hundreds of attempts over two weeks of testing.

Reproduction Steps

Various places in the application attempt to open a file dialog, which causes a very intermittent exception.

Expected behavior

No exception, file dialog is shown

Actual behavior

Unhandled exception occurs and application terminates.

Call stacks for 8.0.6 and 8.0.8

CoreCLR Version: 8.0.624.26715 .NET Version: 8.0.6 Description: The process was terminated due to an unhandled exception. Exception Info: exception code c0000005, exception address 00007FFD2B1C048E Stack: at Windows.Win32.UI.Shell.IFileDialog.Show(Windows.Win32.Foundation.HWND) at System.Windows.Forms.FileDialog.TryRunDialogVista(Windows.Win32.Foundation.HWND, Boolean ByRef) at System.Windows.Forms.FileDialog.RunDialog(IntPtr) at System.Windows.Forms.CommonDialog.ShowDialog(System.Windows.Forms.IWin32Window)

CoreCLR Version: 8.0.824.36612 .NET Version: 8.0.8 Description: The process was terminated due to an unhandled exception. Exception Info: exception code c0000005, exception address 00007FFA649AE46E Stack: at Windows.Win32.UI.Shell.IFileDialog.Show(Windows.Win32.Foundation.HWND) at System.Windows.Forms.FileDialog.TryRunDialogVista(Windows.Win32.Foundation.HWND, Boolean ByRef) at System.Windows.Forms.FileDialog.RunDialog(IntPtr) at System.Windows.Forms.CommonDialog.ShowDialog(System.Windows.Forms.IWin32Window)

Regression?

We have not seen this prior to updating to .NET 8, although it is so random that we can't confirm it does not exist prior to that.

Known Workarounds

No response

Configuration

Windows 10 Enterprise 22H2, build 19045.4894; Occurred with .NET 8.0.6 and 8.0.8 Desktop is in dark mode if that's relevant.

Other information

No response

jeffschwMSFT commented 1 week ago

@merriemcgaw do you feel that this is appropriate for dotnet/winforms? (I do not seem to have transfer rights to that repo)

merriemcgaw commented 1 week ago

I'll move it, but my guess is that this is a Windows issue, rather than WinForms.

merriemcgaw commented 5 days ago

@Olina-Zhang could your teams try to create a test app and see if we can reproduce this in-house? If we can, let's check whether frequency changes with .NET 9 or with different versions of Windows. Thanks!

Olina-Zhang commented 1 day ago

@merriemcgaw We tried many times on Windows 10 Enterprise 22H2, but it didn't reproduce.