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
Passing a generic type definition in a JsonSerializableAttribute results in invalid C# code being generated, namely type parameters are erroneously treated as named type definitions.
error CS0400: The type or namespace name 'T' could not be found in the global namespace
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
We could either emit an error diagnostic when users specify generic types or we could try supporting them. Note however that generic types would require generating factories instead of properties that current model is using, for example:
Up for grabs. We should check if an input type has open generics and issue a diagnostic error if so. Somewhere in this method would be a good place for such logic, and would involve adding an entry to the _typeLevelDiagnostics cache.
Activity
eiriktsarpalis commentedon Jul 19, 2022
Moving to the .NET 8 milestone.
krwq commentedon Sep 28, 2022
we should improve error message here for 8.0
layomia commentedon Dec 2, 2022
Up for grabs. We should check if an input type has open generics and issue a diagnostic error if so. Somewhere in this method would be a good place for such logic, and would involve adding an entry to the
_typeLevelDiagnosticscache.krwq commentedon Jan 25, 2023
[Triage] We need to add the diagnostics message and possibly consider making that work. Diagnostics messages need design review.