docs icon indicating copy to clipboard operation
docs copied to clipboard

[Breaking change]: Type.GetType throws TypeLoadException

Open jkotas opened this issue 1 year ago • 1 comments

Old behavior

Type.GetType(string) throws TypeLoadException for most types with invalid element type, except a few corner cases such as byref-of-byref.

New behavior

Type.GetType throws TypeLoadException for all types with invalid element type, including byref-of-byref.

Example

  • Type.GetType("System.Object&&") - returns null in .NET 7, throws TypeLoadException in .NET 8
  • Type.GetType("System.TypedReference[]") - throws TypeLoadException in all .NET versions

Introduced by https://github.com/dotnet/runtime/pull/83484.

jkotas avatar Feb 20 '24 04:02 jkotas

More context: https://github.com/dotnet/runtime/issues/98426

jkotas avatar Feb 20 '24 04:02 jkotas