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
The SG for the JsonSerializerContext fails to generate if multiple classes specified by the JsonSerializableAttribute have nested classes with the same name.
The project compiles and JsonTypeInfo is generated for all classes.
Actual behavior
The build fails with Argument 2: cannot convert from 'System.Collections.Generic.IReadOnlyList<Test.UpdateTicketRequest.Model>' to 'System.Collections.Generic.IReadOnlyList<Test.CreateTicketRequest.Model>?'
Regression?
I reproduced this in .NET 6 as well as .NET 7 RC1.
Known Workarounds
Rename one of the nested classes.
Configuration
.NET 7.0.100-rc.1.22431.12
macOS 12.5.1 with Apple Silicon
Other information
I found #72671 which might have something to do with this, however my usage and error message is different.
The text was updated successfully, but these errors were encountered:
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.
Issue Details
Description
The SG for the JsonSerializerContext fails to generate if multiple classes specified by the JsonSerializableAttribute have nested classes with the same name.
The project compiles and JsonTypeInfo is generated for all classes.
Actual behavior
The build fails with Argument 2: cannot convert from 'System.Collections.Generic.IReadOnlyList<Test.UpdateTicketRequest.Model>' to 'System.Collections.Generic.IReadOnlyList<Test.CreateTicketRequest.Model>?'
Regression?
I reproduced this in .NET 6 as well as .NET 7 RC1.
Known Workarounds
Rename one of the nested classes.
Configuration
.NET 7.0.100-rc.1.22431.12
macOS 12.5.1 with Apple Silicon
Other information
I found #72671 which might have something to do with this, however my usage and error message is different.
Duplicate of #58198. Per feedback in #58198 (comment) you can use the JsonSerializableAttribute.TypeInfoPropertyName property to resolve any naming conflicts.
Description
The SG for the
JsonSerializerContext
fails to generate if multiple classes specified by theJsonSerializableAttribute
have nested classes with the same name.Reproduction Steps
Expected behavior
The project compiles and
JsonTypeInfo
is generated for all classes.Actual behavior
The build fails with
Argument 2: cannot convert from 'System.Collections.Generic.IReadOnlyList<Test.UpdateTicketRequest.Model>' to 'System.Collections.Generic.IReadOnlyList<Test.CreateTicketRequest.Model>?'
Regression?
I reproduced this in .NET 6 as well as .NET 7 RC1.
Known Workarounds
Rename one of the nested classes.
Configuration
.NET 7.0.100-rc.1.22431.12
macOS 12.5.1 with Apple Silicon
Other information
I found #72671 which might have something to do with this, however my usage and error message is different.
The text was updated successfully, but these errors were encountered: