We should refactor the type name parser used by the reflection stack to be reusable from the compiler. IL Linker already uses that parser, but we don't want another fork - we want a way to compile the exact same file, potentially with ifdefs if needed for both runtime reflection stack and the compiler.
|
// NativeAOT doesn't have a fully capable type name resolver yet |
|
// Once this is implemented don't forget to wire up marking of type forwards which are used in generic parameters |
|
if (!ILCompiler.DependencyAnalysis.ReflectionMethodBodyScanner.ResolveType(typeName, callingModule, diagnosticContext.Origin.MemberDefinition!.Context, out TypeDesc foundType, out ModuleDesc referenceModule)) |
|
{ |
|
type = default; |
|
return false; |
|
} |
Success criteria:
Type? t = Type.GetType("System.Collections.Generic.List`1[[System.DayOfWeek, System.Runtime]], System.Collections");
Console.WriteLine(t != null);
Should print non-null.
We should refactor the type name parser used by the reflection stack to be reusable from the compiler. IL Linker already uses that parser, but we don't want another fork - we want a way to compile the exact same file, potentially with ifdefs if needed for both runtime reflection stack and the compiler.
runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMarker.cs
Lines 75 to 81 in a660c0f
Success criteria:
Should print non-null.