Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThreadsafeTypeKeyHashTable.VolatileWrite missing nullable declaration for value parameter #1752

Open
pikpok-lihhern opened this issue Jan 29, 2024 · 2 comments
Labels

Comments

@pikpok-lihhern
Copy link

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.

@AArnott AArnott added the unity label Jan 29, 2024
@AArnott
Copy link
Collaborator

AArnott commented Jan 29, 2024

Thanks for the report. I suppose this will be solved in our upcoming major release because #1734 will avoid unity having to compile messagepack source code any more.

@pikpok-lihhern
Copy link
Author

Cool. Yes, that sounds great. Also, I'm looking forward to the upcoming roslyn code generator. Getting rid of MPC dependency is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants