diff --git a/src/native/managed/cdacreader/src/Legacy/SOSDacImpl.cs b/src/native/managed/cdacreader/src/Legacy/SOSDacImpl.cs index fbd747b3df172b..7fef6b111de273 100644 --- a/src/native/managed/cdacreader/src/Legacy/SOSDacImpl.cs +++ b/src/native/managed/cdacreader/src/Legacy/SOSDacImpl.cs @@ -32,7 +32,8 @@ internal sealed unsafe partial class SOSDacImpl private readonly Target _target; // When this class is created, the runtime may not have loaded the string and object method tables and set the global pointers. - // They should be set when actually requested via a DAC API, so we lazily read the global pointers. + // This is also the case for the GetUsefulGlobals API, which can be called as part of load notifications before runtime start. + // They should be set when actually requested via other DAC APIs, so we lazily read the global pointers. private readonly Lazy _stringMethodTable; private readonly Lazy _objectMethodTable; @@ -1243,8 +1244,10 @@ int ISOSDacInterface.GetUsefulGlobals(DacpUsefulGlobalsData* data) { data->ArrayMethodTable = _target.ReadPointer( _target.ReadGlobalPointer(Constants.Globals.ObjectArrayMethodTable)); - data->StringMethodTable = _stringMethodTable.Value; - data->ObjectMethodTable = _objectMethodTable.Value; + data->StringMethodTable = _target.ReadPointer( + _target.ReadGlobalPointer(Constants.Globals.StringMethodTable)); + data->ObjectMethodTable = _target.ReadPointer( + _target.ReadGlobalPointer(Constants.Globals.ObjectMethodTable)); data->ExceptionMethodTable = _target.ReadPointer( _target.ReadGlobalPointer(Constants.Globals.ExceptionMethodTable)); data->FreeMethodTable = _target.ReadPointer(