-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use [JsonSerializable] with [Cloneable] source gen #65361
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json Issue DetailsDescriptionI'm using another source generator for marking classes as Cloneable. But when I annotate my class with this I get the following (unhelpful) errors for my JsonSerializerContext class. using System.Text.Json.Serialization;
using Cloneable;
[JsonSerializable(typeof(jTest))]
internal partial class MyJsonContext : JsonSerializerContext
{
}
[Cloneable]
public partial class jTest
{
[JsonPropertyName("xxx")]
public string pTest { get; set; } = "blah";
[JsonIgnore]
public static string StoreExt => ".act.json";
public bool IsNotStarted => false;
}
Are these generators conflicting somehow, is there a way around this so I can use both? I'm wanting to use this on Wear OS net6.0-android as default serialization/deserialization is very slow. I guess if I could get some speed using JsonSerializerContext I could use it for cloning, but the issue still exists. Any advice appreciated. Reproduction StepsAs above Expected behaviordon't know, merging of source gen results? Actual behavioras above Regression?No response Known Workaroundsnone Configurationtests above on net6.0 console app. Other informationNo response
|
Might be a dup of #62937. |
Moving to the .NET 8 milestone. |
Source generator throwing the following error:
Need to debug the source generator to root cause the underlying issue. |
Can confirm this has been fixed by #87383 |
Description
I'm using another source generator for marking classes as Cloneable. But when I annotate my class with this I get the following (unhelpful) errors for my JsonSerializerContext class.
Are these generators conflicting somehow, is there a way around this so I can use both?
I'm wanting to use this on Wear OS net6.0-android as default serialization/deserialization is very slow. I guess if I could get some speed using JsonSerializerContext I could use it for cloning, but the issue still exists.
Any advice appreciated.
Reproduction Steps
As above
Expected behavior
don't know, merging of source gen results?
Actual behavior
as above
Regression?
No response
Known Workarounds
none
Configuration
tests above on net6.0 console app.
Other information
No response
The text was updated successfully, but these errors were encountered: