Skip to content

Commit 77f4165

Browse files
committed
Add CrashInfoService module service to clrma implementation
1 parent 0f1add1 commit 77f4165

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/SOS/SOS.Extensions/Clrma/ClrmaServiceWrapper.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace SOS.Extensions.Clrma
1313
{
1414
public sealed class ClrmaServiceWrapper : COMCallableIUnknown
1515
{
16+
public const ModuleEnumerationScheme DefaultModuleEnumerationScheme = ModuleEnumerationScheme.EntryPointAndEntryPointDllModule;
1617
public static readonly Guid IID_ICLRMAService = new("1FCF4C14-60C1-44E6-84ED-20506EF3DC60");
1718

1819
public const int E_BOUNDS = unchecked((int)0x8000000B);
@@ -104,7 +105,15 @@ private int GetObjectInspection(
104105
return HResult.E_NOTIMPL;
105106
}
106107

107-
private ICrashInfoService CrashInfoService => _crashInfoService ??= _serviceProvider.GetService<ICrashInfoService>();
108+
private ICrashInfoService CrashInfoService
109+
{
110+
get
111+
{
112+
_crashInfoService ??= _serviceProvider.GetService<ICrashInfoService>(); // Use the default exception-based mechanism for obtaining crash info service
113+
_crashInfoService ??= _serviceProvider.GetService<ICrashInfoModuleService>()?.Create(DefaultModuleEnumerationScheme); // if the above fails, try to create a crash info service from the modules
114+
return _crashInfoService;
115+
}
116+
}
108117

109118
private IThreadService ThreadService => _serviceProvider.GetService<IThreadService>();
110119

0 commit comments

Comments
 (0)