diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/ReadyToRunSignature.cs b/src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/ReadyToRunSignature.cs
index e977f304fd11d..b1425ba7637c3 100644
--- a/src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/ReadyToRunSignature.cs
+++ b/src/coreclr/src/tools/crossgen2/ILCompiler.Reflection.ReadyToRun/ReadyToRunSignature.cs
@@ -407,6 +407,23 @@ private SignatureDecoder(IAssemblyResolver options, MetadataReader metadataReade
_contextReader = contextReader;
}
+ ///
+ /// Construct the signature decoder by storing the image byte array and offset within the array.
+ /// This variant uses the outer global metadata reader
+ ///
+ /// Dump options and paths
+ /// Signature to parse
+ /// Signature offset within the signature byte array
+ /// Top-level signature context reader
+ private SignatureDecoder(IAssemblyResolver options, byte[] signature, int offset, ReadyToRunReader contextReader)
+ {
+ _metadataReader = contextReader.GetGlobalMetadataReader();
+ _options = options;
+ _image = signature;
+ _offset = offset;
+ _contextReader = contextReader;
+ }
+
///
/// Read a single byte from the signature stream and advances the current offset.
///
@@ -996,7 +1013,9 @@ private void ParseType(StringBuilder builder)
break;
case CorElementType.ELEMENT_TYPE_GENERICINST:
- ParseGenericTypeInstance(builder);
+ SignatureDecoder outerTypeDecoder = new SignatureDecoder(_options, _image, _offset, _contextReader);
+ outerTypeDecoder.ParseGenericTypeInstance(builder);
+ _offset = outerTypeDecoder._offset;
break;
case CorElementType.ELEMENT_TYPE_TYPEDBYREF: