When trying to build MessagePack within Unity, I noticed that the latest release (2.5.140) did not enable nullable reference type via the csc.rsp file. So I manually added them to get rid of the noisy warnings only to get a warning:
ThreadsafeTypeKeyHashTable.cs(214,9): warning CS8824: Parameter 'location' must have a non-null value when exiting because parameter 'value' is non-null.
The problem:
private static void VolatileWrite([NotNullIfNotNull("value")] ref Entry? location, Entry value)
Entry value is not nullable.
The fix is:
private static void VolatileWrite([NotNullIfNotNull("value")] ref Entry? location, Entry? value)
Flag it nullable: Entry? value.
P.S. Perhaps for future release, it would also be good to include the csc.rcp file alongside all asmdef files to enable nullable reference type.
When trying to build MessagePack within Unity, I noticed that the latest release (2.5.140) did not enable nullable reference type via the
csc.rspfile. So I manually added them to get rid of the noisy warnings only to get a warning:The problem:
private static void VolatileWrite([NotNullIfNotNull("value")] ref Entry? location, Entry value)Entry valueis not nullable.The fix is:
private static void VolatileWrite([NotNullIfNotNull("value")] ref Entry? location, Entry? value)Flag it nullable:
Entry? value.