MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
447 stars 53 forks source link

Open the file dialog box causes a crash #3028

Closed dujianxin closed 1 year ago

dujianxin commented 1 year ago

Description After upgrading webview2 to version 108.0.1462.44, run the program in administrator mode, open the file dialog box, and a crash occurs.

Version SDK: 1.0.1462.37 Runtime: 108.0.1462.44 Framework: WPF OS: Win11

Repro Steps

  1. run the program in administrator mode.
  2. visit https://www.google.com, click 'search by image' to open a file dialog box and select the desktop directory.
  3. return to windows desktop.
  4. crash occurs.

Screenshots 1

Additional context

*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************

*** WARNING: Unable to verify checksum for Pasteur.exe
*** WARNING: Unable to verify checksum for libcef.dll

KEY_VALUES_STRING: 1

    Key  : Analysis.CPU.mSec
    Value: 102749

    Key  : Analysis.DebugAnalysisManager
    Value: Create

    Key  : Analysis.Elapsed.mSec
    Value: 797146

    Key  : Analysis.IO.Other.Mb
    Value: 145

    Key  : Analysis.IO.Read.Mb
    Value: 5

    Key  : Analysis.IO.Write.Mb
    Value: 545

    Key  : Analysis.Init.CPU.mSec
    Value: 749

    Key  : Analysis.Init.Elapsed.mSec
    Value: 1234104

    Key  : Analysis.Memory.CommitPeak.Mb
    Value: 1042

    Key  : CLR.BuiltBy
    Value: NET481REL1LAST_C

    Key  : CLR.Engine
    Value: CLR

    Key  : CLR.Version
    Value: 4.8.9105.0

    Key  : Timeline.Process.Start.DeltaSec
    Value: 101

    Key  : WER.OS.Branch
    Value: ni_release

    Key  : WER.OS.Timestamp
    Value: 2022-05-06T12:50:00Z

    Key  : WER.OS.Version
    Value: 10.0.22621.1

    Key  : WER.Process.Version
    Value: 2.0.0.0

FILE_IN_CAB:  Pasteur.exe.29240.dmp

NTGLOBALFLAG:  0

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS:  0

CONTEXT:  (.ecxr)
rax=0000000000000000 rbx=0000000000000113 rcx=00000155b6640000
rdx=00000155b6640000 rsi=0000000000000000 rdi=0000141400288300
rip=00007ffb75aa6e3d rsp=0000003987b8c800 rbp=0000003987b8c900
 r8=00000155b6476cc0  r9=0000000000000001 r10=0000000000000003
r11=0000003987b8c820 r12=0000141400251e40 r13=0000000000000000
r14=0000000000230d54 r15=000014140024c420
iopl=0         nv up ei pl zr na po nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000244
EmbeddedBrowserWebView!base::debug::BreakDebuggerAsyncSafe+0xd:
00007ffb`75aa6e3d cc              int     3
Resetting default scope

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 00007ffb75aa6e3d (EmbeddedBrowserWebView!base::debug::BreakDebuggerAsyncSafe+0x000000000000000d)
   ExceptionCode: 80000003 (Break instruction exception)
  ExceptionFlags: 00000000
NumberParameters: 1
   Parameter[0]: 0000000000000000

PROCESS_NAME:  Pasteur.exe

ERROR_CODE: (NTSTATUS) 0x80000003 - {    }

EXCEPTION_CODE_STR:  80000003

EXCEPTION_PARAMETER1:  0000000000000000

STACK_TEXT:  
00000039`87b8c800 00007ffb`7582eb3c     : 00000039`00000000 00000000`00000113 00000000`00000000 00000000`00000000 : EmbeddedBrowserWebView!base::debug::BreakDebuggerAsyncSafe+0xd
00000039`87b8c830 00007ffb`75883440     : 00000000`00000113 00000000`00000000 00001414`00288300 00000000`00000000 : EmbeddedBrowserWebView!embedded_browser_webview::internal::AppTaskRunner::MessageCallback+0x3c
00000039`87b8c860 00007ffb`7598c52f     : 00000155`92666c50 00000000`00000000 00001dcf`af5c77a0 00007ffc`44b95b98 : EmbeddedBrowserWebView!base::win::MessageWindow::WindowProc+0xf0
00000039`87b8c8e0 00007ffc`aa888271     : 00000000`00000000 00007ffc`aa894671 00000000`00000000 00000000`80009011 : EmbeddedBrowserWebView!base::win::WrappedWindowProc<&base::win::MessageWindow::WindowProc>+0xf
00000039`87b8c910 00007ffc`aa887d31     : 00000000`00000000 00007ffb`7598c520 00000000`00230d54 00000039`87b8cb40 : user32!UserCallWinProcCheckWow+0x2d1
00000039`87b8ca70 00007ffc`aa87183c     : 00000039`87b8cb40 00000000`00000000 00000000`0007128a 00000000`00000001 : user32!DispatchMessageWorker+0x1f1
00000039`87b8caf0 00007ffc`aa87152b     : 00000000`00000000 00000000`00000000 00000000`00000001 00000000`00000000 : user32!DialogBox2+0x2e8
00000039`87b8cba0 00007ffc`aa8713e2     : 00000155`931e9be0 00000000`0007128a 00007ffc`aaf79380 00007ffc`aaef0000 : user32!InternalDialogBox+0x127
00000039`87b8cc00 00007ffc`aa871378     : 00000000`00000000 00000039`87b8cdd0 00000155`92774b60 ffffffff`fffffffc : user32!DialogBoxIndirectParamAorW+0x52
00000039`87b8cc40 00007ffc`aaf35f20     : 00000000`00000000 00000039`00000000 00000155`00000004 00000039`87b8cdd0 : user32!DialogBoxIndirectParamW+0x18
00000039`87b8cc80 00007ffc`aaf01aec     : 00000000`00000000 00000155`00000165 00000000`00000100 00000000`00000001 : comdlg32!<lambda_f5e2b7f326e4941da317d6999ba6351a>::operator()+0x118
00000039`87b8ccd0 00007ffb`758212d8     : 00000000`00000000 00007ffb`7598c387 00000039`87b8d200 00000000`00000001 : comdlg32!CFileOpenSave::Show+0x9cc
00000039`87b8d0a0 00007ffb`7582203e     : 00000000`00000006 00000000`00000000 00000039`87b8d660 00007ffb`75ba4010 : EmbeddedBrowserWebView!embedded_browser_webview_current::internal::SelectFileDialogWin32::RunOpenFileDialog+0xce
00000039`87b8d1b0 00007ffb`7580fb98     : 00007141`ca1c4ca4 00000000`00000030 00000000`00000006 00007ffb`75b33b00 : EmbeddedBrowserWebView!embedded_browser_webview_current::internal::SelectFileDialogWin32::ExecuteSelectMultipleFile+0x8e
00000039`87b8d2a0 00007ffb`757f813e     : 00001414`00295508 00007ffb`75a7a1b0 00000000`00000000 00000000`00000000 : EmbeddedBrowserWebView!embedded_browser_webview_current::internal::EmbeddedBrowserFileDialog::LaunchFileDialog+0x274
00000039`87b8d3b0 00007ffb`75a74e7d     : 00007141`ca1c4ae4 00000000`00000000 00000000`00000000 00000039`87b8db30 : EmbeddedBrowserWebView!embedded_browser_webview_current::EmbeddedBrowserWebView::OnFileDialog+0xfe
00000039`87b8d480 00007ffb`7580159a     : 00000000`00000038 00001414`00294800 00000039`87b8db30 00007ffb`759e038f : EmbeddedBrowserWebView!embedded_browser::mojom::EmbeddedBrowserClientStubDispatch::AcceptWithResponder+0xd79
00000039`87b8d750 00007ffb`7592b467     : 00000155`bd3d16e8 00000000`00000000 00000000`ca1c4994 aaaaaa00`00000000 : EmbeddedBrowserWebView!embedded_browser::mojom::EmbeddedBrowserClientStub<mojo::RawPtrImplRefTraits<embedded_browser::mojom::EmbeddedBrowserClient> >::AcceptWithResponder+0x3a
00000039`87b8d7a0 00007ffb`75945945     : 00000000`00000001 00000000`00000001 00001414`00284b80 00000039`87b8db30 : EmbeddedBrowserWebView!mojo::InterfaceEndpointClient::HandleIncomingMessageThunk::Accept+0x657
00000039`87b8d8f0 00007ffb`7592bba8     : aaaaaaaa`00000000 00001414`00299680 00000039`87b8dba8 00007ffb`758c40b5 : EmbeddedBrowserWebView!mojo::MessageDispatcher::Accept+0x75
00000039`87b8d980 00007ffb`7589c6a7     : 00000039`87b8e030 00007ffb`7590f8dd 00001414`0020d1d0 00007ffb`75ba3cf0 : EmbeddedBrowserWebView!mojo::InterfaceEndpointClient::HandleIncomingMessage+0x38
00000039`87b8db10 00007ffb`7589c09e     : aaaaaaaa`aaaaaaaa aaaaaaaa`aaaaaaaa aaaaaaaa`aaaaaaaa aaaaaaaa`aaaaaaaa : EmbeddedBrowserWebView!mojo::internal::MultiplexRouter::ProcessIncomingMessage+0x27d
00000039`87b8dc00 00007ffb`75945945     : 00000000`00000000 00001414`0026c780 aaaaaaaa`00000000 00001414`00295480 : EmbeddedBrowserWebView!mojo::internal::MultiplexRouter::Accept+0x14e
00000039`87b8de30 00007ffb`758fd410     : 00000039`00000000 00000000`0000c2f1 00001dcf`af5c6190 00007ffb`fbd50ae1 : EmbeddedBrowserWebView!mojo::MessageDispatcher::Accept+0x75
00000039`87b8dec0 00007ffb`757ae1b7     : 00000000`00000000 00000000`00000000 00000000`00000000 00007ffb`9e1a7f75 : EmbeddedBrowserWebView!base::internal::Invoker<base::internal::BindState<void (mojo::Connector::*)(unsigned int),base::internal::UnretainedWrapper<mojo::Connector,base::RawPtrBanDanglingIfSupported> >,void (unsigned int)>::Run+0x260
00000039`87b8e0e0 00007ffb`7588f8a7     : 00000000`000d09f6 00000000`00000000 00000000`00000000 00007ffc`ab696cf7 : EmbeddedBrowserWebView!base::RepeatingCallback<void __cdecl(std::Cr::basic_string<char,std::Cr::char_traits<char>,std::Cr::allocator<char> > const & __ptr64)>::Run+0x27
00000039`87b8e110 00007ffb`7592e679     : 00000039`87b8e468 00007ffb`9c860940 00007ffb`9c856e40 00000039`87b8e100 : EmbeddedBrowserWebView!base::RepeatingCallback<void (crdtp::span<unsigned char>, const std::Cr::basic_string<char,std::Cr::char_traits<char>,std::Cr::allocator<char> > &)>::Run+0x27
00000039`87b8e140 00007ffb`758ec7e8     : 00000000`00000000 00000000`000d09f6 00001dcf`af5c5df0 00000155`bab476a0 : EmbeddedBrowserWebView!mojo::SimpleWatcher::OnHandleReady+0x269
00000039`87b8e280 00007ffb`7582f4c9     : 00000000`00000000 00007ffb`75885e81 00000155`bab476a0 00007ffb`758e7f16 : EmbeddedBrowserWebView!base::TaskAnnotator::RunTaskImpl+0x128
00000039`87b8e330 00007ffb`7582f14d     : 00007ffb`9c0e3324 00007ffc`aa887abb 00000000`000d09f6 00007ffb`9c0e3324 : EmbeddedBrowserWebView!base::TaskAnnotator::RunTask<>+0x2f
00000039`87b8e390 00007ffb`7582eb19     : 00000039`87b8e590 00000000`00000401 00000000`00000000 00000000`00000000 : EmbeddedBrowserWebView!embedded_browser_webview::internal::AppTaskRunner::DoWork+0x165
00000039`87b8e4c0 00007ffb`75883440     : 00000000`00000401 00000000`00000000 00000000`00000000 00007ffb`fbeeab11 : EmbeddedBrowserWebView!embedded_browser_webview::internal::AppTaskRunner::MessageCallback+0x19
00000039`87b8e4f0 00007ffb`7598c52f     : 00007a3f`fa9baa70 00007ffb`fbdb5d5d 00001dcf`af5c5b50 00007ffb`fbd501b1 : EmbeddedBrowserWebView!base::win::MessageWindow::WindowProc+0xf0
00000039`87b8e570 00007ffc`aa888271     : 00000000`00000000 00007ffc`ab6c39f0 00000000`00000000 00000000`80009011 : EmbeddedBrowserWebView!base::win::WrappedWindowProc<&base::win::MessageWindow::WindowProc>+0xf
00000039`87b8e5a0 00007ffc`aa887d31     : 00000000`00000000 00007ffb`7598c520 00000000`00230d54 00000039`87b8e880 : user32!UserCallWinProcCheckWow+0x2d1
00000039`87b8e700 00007ffb`9c2e314b     : 00000039`87b8e880 00000039`00000000 00000039`87b8eac8 00000039`87b8e880 : user32!DispatchMessageWorker+0x1f1
00000039`87b8e780 00007ffb`9572eeaf     : 00000155`ba8748c0 00000039`87b8e880 00007ffb`9c0e4000 00007ffb`9cdfb360 : 0x00007ffb`9c2e314b
00000039`87b8e840 00007ffb`8b09222d     : 00000155`ba42b5a0 00000155`bad0b260 00000155`ba82ba90 00000000`00000001 : WindowsBase+0xbeeaf
00000039`87b8e8d0 00007ffb`8b0909db     : 00000155`ba814148 00000000`00000000 00000000`2ab75028 00000195`b8000000 : PresentationFramework+0x30222d
00000039`87b8e910 00007ffb`9c2a582f     : 00000155`ba814148 00000000`00000000 00000155`b673ed90 00000000`0000000a : PresentationFramework+0x3009db
00000039`87b8e970 00007ffb`fbdbe423     : 00007ffb`fbc89124 00000039`87b8f0d8 00000039`87b8f0d8 00000039`87b8ec09 : 0x00007ffb`9c2a582f
00000039`87b8e9d0 00007ffb`fbc8932d     : 00000155`00000000 00000039`87b8eae0 00000039`87b8ea40 00000155`00000001 : coreclr!coreclr_shutdown_2+0xa923
00000039`87b8ea10 00007ffb`fbd4c108     : 00000039`87b8ec98 00000000`00000001 00000039`87b8ec48 00007ffb`fbd67556 : coreclr+0x2932d
00000039`87b8eb50 00007ffb`fbd4cd56     : 00000000`00000000 00000000`00000000 00000000`00000001 00000039`87b8f0d8 : coreclr!MetaDataGetDispenser+0x38dc8
00000039`87b8ec70 00007ffb`fbd4d0b4     : 00000155`b6723e30 00000039`00000001 00000155`b6723e30 00000155`b6723e30 : coreclr!MetaDataGetDispenser+0x39a16
00000039`87b8ed20 00007ffb`fbd1b8be     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : coreclr!MetaDataGetDispenser+0x39d74
00000039`87b8f0b0 00007ffb`fbda1b66     : 00000000`00000001 00000039`87b8f201 00000039`87b8f2c0 00000000`00000258 : coreclr!MetaDataGetDispenser+0x857e
00000039`87b8f1f0 00007ffc`73469628     : 00000155`b6736fd0 00000155`b6666840 00000155`b806a670 00000000`00000000 : coreclr!coreclr_execute_assembly+0xe6
00000039`87b8f280 00007ffc`734698fc     : 00000155`b664eda8 00000039`87b8f699 00007ffc`734abc50 00000155`b664eda8 : hostpolicy!run_app_for_context+0x4c8
00000039`87b8f410 00007ffc`7346a235     : 00000000`00000000 00000155`b664eda0 00000155`b664eda0 00007ffc`73469bd1 : hostpolicy!run_app+0x3c
00000039`87b8f450 00007ffc`0eefb77c     : 00007ffc`a8ecf4f8 00007ffc`7346be80 00007ffc`7346be80 00000000`00000001 : hostpolicy!corehost_main+0x145
00000039`87b8f600 00007ffc`0eefe3f7     : 00000155`b6666420 00000039`87b8fa30 00000000`00000000 00000000`00000000 : hostfxr!execute_app+0x2fc
00000039`87b8f700 00007ffc`0ef0075f     : 00007ffc`0ef38b48 00000155`b6655c80 00000039`87b8f970 00000039`87b8f920 : hostfxr!`anonymous namespace'::read_config_and_execute+0xa7
00000039`87b8f800 00007ffc`0eefea53     : 00000039`87b8fa30 00000039`87b8fa50 00000039`87b8f9a1 00000000`0000001b : hostfxr!fx_muxer_t::handle_exec_host_command+0x15f
00000039`87b8f8b0 00007ffc`0eef850b     : 00000039`87b8fa50 00000155`b6655e60 00000000`00000001 00000000`0000005c : hostfxr!fx_muxer_t::execute+0x483
00000039`87b8f9f0 00007ff6`00052acc     : 00007ffc`a8ecf4f8 00007ffc`0eef99e0 00007ffc`0eef99e0 00000155`b665d710 : hostfxr!hostfxr_main_startupinfo+0xab
00000039`87b8faf0 00007ff6`00052e3b     : 00007ff6`0005d4a0 00000000`00000007 00000155`b664eda0 00000000`0000005c : Pasteur_exe!exe_start+0x8fc
00000039`87b8fcc0 00007ff6`000542e8     : 00000000`00000000 00000155`b664eda0 00000000`00000000 00000000`00000000 : Pasteur_exe!wmain+0xab
00000039`87b8fcf0 00007ffc`ab00247d     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : Pasteur_exe!__scrt_common_main_seh+0x10c
00000039`87b8fd30 00007ffc`ab6cdfb8     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0x1d
00000039`87b8fd60 00000000`00000000     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x28

STACK_COMMAND:  ~0s; .ecxr ; kb

SYMBOL_NAME:  EmbeddedBrowserWebView!base::debug::BreakDebuggerAsyncSafe+d

MODULE_NAME: EmbeddedBrowserWebView

IMAGE_NAME:  EmbeddedBrowserWebView.dll

FAILURE_BUCKET_ID:  BREAKPOINT_80000003_EmbeddedBrowserWebView.dll!base::debug::BreakDebuggerAsyncSafe

OS_VERSION:  10.0.22621.1

BUILDLAB_STR:  ni_release

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

IMAGE_VERSION:  108.0.1462.44

FAILURE_ID_HASH:  {da76b05a-02c6-5589-2d9a-5d5b2e974e7e}

Followup:     MachineOwner
---------
victorthoang commented 1 year ago

Hello @dujianxin,

Thanks for your bug report. I've assigned this to a dev that can best try to replicate the issue and follow up on this.

plantree commented 1 year ago

Hi @dujianxin,

Sorry for replying late. I have tried as your repro steps in sample application of WPF, and it runs normally.

Could you provide more information about how to reproduce your issue?

Thanks.

getandplay commented 1 year ago

Got a similar issue here! But the difference is when I am running my WPF or Winform application with VS 2022, my application will crash without any errors! Here are my steps:

  1. Create a HostApi class

    [ClassInterface(ClassInterfaceType.AutoDual)]
    [ComVisible(true)]
    public class HostApi
    {
    public string SelectFolder()
    {
        string folderPath = null;
        using (FolderBrowserDialog openFolderDialog = new FolderBrowserDialog())
        {
            if (openFolderDialog.ShowDialog() == DialogResult.OK)
            {
                folderPath = openFolderDialog.SelectedPath;
            }
        }
    
        return folderPath;
    }
    }
  2. Call AddHostObjectToScript method to inject the HostApi instance to js
    
    public MainWindow()
    {
    MyWebView2.CoreWebView2InitializationCompleted += MyWebView2_CoreWebView2InitializationCompleted;
    }

