Skip to content

Commit 6d325c4

Browse files
committed
more permissive fix: allow any SystemClass to be represented as ClassWithMembersAndTypes in the payload
1 parent 7069650 commit 6d325c4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/MemberTypeInfo.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ internal static MemberTypeInfo Decode(BinaryReader reader, int count, PayloadOpt
9191
const AllowedRecordTypes SystemClass = Classes | AllowedRecordTypes.SystemClassWithMembersAndTypes
9292
// All primitive types can be stored by using one of the interfaces they implement.
9393
// Example: `new IEnumerable[1] { "hello" }` or `new IComparable[1] { int.MaxValue }`.
94-
| AllowedRecordTypes.BinaryObjectString | AllowedRecordTypes.MemberPrimitiveTyped;
95-
const AllowedRecordTypes NonSystemClass = Classes | AllowedRecordTypes.ClassWithMembersAndTypes;
94+
| AllowedRecordTypes.BinaryObjectString | AllowedRecordTypes.MemberPrimitiveTyped
95+
// System.Nullable<UserStruct> is a special case of SystemClassWithMembersAndTypes
96+
| AllowedRecordTypes.ClassWithMembersAndTypes;
97+
const AllowedRecordTypes NonSystemClass = Classes | AllowedRecordTypes.ClassWithMembersAndTypes;
9698

9799
return binaryType switch
98100
{

0 commit comments

Comments
 (0)