-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Can't use [JsonSerializable] with [Cloneable] source gen #65361
Copy link
Copy link
Closed
Labels
area-System.Text.Jsonbughelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorssource-generatorIndicates an issue with a source generator featureIndicates an issue with a source generator feature
Milestone
Description
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.
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;
}class MyJsonContext
'MyJsonContext' does not implement inherited abstract member 'JsonSerializerContext.GeneratedSerializerOptions.get' [GTCore]csharp(CS0534)
'MyJsonContext' does not implement inherited abstract member 'JsonSerializerContext.GetTypeInfo(Type)' [GTCore]csharp(CS0534)
There is no argument given that corresponds to the required formal parameter 'options' of 'JsonSerializerContext.JsonSerializerContext(JsonSerializerOptions?)' [GTCore]csharp(CS7036)
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.Text.Jsonbughelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorssource-generatorIndicates an issue with a source generator featureIndicates an issue with a source generator feature