Skip to content

ThreadsafeTypeKeyHashTable.VolatileWrite missing nullable declaration for value parameter #1752

Description

@pikpok-lihhern

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions