kant2002 / WinFormsComInterop

ComWrappers required to run NativeAOT and WinForms
MIT License
228 stars 32 forks source link

Crashes with net6-windows and WinFormsComInterop >= 0.4 #55

Open arcutright opened 1 year ago

arcutright commented 1 year ago

Application works perfectly with WinFormsComInterop 0.3.2, using net6.0-windows as the target and the HIC.System.Windows.Forms.DataVisualization package, which is a small fork from dotnet.

These are from a debug build, no trimming or AOT.

0.4.2: Opens, but hard crash after closing the file picker dialog. The exception code and offset for ntdll are the same every time.

The program has exited with code 3221226356 (0xc0000374).
---
Faulting application name: myprogram.exe, version: 1.2.0.0, time stamp: 0x6387d353
Faulting module name: ntdll.dll, version: 10.0.19041.2130, time stamp: 0xb5ced1c6
Exception code: 0xc0000374
Fault offset: 0x00000000000ff6a9
Faulting process id: 0x86c
Faulting application start time: 0x01d92ae651cffe54
Faulting application path: myprogram.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: 7c249671-d100-4788-9c25-c0f824c6c7fc
Faulting package full name: 
Faulting package-relative application ID: 

0.4.1, 0.4.0: Missing library when trying to open the system file picker dialog

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.WebView2.Core, Version=1.0.1370.28, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'Microsoft.Web.WebView2.Core, Version=1.0.1370.28, Culture=neutral, PublicKeyToken=null'
   at MarshalSupport.GetIUnknownForObject(Object value)
   at WinFormsComInterop.IFileOpenDialogWrapper.primitives::Interop.Shell32.IFileDialog.Advise(IFileDialogEvents pfde, UInt32& pdwCookie)
   at System.Windows.Forms.FileDialog.TryRunDialogVista(IntPtr hWndOwner, Boolean& returnValue)
   at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)
   at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.CommonDialog.ShowDialog()
kant2002 commented 1 year ago

Can you try 0.4.3 release?

arcutright commented 1 year ago

In debug mode for net6-windows and net7-windows: everything seems to work

publish for net6-windows, net7-windows + trimmode=link + self contained: everything seems to work

publish for net7-windows + trimmode=link + aot: It seems functional but often crashes when refreshing a chart, although this config would sometimes crash with 0.3.2 as well. I'm not sure it's worth acknowledging but it seems to crash more often with 0.4.3? To be honest I haven't played around with net7 aot much so perhaps it's due to my other code misbehaving.

kant2002 commented 1 year ago

Okay. I suspect that's really differetn issue. Can you try switch your OutputType to EXE so you will have console. If that does not help to see stack trace, please take a look at this docs https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/docs/debugging.md#visual-studio-specific-notes

arcutright commented 1 year ago

There are quite a few missing interfaces although I'm not sure how to tell which are fatal vs non-fatal access violations. Unfortunately there may be sporadic calls to undocumented kernel32 functions in this debug output, but I tried to only grab sections where it seemed to be related to UI update flows. Let me know if this is helpful or if you have ideas for ways to make it helpful.

Using net7-windows + aot, WinFormsComInterop 0.4.3.

