Skip to content

SOS DumpHeap -stat has unhelpful error message "Unable to create a ClrHeap for this runtime" #5717

@noahfalk

Description

@noahfalk

Description

When a developer runs the command !DumpHeap -stat they might see the error "Unable to create a ClrHeap for this runtime". This error is an implementation detail of CLRMD and doesn't provide actionable information to the user about what is wrong. Most likely the issue is that the dump is missing memory backing GC heap data structures and telling the user that would encourage them to investigate how the dump was generated initially.

Configuration

This was observed with coreclr 8.0.1024.46610 Windows Amd64 single-file app

Regression?

Unknown

Other information

Example failure callstack:

0:000> !dumpheap -stat
Information: 0 : Creating ClrRuntime #0 c:\data\symbols\symcache\mscordaccore.dll/66E8B8C2149000/mscordaccore.dll
Error: 0 : System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.NotSupportedException: Unable to create a ClrHeap for this runtime.
   at Microsoft.Diagnostics.Runtime.ClrRuntime.get_Heap()
   at Microsoft.Diagnostics.ExtensionCommands.DumpHeapCommand.ParseArguments()
   at Microsoft.Diagnostics.ExtensionCommands.DumpHeapCommand.Invoke()
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Microsoft.Diagnostics.DebugServices.Implementation.Utilities.Invoke(MethodBase method, Object instance, IServiceProvider provider)
Error: 0 : System.NotSupportedException: Unable to create a ClrHeap for this runtime.
   at Microsoft.Diagnostics.DebugServices.Implementation.Utilities.Invoke(MethodBase method, Object instance, IServiceProvider provider)
   at Microsoft.Diagnostics.DebugServices.Implementation.CommandService.CommandHandler.Invoke(MethodInfo methodInfo, ParseResult context, Command parser, IServiceProvider services)
   at Microsoft.Diagnostics.DebugServices.Implementation.CommandService.CommandHandler.Invoke(ParseResult context, IServiceProvider services)
   at Microsoft.Diagnostics.DebugServices.Implementation.CommandService.CommandGroup.Execute(IReadOnlyList`1 commandLine, IServiceProvider services)
   at Microsoft.Diagnostics.DebugServices.Implementation.CommandService.Execute(String commandName, String[] commandLineArray, IServiceProvider services)
   at Microsoft.Diagnostics.DebugServices.Implementation.CommandService.Execute(String commandName, String commandArguments, IServiceProvider services)
   at SOS.Extensions.HostServices.DispatchCommand(IntPtr self, String commandName, String commandArguments, Boolean displayCommandNotFound)
Unable to create a ClrHeap for this runtime.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions