Skip to content

[Problem/Bug]: when using System.Windows.Forms.OpenFileDialog on a Razor page, an exception is thrown after waiting about 30 seconds after the dialog pops up: System.Runtime.InteropServices.SEHException: "External component has thrown an exception." #5374

@mmgdh

Description

@mmgdh

What happened?

In Winfrom or WPF Project,when using System.Windows.Forms.OpenFileDialog on a Razor page, an exception is thrown after waiting about 30 seconds after the dialog pops up: System.Runtime.InteropServices.SEHException: "External component has thrown an exception."
The demo project is located at this address:
https://github.com/mmgdh/TestFileDialog.

I have submitted an issue on WPF, and they tested it and found that the exception occurs in EmbeddedBrowserWebView
#11126

Here is my StackTrace:
在 Windows.Win32.UI.Shell.IFileDialog.Show(HWND hwndOwner)
在 System.Windows.Forms.FileDialog.TryRunDialogVista(HWND hWndOwner, Boolean& returnValue)
在 System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)
在 System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
在 TestFileDialog.FileHelper.ShowFileDialog(String filter, Boolean multiselect) 在 E:\Code\zetian\Test\TestFileDialog\FileHelper.cs 中: 第 35 行
在 TestFileDialog.FileHelper.PickSingleFile(String filter) 在 E:\Code\zetian\Test\TestFileDialog\FileHelper.cs 中: 第 21 行
在 TestFileDialog.Routes.Click() 在 E:\Code\zetian\Test\TestFileDialog\Routes.razor 中: 第 14 行
在 Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync[T](MulticastDelegate delegate, T arg)
在 Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync(Object arg)
在 Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, Object arg)
在 Microsoft.AspNetCore.Components.EventCallback.InvokeAsync(Object arg)
在 Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs, Boolean waitForQuiescence)

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

1.0.3179.45

SDK Version

9.0.100

Framework

WPF

Operating System

Windows 11

OS Version

No response

Repro steps

1.Click Button “Throw Error Wait 30 Seconds” Invoke OpenFileDialog
2.Wait for a while maybe 30 Seconds
3.Throw Error:System.Runtime.InteropServices.SEHException: "External component has thrown an exception."

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions