You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeName.Parse accepts '\0' in a type name, while Type.GetType truncates the name at it #137894
System.Reflection.Metadata.TypeName.Parse accepts U+0000 inside a type name and keeps it in FullName, but Type.GetType and Assembly.GetType resolve only the part before the NUL. So the two APIs disagree about which type a string names.
The same happens on .NET 9 and 11, for generic arguments (List1[[System.Int32\0zz]]) and with an assembly-qualified name (System.Diagnostics.Process\0x, System.Diagnostics.ProcessloadsSystem.Diagnostics.Process`).
The cause appears to be that CoreCLR passes the name to AssemblyNative_GetTypeCore as a NUL-terminated UTF-8 string (RuntimeAssembly.cs, StringMarshalling.Utf8), so everything after the NUL is dropped, while TypeNameParserHelpers.GetFullTypeNameLength treats \0 as an ordinary character.
The assembly-name parser already rejects it (AssemblyNameParser.TryGetNextChar returns false on '\0'), and "System.Int32, System.Private.CoreLib\0x" fails with "The given assembly name was invalid". Rejecting '\0' in GetFullTypeNameLength (or in NeedsEscaping) the same way would make TypeName.Parse fail on input that Type.GetType cannot resolve as written. That would close the gap for code that validates a name with TypeName and then loads it with Type.GetType.
Activity
dotnet-policy-service commentedon Nov 19, 2026
Tagging subscribers to this area: @steveisok, @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Nov 19, 2026
Tagging subscribers to this area: @dotnet/area-system-reflection-metadata
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Nov 19, 2026
Tagging subscribers to this area: @dotnet/area-system-reflection-metadata
See info in area-owners.md if you want to be subscribed.
Reject NUL characters in Metadata TypeName parsing (dotnet#137922)