-
Notifications
You must be signed in to change notification settings - Fork 1.4k
C# 8.0 nullable references #4036
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
Comments
The special annotation attributes are only included with NetCoreApp3 and NetStandard21. Other platforms have to do like with JetBrains-attributes (clone as internal classes): #if !NETSTANDARD2_1
namespace System.Diagnostics.CodeAnalysis
{
/// <summary>Specifies that null is allowed as an input even if the corresponding type disallows it.</summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets. See also: https://github.com/dotnet/runtime/blob/master/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/NullableAttributes.cs |
VS2019 build had been fixed and removed out-to-date discussion. Up for grabs again :) |
With help from Nullable-nuget-package, then all platforms can feel the happiness (Ensure |
Alternative package PolySharp is now available, that also enables support for InterpolatedStringHandler |
Interesting challenge is the NLog-attribute If class-reference is required, then it should not be marked as nullable but be assigned initial-value. But when never null, then Unless the initial-dummy-value is a special value that is recognized by the Alternative stop relying on |
Nullable references have now been added to all nuget-package-projects in this repository. Guess the adventure will continue in the other repositories. |
Nullable references makes use of method-attributes to signal if references should have been null-checked first before calling.
The "funny" part is that LangVersion=8.0 is only fully supported for NetCoreApp3. And if targeting NetCoreApp3 then it is enabled by default.
But these features also works out of the box on older platforms:
The text was updated successfully, but these errors were encountered: