-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
📌 seQUESTeredIdentifies that an issue has been imported into Quest.Identifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking changeIndicates a .NET Core breaking change
Description
Description
Starting in .NET 10 Preview 3, Type.MakeGenericSignatureType API validates that the genericTypeDefinition argument is in fact a generic type definition.
Version
.NET 10 Preview 3
Previous behavior
Type.MakeGenericSignatureType accepted any type for the genericTypeDefinition argument.
New behavior
Type.MakeGenericSignatureType requires genericTypeDefinition argument to be a generic type definition and throws ArgumentException otherwise.
Type of breaking change
- Behavioral change: Existing binaries might behave differently at runtime.
Reason for change
The type created by Type.MakeGenericSignatureType had non-sensical behavior when the genericTypeDefinition argument was not a generic type definition.
Recommended action
Avoid calling Type.MakeGenericSignatureType for types that are not generic type definitions. For example:
// Before
Type instantiatedType = Type.MakeGenericSignatureType(originalType, instantiation);
// After
Type instantiatedType = originalType.IsGenericTypeDefinition ? Type.MakeGenericSignatureType(originalType, instantiation) : originalType;Affected APIs
System.Type.MakeGenericSignatureType
Copilot
Metadata
Metadata
Labels
📌 seQUESTeredIdentifies that an issue has been imported into Quest.Identifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking changeIndicates a .NET Core breaking change