openwhisk-runtime-dotnet icon indicating copy to clipboard operation
openwhisk-runtime-dotnet copied to clipboard

Enhancement - Enable nullable reference types

Open gleono opened this issue 1 year ago • 1 comments

As the runtime continues to evolve, I think it might be a good idea to take advantage of new features of each release of .NET.

One of the features released in C# 8.0 was nullable reference types. NRTs are designed to improve the intent of the C# code by forcing developers to handle all the null references and therefore avoid NullReferenceException crashes.

Practically, this is not needed for the operation of this runtime, because even if the proxy calls code that was compiled with the feature enabled, it still checks the returned object against null. This would also make it easier to avoid null de-referencing while performing bigger refactors in the future.

If main contributors think this is not worth it, I can close this issue and move on, no worries.

gleono avatar Oct 10 '24 21:10 gleono

I thought it would be fun to enable it and deal with all the different warnings to improve how nulls are handled in the code.

I have a branch with my changes to enable this feature in the Minimal and Common projects. I will open a PR, feedback is more than welcome :)

gleono avatar Oct 10 '24 23:10 gleono