-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.MemoryblockingMarks issues that we want to fast track in order to unblock other important workMarks issues that we want to fast track in order to unblock other important work
Milestone
Description
EDIT by @eiriktsarpalis to reflect more recent error modes
In #73448 we've added internal converter for BinaryData but that's not working with JSON source-gen.
Repro
using System.Text.Json.Serialization;
[JsonSerializable(typeof(BinaryData))]
partial class MyContext : JsonSerializerContext { }
Expected behavior:
Compiles and works when you serialize/deserialize
Actual
warning SYSLIB1041: The 'JsonConverterAttribute' type 'System.BinaryDataConverter' specified on member 'System.BinaryData' is not a converter type or does not contain an accessible parameterless constructor.
API Proposal
We should make the constructor of the already included custom converter public:
namespace System;
[JsonConverter(typeof(BinaryDataConverter))]
public partial class BinaryData { }
-internal sealed class BinaryDataConverter : JsonConverter<BinaryData> { }
+namespace System.Text.Json.Serialization;
+
+public sealed class BinaryDataConverter : JsonConverter<BinaryData> { }
adamsitnik
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.MemoryblockingMarks issues that we want to fast track in order to unblock other important workMarks issues that we want to fast track in order to unblock other important work