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 current APIs require unreferenced code, since they call into JsonSerializer without providing JsonTypeInfo.
#54979 is logged to add "trim compatible" APIs here.
Copy file name to clipboardExpand all lines: src/libraries/System.Memory.Data/ref/System.Memory.Data.cs
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,16 @@ namespace System
9
9
publicpartialclassBinaryData
10
10
{
11
11
publicBinaryData(byte[]data){}
12
+
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("JSON serialization and deserialization might require types that cannot be statically analyzed.")]
Copy file name to clipboardExpand all lines: src/libraries/System.Memory.Data/src/System/BinaryData.cs
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,6 @@
4
4
usingSystem.ComponentModel;
5
5
usingSystem.Diagnostics.CodeAnalysis;
6
6
usingSystem.IO;
7
-
usingSystem.Runtime.InteropServices;
8
7
usingSystem.Text;
9
8
usingSystem.Text.Json;
10
9
usingSystem.Threading;
@@ -17,6 +16,8 @@ namespace System
17
16
/// </summary>
18
17
publicclassBinaryData
19
18
{
19
+
privateconststringJsonSerializerRequiresUnreferencedCode="JSON serialization and deserialization might require types that cannot be statically analyzed.";
20
+
20
21
/// <summary>
21
22
/// The backing store for the <see cref="BinaryData"/> instance.
22
23
/// </summary>
@@ -41,12 +42,12 @@ public BinaryData(byte[] data)
41
42
/// Creates a <see cref="BinaryData"/> instance by serializing the provided object to JSON
42
43
/// using <see cref="JsonSerializer"/>.
43
44
/// </summary>
44
-
///
45
45
/// <param name="jsonSerializable">The object that will be serialized to JSON using
46
46
/// <see cref="JsonSerializer"/>.</param>
47
47
/// <param name="options">The options to use when serializing to JSON.</param>
48
48
/// <param name="type">The type to use when serializing the data. If not specified, <see cref="object.GetType"/> will
0 commit comments