private void MyWebView2_CoreWebView2InitializationCompleted(object sender, Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs e) { _hostApi = new HostApi(); MyWebView2.CoreWebView2.AddHostObjectToScript("hostApi", _hostApi); }


3. Load this html with the `MyWebView2` browser 
```html
<html>
<script>
  function selectFolder() {
        var result = window.chrome.webview.hostObjects.sync.hostApi.SelectFolder();
        console.log(result);
    }
</script>
<body>
    <div style="margin-top:15px">
        <button type="button" onclick="selectFolder()">test</button> 
    </div>
</body>
</html>
  1. Run this application with VS 2022, and click the test button, it will pop up the folder dialog, then wait about 1 minute, and the application will crash without any exceptions.
Crauzer commented 1 year ago

I have encountered the same issue when using Blazor hosted in a webview

robincodex commented 1 year ago

I use MessageBox also crashes, after the dialog is opened and not closed wait a few seconds will crash, prompt return value 2147483651 (0x80000003).

My code is simple:

chrome.webview.hostObjects.dialog.Error(message, title);
public void Error(string message, string title)
{
    MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Error);
}
plantree commented 1 year ago

Hi @getandplay @Crauzer @robincodex,

Could you provide more information about the exception? It seems that the issue arises when you use dialog in host object?

robincodex commented 1 year ago

Hi, @plantree Sorry, I just started learning C# and WPF and I don't quite understand how to get more detailed exceptions.

My dependencies :

  <ItemGroup>
    <PackageReference Include="dotenv.net" Version="3.1.2" />
    <PackageReference Include="EPPlus" Version="6.1.3" />
    <PackageReference Include="Microsoft.ClearScript" Version="7.3.7" />
    <PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="7.0.0" />
    <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1587.40" />
    <PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
    <PackageReference Include="Serilog" Version="2.12.0" />
    <PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
    <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
  </ItemGroup>

Here is my demo, running in Debug mode, this time the crash took a little longer, sometimes it was in a few seconds.

动画 (0)

'AvalonDevTools.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'E:\AvalonProjects\AvalonDevToolsDotnet\app\bin\Debug\net7.0-windows\AvalonDevTools.dll'. Symbols loaded.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\PresentationFramework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\WindowsBase.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\System.Xaml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\hotreload\Microsoft.Extensions.DotNetDeltaApplier.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.IO.Pipes.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Collections.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Console.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.InteropServices.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Threading.Overlapped.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Security.AccessControl.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Security.Principal.Windows.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Security.Claims.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.Loader.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\PrivateAssemblies\Runtime\Microsoft.VisualStudio.Debugger.Runtime.NetCoreApp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\netstandard.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Threading.ThreadPool.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'E:\AvalonProjects\AvalonDevToolsDotnet\app\bin\Debug\net7.0-windows\dotenv.net.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Diagnostics.TraceSource.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Collections.Concurrent.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'E:\AvalonProjects\AvalonDevToolsDotnet\app\bin\Debug\net7.0-windows\Serilog.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Text.RegularExpressions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'E:\AvalonProjects\AvalonDevToolsDotnet\app\bin\Debug\net7.0-windows\EPPlus.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'E:\AvalonProjects\AvalonDevToolsDotnet\app\bin\Debug\net7.0-windows\Serilog.Sinks.Console.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Memory.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'E:\AvalonProjects\AvalonDevToolsDotnet\app\bin\Debug\net7.0-windows\Serilog.Sinks.File.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\System.IO.Packaging.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Private.Uri.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\PresentationCore.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\DirectWriteForwarder.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\Microsoft.Win32.Registry.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Diagnostics.Debug.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Collections.Specialized.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.CompilerServices.VisualC.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\Microsoft.Win32.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Collections.NonGeneric.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.ComponentModel.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Threading.Thread.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\System.Configuration.ConfigurationManager.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Xml.ReaderWriter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Private.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Net.WebClient.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.ComponentModel.EventBasedAsync.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Text.Encoding.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.InteropServices.RuntimeInformation.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.IO.FileSystem.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.ComponentModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.ComponentModel.TypeConverter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\System.Windows.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.ObjectModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\UIAutomationTypes.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'E:\AvalonProjects\AvalonDevToolsDotnet\app\bin\Debug\net7.0-windows\Microsoft.Web.WebView2.Wpf.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'E:\AvalonProjects\AvalonDevToolsDotnet\app\bin\Debug\net7.0-windows\Microsoft.Web.WebView2.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Text.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Text.Encodings.Web.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Reflection.Emit.Lightweight.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Reflection.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Reflection.Emit.ILGeneration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.Intrinsics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Numerics.Vectors.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Security.Cryptography.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Net.Requests.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Net.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Net.WebHeaderCollection.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Threading.Tasks.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Drawing.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Diagnostics.Process.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\PresentationFramework.Aero2.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Diagnostics.StackTrace.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\xamldiagnostics\Core\x64\Microsoft.VisualStudio.DesignTools.WpfTap.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Diagnostics.Tracing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.Serialization.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Private.DataContractSerialization.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.Serialization.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.Serialization.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Resources.ResourceManager.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AvalonDevTools.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\UIAutomationProvider.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x6834 has exited with code 0 (0x0).
The thread 0x5e18 has exited with code 0 (0x0).
The thread 0x63c4 has exited with code 0 (0x0).
The thread 0x68f4 has exited with code 0 (0x0).
The program '[29500] AvalonDevTools.exe' has exited with code 2147483651 (0x80000003).
roa-nyx commented 1 year ago

I'm also getting this issue. I'm using WinForms with WebView2, and triggering a FolderBrowserDialog from a HostObject as well.

If I leave the FolderBrowserDialog open for longer then 20 seconds or so, it crashes my app. There is no exception. I also tried to add breakpoints in:

        AppDomain.CurrentDomain.FirstChanceException +=...

        AppDomain.CurrentDomain.UnhandledException += ...

To get more details but the app crashes without hitting these events.

Not sure what's happening...

Here's my debug log:

'TestApp.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Users\User\projects\TestApp\TestApp\bin\Debug\net7.0-windows10.0.19041.0\TestApp.dll'. Symbols loaded.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'c:\program files\microsoft visual studio\2022\community\common7\ide\commonextensions\microsoft\hotreload\Microsoft.Extensions.DotNetDeltaApplier.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.IO.Pipes.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Collections.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Console.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.InteropServices.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Threading.Overlapped.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Security.AccessControl.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Security.Principal.Windows.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Security.Claims.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.Loader.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Collections.Concurrent.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.ComponentModel.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\System.Windows.Forms.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Drawing.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Collections.Specialized.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Diagnostics.TraceSource.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\System.Drawing.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\Microsoft.Win32.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.ComponentModel.EventBasedAsync.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Threading.Thread.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\Accessibility.dll'. Module was built without symbols.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Users\User\projects\TestApp\TestApp\bin\Debug\net7.0-windows10.0.19041.0\Microsoft.Web.WebView2.WinForms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Users\User\projects\TestApp\TestApp\bin\Debug\net7.0-windows10.0.19041.0\Microsoft.Web.WebView2.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.ComponentModel.TypeConverter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\Microsoft.Win32.SystemEvents.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.ComponentModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Memory.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Numerics.Vectors.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.3\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Private.Uri.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Collections.NonGeneric.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Diagnostics.Process.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Text.RegularExpressions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Reflection.Emit.Lightweight.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Reflection.Emit.ILGeneration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Reflection.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Text.Encoding.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Threading.ThreadPool.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Text.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Threading.Tasks.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Runtime.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TestApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x7e70 has exited with code 0 (0x0).
The thread 0x791c has exited with code 0 (0x0).
The thread 0x2490 has exited with code 0 (0x0).
The thread 0x7828 has exited with code 0 (0x0).
The program '[30604] TestApp.exe' has exited with code 2147483651 (0x80000003).
roa-nyx commented 1 year ago

Ok I think I have some more details. I tried to run the application again through WinDbg, and I got this:

ModLoad: 00007ffd`faa40000 00007ffd`faa6e000   C:\WINDOWS\SYSTEM32\USERENV.dll
ModLoad: 00007ffd`c7c40000 00007ffd`c7d0d000   C:\WINDOWS\System32\cscui.dll
Running a message loop synchronously in an event handler in Webview can cause reentrancy issue. Please refer to https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/threading-model#re-entrancy for more information about threading model in WebView2 and how to enable native code debugging for this scenario.
(21d8.2e1c): Break instruction exception - code 80000003 (first chance)
EmbeddedBrowserWebView!base::debug::BreakDebuggerAsyncSafe+0xd:
00007ffd`8c0e193d cc              int     3

So I expect this message to relate to using the hostObject.sync (or default sync) to trigger a function, and then hitting a message loop on that sync call somehow. However I'm not using sync, so I'm not sure why this is triggering here.

I've tried the following:

Please let me know if I can provide any additional details or troubleshooting...

[EDIT]:

Slightly cleaner workaround for now: have the host object function trigger Task.Delay(0).ContinueWith(_ => frmMain.Invoke(anotherFunctionThatTriggersFolderBrowserDialog))

getandplay commented 1 year ago

Could you provide more information about the exception?

It just crashed, I didn't get any exceptions. Even if I call DispatcherUnhandledException += App_DispatcherUnhandledException; . And I also check the windows application logs, can't find anything related there. Do you have any idea to catch the exception?

It seems that the issue arises when you use dialog in host object?

Yes, and it has to use VS2022 to start the application. If run the application by double click the EXE file, it works fine.

BTW, I am using VS 2022 Preview in Mac Parallels.

@plantree

Crauzer commented 1 year ago

There are lots of issues in this repo complaining about this exact problem.

https://github.com/MicrosoftEdge/WebView2Feedback/issues/3062

alexkleinwaechter commented 1 year ago

I found that: This is due to running a message loop (modal dialog) from WebView2 event handler, which is not recommended, as no further webview events will be process before the dialog is dismissed and returned from the event handler. If you show the dialog asynchronous outside of WebView2 event handler, then it will be fine. This is actually not a real crash. If you run the app without a debugger attached, it will not crash. If you run the app under a debugger, we will display a message in debugger with link to https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/threading-model#re-entrancy, and break into debugger. That page has information on how to refactor the code to avoid this.

