Nullable references, net8.0, blend registry alert dot, netkan fixes #4171
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
References in C#'s default type system can be either an object or null, and if you try to use a null reference as if it was an object, a null reference exception is thrown, which can wreck things for end users. The only way to avoid this is to track in your brain whether every reference can be null, which generally requires checking for null frequently, which is tedious and easy to forget.
C# 8 added the ability to make references non-nullable by default. This means that a variable or function's type can indicate that parameters and return values can't be null, and the compiler can enforce it. References can be made nullable by appending
?
to the type, just like for the already existing nullable types, and the compiler will check the code and emit warnings if such references are used in a way that could cause null reference exceptions.https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references
This feature provides the tools to eliminate null reference exceptions via compile-time checks, which is a tremendous step forward.
Changes
Newtonsoft.Json
)Additional fixes and small features
While working on the above, a few other problems and ideas came up.
download_size
property was updated, not the hashes! This is very strange and suggests the hashes are being cached when they shouldn't be.Now when we detect that a ZIP file is deleted from the cache, we also purge its hashes from both the in-memory and on-disk caches. Hopefully this will make the hashes update properly after a cache purge.
Now this validator is separate and runs at the end after the multi-hosting merge step, so these warnings will go away.