public void GenericTypeTest() { using DataTarget dt = TestTargets.Types.LoadFullDump(); using ClrRuntime runtime = dt.ClrVersions.Single().CreateRuntime(); ClrType genericType = runtime.GetModule("sharedlibrary.dll").GetTypeByName("GenericClass<T1, T2, T3, T4, T5>"); ClrGenericParameter[] genericParameters = genericType.EnumerateGenericParameters().ToArray(); Assert.Equal(5, genericParameters.Length); VerifyGenericParameter(genericParameters, 0, "T1"); VerifyGenericParameter(genericParameters, 1, "T2"); VerifyGenericParameter(genericParameters, 2, "T3"); VerifyGenericParameter(genericParameters, 3, "T4"); VerifyGenericParameter(genericParameters, 4, "T5");
private string?ReadData() { if (!_helpers.ReadProperties(ContainingType, Token, out string?name, out _attributes, out SigParser sigParser)) { return(null); } StringCaching options = ContainingType.Heap.Runtime.DataTarget?.CacheOptions.CacheFieldNames ?? StringCaching.Cache; if (name != null) { if (options == StringCaching.Intern) { _name = string.Intern(name); } else if (options == StringCaching.Cache) { _name = name; } } // We may have to try to construct a type from the sigParser if the method table was a bust in the constructor if (_type == null) { if (sigParser.GetCallingConvInfo(out int sigType) && sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD) { sigParser.SkipCustomModifiers(); _type = _helpers.Factory.GetOrCreateTypeFromSignature(ContainingType.Module, sigParser, ContainingType.EnumerateGenericParameters(), Array.Empty <ClrGenericParameter>()); } } return(name); }