Source: https://github.com/MicrosoftEdge/WebView2Feedback/issues/2542

Good luck!

plantree commented 1 year ago

Hi all,

It seems that this is a known issue. Hope this #2668 could help.

robincodex commented 1 year ago

Hi guys, I reread the documentation today and saw this code, which can solve this problem. I have tried it and the program no longer crashes.

https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/threading-model

private void CoreWebView2_WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e)
{
   string msg = e.TryGetWebMessageAsString();
   if (msg == "Open Dialog")
   {
      // Show a modal dialog after the current event handler is completed, to avoid potential reentrancy caused by running a nested message loop in the WebView2 event handler.
      System.Threading.SynchronizationContext.Current.Post((_) => {
         Form1 form = new Form1();
         form.ShowDialog();
         form.Closed();
      }, null);
   }
}
jfmnet commented 3 months ago

Try this. This seems to solve the issue.

public async Task<string> OpenFile()
{
    //Make the method async
    //Add this line to make the method async
    await Task.Yield();

    var dialog = new OpenFileDialog();

    if (dialog.ShowDialog() == DialogResult.OK)
    {
        return dialog.FileName;
    }

    return "";
}
Jorginho211 commented 1 month ago

Im trying to move from CefSharp to WebView2 in a WinForms Application so I wanna move my code touching as less as posible the javascript code in the front-end. In my case, I need to return the result of the form (opendialog, savedialog) in the same call in a synchronously way, so that, the solution proposed by @robincodex doesn't work in my situation because I cant wait for the result and return it.

I tried different approaches like the one proposed by @jfmnet but it didn't work for me and the app continues crashing.

Trying and experimenting other approaches I find one that it will works for me and consists to open the dialog in another thread, started as Single Thread Apartment and wait for the completion.

public string OpenDialogFile(string filters = null, string title = null)
{
    string filePath = null;

    Thread thread = new Thread(() => {
        using (OpenFileDialog openDialog = new OpenFileDialog())
        {
            openDialog.Filter = filters ?? "All Files|*.*";
            openDialog.Title = title ?? @"Select file";
            openDialog.FilterIndex = 0;
            openDialog.RestoreDirectory = true;
            if (openDialog.ShowDialog() == DialogResult.OK)
            {
                filePath = openDialog.FileName;
            }
        }
    });
    thread.SetApartmentState(ApartmentState.STA);
    thread.Start();
    thread.Join();

    return filePath;
}

Later you can call that method where it is needed to open a file.

private void CoreWebView2_WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e)
{
   string msg = e.TryGetWebMessageAsString();
   if (msg == "Open Dialog")
   {
     string file = OpenDialogFile();
     doWork(file);
   }
}