pile of debug output From load until first exception: ``` 'program.exe' (Win32): Loaded '...\bin\publish\net7.0-aot\program.exe'. Symbols loaded. 'program.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\crypt32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\IPHLPAPI.DLL'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\ncrypt.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\secur32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\sspicli.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\ntasn1.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. The thread 0x5c90 has exited with code 0 (0x0). 'program.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\wldp.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.2251_none_91a40448cc8846c1\GdiPlus.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\DWrite.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\TextShaping.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_60b5254171f9507e\comctl32.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. 'program.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll' 'program.exe' (Win32): Loaded 'C:\Windows\System32\oleacc.dll'. onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(1) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(1) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(2) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(3) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(2) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(4) tid(5b08) 80004002 No such interface supported 'program.exe' (Win32): Loaded 'C:\Windows\System32\UIAutomationCore.dll'. 'program.exe' (Win32): Loaded 'C:\Windows\System32\propsys.dll'. onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(5) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(3) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(6) tid(5b08) 80004002 No such interface supported Exception thrown at 0x00007FF7F157198D in program.exe: 0xC0000005: Access violation reading location 0x0000000000000000. ``` Couple of other random ones I picked out: ``` ... mincore\com\oleaut32\dispatch\ups.cpp(2122)\OLEAUT32.dll!00007FFD6E2B9DD6: (caller: 00007FFD6E2B91E9) ReturnHr(1) tid(5b08) 8002801D Library not registered. ``` ``` ... onecore\com\combase\dcomrem\security.cxx(3071)\combase.dll!00007FFD6FF0BABC: (caller: 00007FFD4AF1823E) ReturnHr(7) tid(57a8) 80010117 Call context cannot be accessed after call completed. ``` Other large chunk until an access violation: ``` 'program.exe' (Win32): Loaded 'C:\Windows\System32\Windows.StateRepositoryPS.dll'. onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(8) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(4) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(9) tid(5b08) 80004002 No such interface supported 'program.exe' (Win32): Unloaded 'C:\Windows\System32\xmllite.dll' The thread 0x4dcc has exited with code 0 (0x0). The thread 0x5bc8 has exited with code 0 (0x0). onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(10) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(5) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(11) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(12) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(6) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(13) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(14) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(7) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(15) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(16) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(8) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(17) tid(5b08) 80004002 No such interface supported The thread 0x57a8 has exited with code 0 (0x0). onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(18) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(9) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(19) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(20) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(10) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(21) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(22) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(11) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(23) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(24) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(12) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(25) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(26) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(13) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(27) tid(5b08) 80004002 No such interface supported Exception thrown at 0x00007FF7F157198D in program.exe: 0xC0000005: Access violation reading location 0x0000000000000000. The thread 0x5b38 has exited with code 0 (0x0). Exception thrown at 0x00007FF7F157198D in program.exe: 0xC0000005: Access violation reading location 0x0000000000000000. onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(28) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(14) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(29) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(30) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(15) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(31) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(32) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(16) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(33) tid(5b08) 80004002 No such interface supported The thread 0x57c0 has exited with code 0 (0x0). onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(34) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(17) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(35) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(36) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(18) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(37) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(38) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(19) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(39) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(40) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(20) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(41) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(42) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(21) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(43) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(44) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(22) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(45) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(46) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(23) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(47) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(48) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(24) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(49) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(50) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(25) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(51) tid(5b08) 80004002 No such interface supported Exception thrown at 0x00007FF7F157198D in program.exe: 0xC0000005: Access violation reading location 0x0000000000000000. Exception thrown at 0x00007FF7F157198D in program.exe: 0xC0000005: Access violation reading location 0x0000000000000000. onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(52) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(26) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(53) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(54) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(27) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(55) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(56) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(28) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(57) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(58) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(29) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(59) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(60) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(30) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(61) tid(5b08) 80004002 No such interface supported Exception thrown at 0x00007FF7F157198D in program.exe: 0xC0000005: Access violation reading location 0x0000000000000000. Exception thrown at 0x00007FF7F157198D in program.exe: 0xC0000005: Access violation reading location 0x0000000000000000. onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(62) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(31) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(63) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(64) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(32) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(65) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(66) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(33) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(67) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(68) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(34) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(69) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(70) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(35) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(71) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(72) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(36) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(73) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(74) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(37) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(75) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(76) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(38) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(77) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1284)\combase.dll!00007FFD6FF2E05B: (caller: 00007FFD6FF2D414) ReturnHr(78) tid(5b08) 80004002 No such interface supported Msg:[Failed to marshal with IID={618736E0-3C3D-11CF-810C-00AA00389B71}] onecore\com\combase\dcomrem\marshal.cxx(1179)\combase.dll!00007FFD6FF2D444: (caller: 00007FFD6FF2BFCB) LogHr(39) tid(5b08) 80004002 No such interface supported onecore\com\combase\dcomrem\marshal.cxx(1119)\combase.dll!00007FFD7001065C: (caller: 00007FFD6FF2B8DD) ReturnHr(79) tid(5b08) 80004002 No such interface supported Exception thrown at 0x00007FF7F157198D in program.exe: 0xC0000005: Access violation reading location 0x0000000000000000. ```

The final debug trace block in the above spoiler box was taken while broken with this callstack on an access violation:

program.exe!WinFormsComInterop_WinFormsComInterop_PrimitivesIRawElementProviderSimpleProxy__get_ProviderOptions()  Unknown
UIAutomationCore.dll!00007ffd3fc6fa9a() Unknown
program.exe!System_Windows_Forms_Primitives_Interop_UiaCore__UiaRaiseAutomationPropertyChangedEvent()  Unknown
program.exe!System_Windows_Forms_System_Windows_Forms_AccessibleObject__RaiseAutomationPropertyChangedEvent()  Unknown
program.exe!System_Windows_Forms_System_Windows_Forms_Button__OnClick()    Unknown
program.exe!System_Windows_Forms_System_Windows_Forms_Button__OnMouseUp()  Unknown
program.exe!System_Windows_Forms_System_Windows_Forms_Control__WmMouseUp() Unknown
program.exe!System_Windows_Forms_System_Windows_Forms_Control__WndProc()   Unknown
program.exe!System_Windows_Forms_System_Windows_Forms_ButtonBase__WndProc()    Unknown
program.exe!System_Windows_Forms_System_Windows_Forms_NativeWindow__Callback() Unknown
program.exe!Internal_CompilerGenerated__Module___<ReverseDelegateStub>System_Windows_Forms_Primitives_Interop_User32_WNDPROC() Unknown
user32.dll!00007ffd6e56e7e8()   Unknown
user32.dll!00007ffd6e56e229()   Unknown
program.exe!System_Windows_Forms_Primitives_Interop_User32__DispatchMessageW() Unknown
program.exe!System_Windows_Forms_System_Windows_Forms_Application_ComponentManager__Interop_Mso_IMsoComponentManager_FPushMessageLoop()    Unknown
program.exe!System_Windows_Forms_System_Windows_Forms_Application_ThreadContext__RunMessageLoopInner() Unknown
program.exe!System_Windows_Forms_System_Windows_Forms_Application_ThreadContext__RunMessageLoop()  Unknown
kant2002 commented 1 year ago

Would be great if you follow https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/docs/debugging.md#visual-studio-specific-notes and stop at first exeption, and show stack trace. Also, if you can give a link to repo with repro I would appreciate it.