Skip to content

[.NET 6 Preview 5] dnSpy stopped working while decompiling assembly #53014

@Junjun-zhao

Description

@Junjun-zhao

Application Name: dnSpy
OS: Windows 10 RS5
CPU: X64
.NET Build Number: 6.0.100-preview.5.21269.9

Verify Scenarios:

  1. Windows 10 RS5 X64 + dotnet-sdk-5.0.204-win-x64 PASS
  2. Windows 10 RS5 X64 + dotnet-sdk-6.0.100-preview.5.21266.3 PASS
  3. Windows 10 RS5 X64 + 6.0.100-preview.5.21269.9: Fail
  4. Windows 10 RS5 X64 + 6.0.100-preview.5.21273.2: Fail

Source Code, App & CrashDump : check at https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1331331

Repro steps:

  1. Copy App to machine
  2. Run dnSpy.exe
  3. Drag any .net assembly to Assembly Explorer( or use Ctrl+O, select any managed dll)
  4. Choose the assembly in Assembly Explorer, on the right side, right click and select Edit Assembly Attributes (C#) item)

Expected Result:
It should decompile the assembly

Actual Result:
App has stopped working window displayed

Findings :
This app is targeting .net5 by default, this issue occurs when we run against net6, it is not repro when we use .net5 runtime.
When we observe call stack, it looks exception occurs in ProfileOptimization.StartProfile method, when it calls coreclr!GetCLRRuntimeHost
ProfileOptimization.StartProfile(String) Method (System.Runtime) | Microsoft Docs

Child-SP RetAddr Call Site

00 00000036`e657c4d0 00007ffb`91fe86a4 coreclr!GetCLRRuntimeHost+0x8b774
01 00000036`e657c680 00007ffb`91fe7da3 coreclr!GetCLRRuntimeHost+0x8bcf4
02 00000036`e657c6e0 00007ffb`91f3841d coreclr!GetCLRRuntimeHost+0x8b3f3
03 00000036`e657c710 00007ffb`91fe763c coreclr!coreclr_shutdown_2+0x99b2d
04 00000036`e657c7b0 00007ffb`91fe6a9b coreclr!GetCLRRuntimeHost+0x8ac8c
*** WARNING: Unable to verify checksum for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.6.21269.1\System.Private.CoreLib.dll
*** ERROR: Module load completed but symbols could not be loaded for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.6.21269.1\System.Private.CoreLib.dll
05 00000036`e657c810 00007ffb`7eb4438c coreclr!GetCLRRuntimeHost+0x8a0eb
06 00000036`e657c860 00007ffb`7eb41042 System.Runtime.Loader.AssemblyLoadContext.InternalStartProfile(System.String, IntPtr)+0x5c
07 00000036`e657c940 00007ffb`332e557a System_Private_CoreLib!System.Runtime.ProfileOptimization.StartProfile(System.String)+0x22
08 00000036`e657c970 00007ffb`35d6c91e dnSpy_Contracts_DnSpy!dnSpy.Contracts.Utilities.ProfileOptimizationHelper.StartProfile(System.String)+0xfa*** ERROR: Module load completed but symbols could not be loaded for C:\Users\valtunc\Desktop\dnSpy\bin\dnSpy.Contracts.DnSpy.dll
****
09 00000036`e657c9d0 00007ffb`35da491e dnSpy_AsmEditor_x!dnSpy.AsmEditor.Compiler.EditCodeVM+<StartDecompileAsync>d__79.MoveNext()+0x1fe*** ERROR: Module load completed but symbols could not be loaded for C:\Users\valtunc\Desktop\dnSpy\bin\dnSpy.AsmEditor.x.dll

0a 00000036`e657cbc0 00007ffb`358fca67 System_Private_CoreLib!System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib],[Microsoft.VisualStudio.Composition.CachedComposition+<LoadExportProviderFactoryAsync>d__4, Microsoft.VisualStudio.Composition]].ExecutionContextCallback(System.Object)+0x3263f2e
0b 00000036`e657cc00 00007ffb`35da47e9 System_Private_CoreLib!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0xffffffff`b6e03697
0c 00000036`e657cc70 00007ffb`35da46e9 System_Private_CoreLib!System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib],[Microsoft.VisualStudio.Composition.CachedComposition+<LoadExportProviderFactoryAsync>d__4, Microsoft.VisualStudio.Composition]].MoveNext(System.Threading.Thread)+0x3264089
0d 00000036`e657ccd0 00007ffb`7eb130e4 System_Private_CoreLib!System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon, System.Private.CoreLib],[Microsoft.VisualStudio.Composition.CachedComposition+<LoadExportProviderFactoryAsync>d__4, Microsoft.VisualStudio.Composition]].MoveNext()+0x3263fc9
0e 00000036`e657cd00 00007ffb`358e5ffe System_Private_CoreLib!System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation+<>c.<.cctor>b__8_0(System.Object)+0x14
0f 00000036`e657cd30 00007ffb`358e5e01 WindowsBase!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)+0xffffffff`a20f2fde*** WARNING: Unable to verify checksum for C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.0-preview.6.21268.12\WindowsBase.dll
*** ERROR: Module load completed but symbols could not be loaded for C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.0-preview.6.21268.12\WindowsBase.dll

10 00000036`e657cd90 00007ffb`35905bd9 WindowsBase!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)+0xffffffff`a20f2eb1
11 00000036`e657cde0 00007ffb`35905a26 WindowsBase!System.Windows.Threading.DispatcherOperation.InvokeImpl()+0xffffffff`a210bfb9
12 00000036`e657ce50 00007ffb`358fca67 WindowsBase!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)+0xffffffff`a2170256
13 00000036`e657ce90 00007ffb`359058f6 System_Private_CoreLib!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0xffffffff`b6e03697
14 00000036`e657cf00 00007ffb`359056de WindowsBase!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)+0xffffffff`a2170296
15 00000036`e657cf50 00007ffb`359054af WindowsBase!System.Windows.Threading.DispatcherOperation.Invoke()+0xffffffff`a210bcbe
16 00000036`e657cfb0 00007ffb`3590506b WindowsBase!System.Windows.Threading.Dispatcher.ProcessQueue()+0xffffffff`a210ed9f
17 00000036`e657d050 00007ffb`358f0f1a WindowsBase!System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)+0xffffffff`a210e25b
18 00000036`e657d0c0 00007ffb`358f0e36 WindowsBase!MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)+0xffffffff`a216aeda
19 00000036`e657d150 00007ffb`358e5fce WindowsBase!MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)+0xffffffff`a216bc46
1a 00000036`e657d1a0 00007ffb`358e5e01 WindowsBase!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)+0xffffffff`a20f2fae
1b 00000036`e657d200 00007ffb`358f0ad4 WindowsBase!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)+0xffffffff`a20f2eb1
1c 00000036`e657d250 00007ffb`358f07b4 WindowsBase!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)+0xffffffff`a20fb744
1d 00000036`e657d2f0 00007ffb`3232c1d0 WindowsBase!MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)+0xffffffff`a216b9b4
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\System32\USER32.dll - 
1e 00000036`e657d3f0 00007ffb`b87474d6 DirectWriteForwarder!ILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)+0x60*** WARNING: Unable to verify checksum for C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.0-preview.6.21268.12\DirectWriteForwarder.dll
*** ERROR: Module load completed but symbols could not be loaded for C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.0-preview.6.21268.12\DirectWriteForwarder.dll

1f 00000036`e657d470 00007ffb`b8746ff2 USER32!DispatchMessageW+0x6a6
20 00000036`e657d5f0 00007ffb`32d0a9bb USER32!DispatchMessageW+0x1c2
21 00000036`e657d670 00007ffb`937f6b5f DirectWriteForwarder!ILStubClass.IL_STUB_PInvoke(System.Windows.Interop.MSG ByRef)+0x7b
22 00000036`e657d730 00007ffb`937f40b1 WindowsBase!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)+0xbf
*** WARNING: Unable to verify checksum for C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.0-preview.6.21268.12\PresentationFramework.dll
*** ERROR: Module load completed but symbols could not be loaded for C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\6.0.0-preview.6.21268.12\PresentationFramework.dll
23 00000036`e657d7c0 00007ffb`7e142c4a WindowsBase!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)+0x41
24 00000036`e657d7f0 00007ffb`7e139299 PresentationFramework!System.Windows.Window.ShowHelper(System.Object)+0x2aa
25 00000036`e657d8b0 00007ffb`7e1396c2 PresentationFramework!System.Windows.Window.Show()+0x49
26 00000036`e657d8e0 00007ffb`35d69b79 PresentationFramework!System.Windows.Window.ShowDialog()+0x272
27 00000036`e657d9a0 00007ffb`35d694a3 dnSpy_AsmEditor_x!dnSpy.AsmEditor.Compiler.EditAssemblyCommand.Execute(dnSpy.AsmEditor.Compiler.EditCodeVMCreator, System.Lazy`1<dnSpy.AsmEditor.Compiler.IAddUpdatedNodesHelperProvider>, System.Lazy`1<dnSpy.AsmEditor.UndoRedo.IUndoCommandService>, dnSpy.AsmEditor.Commands.IAppService, dnSpy.Contracts.Documents.TreeView.DocumentTreeNodeData[])+0x3f9
28 00000036`e657db00 00007ffb`35d693f6 dnSpy_AsmEditor_x!dnSpy.AsmEditor.Compiler.EditAssemblyCommand+CodeCommand.Execute(dnSpy.AsmEditor.Commands.CodeContext)+0x83
29 00000036`e657db60 00007ffb`35d69362 dnSpy_Contracts_DnSpy!dnSpy.Contracts.Menus.MenuItemBase`1[[System.__Canon, System.Private.CoreLib]].dnSpy.Contracts.Menus.IMenuItem.Execute(dnSpy.Contracts.Menus.IMenuItemContext)+0x46
2a 00000036`e657dba0 00007ffb`35d692b7 dnSpy!dnSpy.Menus.MenuService+<>c__DisplayClass15_0.<Create>b__1(System.Object)+0x82*** ERROR: Module load completed but symbols could not be loaded for C:\Users\valtunc\Desktop\dnSpy\bin\dnSpy.dll

2b 00000036`e657dc00 00007ffb`7e0ac191 dnSpy_Contracts_DnSpy!dnSpy.Contracts.MVVM.RelayCommand.System.Windows.Input.ICommand.Execute(System.Object)+0x37
2c 00000036`e657dc40 00007ffb`7e42f457 PresentationFramework!MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource, Boolean)+0xe1
2d 00000036`e657dca0 00007ffb`358e5fce PresentationFramework!System.Windows.Controls.MenuItem.InvokeClickAfterRender(System.Object)+0x67
2e 00000036`e657dce0 00007ffb`358e5e01 WindowsBase!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)+0xffffffff`a20f2fae
2f 00000036`e657dd40 00007ffb`35905bd9 WindowsBase!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)+0xffffffff`a20f2eb1
30 00000036`e657dd90 00007ffb`35905a26 WindowsBase!System.Windows.Threading.DispatcherOperation.InvokeImpl()+0xffffffff`a210bfb9
31 00000036`e657de00 00007ffb`358fca67 WindowsBase!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)+0xffffffff`a2170256
32 00000036`e657de40 00007ffb`359058f6 System_Private_CoreLib!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0xffffffff`b6e03697
33 00000036`e657deb0 00007ffb`359056de WindowsBase!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)+0xffffffff`a2170296
34 00000036`e657df00 00007ffb`359054af WindowsBase!System.Windows.Threading.DispatcherOperation.Invoke()+0xffffffff`a210bcbe
35 00000036`e657df60 00007ffb`3590506b WindowsBase!System.Windows.Threading.Dispatcher.ProcessQueue()+0xffffffff`a210ed9f
36 00000036`e657e000 00007ffb`358f0f1a WindowsBase!System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)+0xffffffff`a210e25b
37 00000036`e657e070 00007ffb`358f0e36 WindowsBase!MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)+0xffffffff`a216aeda
38 00000036`e657e100 00007ffb`358e5fce WindowsBase!MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)+0xffffffff`a216bc46
39 00000036`e657e150 00007ffb`358e5e01 WindowsBase!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)+0xffffffff`a20f2fae
3a 00000036`e657e1b0 00007ffb`358f0ad4 WindowsBase!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)+0xffffffff`a20f2eb1
3b 00000036`e657e200 00007ffb`358f07b4 WindowsBase!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)+0xffffffff`a20fb744
3c 00000036`e657e2a0 00007ffb`3232c1d0 WindowsBase!MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)+0xffffffff`a216b9b4
3d 00000036`e657e3a0 00007ffb`b87474d6 DirectWriteForwarder!ILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)+0x60
3e 00000036`e657e420 00007ffb`b8746ff2 USER32!DispatchMessageW+0x6a6
3f 00000036`e657e5a0 00007ffb`32d0a9bb USER32!DispatchMessageW+0x1c2
40 00000036`e657e620 00007ffb`937f6b5f DirectWriteForwarder!ILStubClass.IL_STUB_PInvoke(System.Windows.Interop.MSG ByRef)+0x7b
41 00000036`e657e6e0 00007ffb`937f40b1 WindowsBase!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)+0xbf
42 00000036`e657e770 00007ffb`937f405e WindowsBase!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)+0x41
43 00000036`e657e7a0 00007ffb`7e0de45c WindowsBase!System.Windows.Threading.Dispatcher.Run()+0x3e
44 00000036`e657e7d0 00007ffb`7e0dcb0f PresentationFramework!System.Windows.Application.RunDispatcher(System.Object)+0x1c
45 00000036`e657e800 00007ffb`7e0d9b3c PresentationFramework!System.Windows.Application.RunInternal(System.Windows.Window)+0x14f
46 00000036`e657e850 00007ffb`3231e46d PresentationFramework!System.Windows.Application.Run()+0x2c
47 00000036`e657e880 00007ffb`91eaced3 dnSpy!dnSpy.MainApp.StartUpClass.Main()+0xdd
48 00000036`e657e8e0 00007ffb`91dcffda coreclr!coreclr_shutdown_2+0xe5e3
49 00000036`e657e920 00007ffb`91e2099b coreclr+0x5ffda
4a 00000036`e657ea60 00007ffb`91e20766 coreclr!MetaDataGetDispenser+0x2b19b
4b 00000036`e657eb90 00007ffb`91e204bd coreclr!MetaDataGetDispenser+0x2af66
4c 00000036`e657ec40 00007ffb`91e99c06 coreclr!MetaDataGetDispenser+0x2acbd
4d 00000036`e657efd0 00007ffb`91e796b2 coreclr!coreclr_execute_assembly+0x20636
*** WARNING: Unable to verify checksum for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.6.21269.1\hostpolicy.dll
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.6.21269.1\hostpolicy.dll - 
4e 00000036`e657f140 00007ffb`9c3d94af coreclr!coreclr_execute_assembly+0xe2
4f 00000036`e657f1e0 00007ffb`9c3d97dc hostpolicy+0x194af
50 00000036`e657f380 00007ffb`9c3da178 hostpolicy+0x197dc
*** WARNING: Unable to verify checksum for C:\Program Files\dotnet\host\fxr\6.0.0-preview.6.21269.1\hostfxr.dll
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\dotnet\host\fxr\6.0.0-preview.6.21269.1\hostfxr.dll - 
51 00000036`e657f3c0 00007ffb`9c4bbf58 hostpolicy!corehost_main+0x108
52 00000036`e657f570 00007ffb`9c4bec97 hostfxr!hostfxr_close+0xfb8
53 00000036`e657f670 00007ffb`9c4c0fc2 hostfxr!hostfxr_close+0x3cf7
54 00000036`e657f770 00007ffb`9c4bf2ed hostfxr!hostfxr_close+0x6022
55 00000036`e657f810 00007ffb`9c4b8ceb hostfxr!hostfxr_close+0x434d
*** WARNING: Unable to verify checksum for apphost.exe
*** ERROR: Module load completed but symbols could not be loaded for apphost.exe
56 00000036`e657f950 00007ff6`320ae090 hostfxr!hostfxr_main_startupinfo+0xab
57 00000036`e657fa50 00007ff6`320ae3f8 apphost+0xe090
58 00000036`e657fc30 00007ff6`320afee8 apphost+0xe3f8
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\System32\KERNEL32.DLL - 
59 00000036`e657fda0 00007ffb`b9427974 apphost+0xfee8
5a 00000036`e657fde0 00007ffb`b9aaa2f1 KERNEL32!BaseThreadInitThunk+0x14
5b 00000036`e657fe10 00000000`00000000 ntdll!RtlUserThreadStart+0x21

@dotnet-actwx-bot @dotnet/compat

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions