This release addresses issues with the .NET 6.0.300 SDK where the source files are no longer available when running certain builds. The underlying issue is most likely a bug in the .NET SDK itself (see dotnet/sdk#25758) for details), but this package version might find a workaround. Big thanks to https://github.com/gtbuchanan for coming up with and making the fix!
This release adds support for .NET 5's MemberNotNullAttribute
and MemberNotNullWhenAttribute
.
This release fixes the XML documentation from the nullable attributes leaking into the automatically generated XML documentation file of consumers of the package (see issue #8).
Details:
For now, the attribute's XML documentation is wrapped in #if DEBUG
conditionals. This ensures that
the attribute's XML documentation doesn't appear in the documentation file of a release build while
still being available during development (e.g. for IntelliSense in Visual Studio).
This release provides solutions for issue #1 and
issue #6. In addition, potential compiler
warnings in the NullableAttributes.cs
file are now hidden.
Upgrading:
Remove any previously defined NULLABLE_ATTRIBUTES_EXCLUDE_FROM_CODE_COVERAGE
compiler constant,
as it does not have any effect anymore.
ℹ️ Note:
Builds will NOT break if the constant is still defined. It is simply ignored now.
Details:
- The package now supports
packages.config
via acontent/
folder in the NuGet package. - The attributes are now excluded from code coverage by default.
When referenced from projects targeting .NET Standard >= 2.0 or .NET Framework >= 4.0, the
ExcludeFromCodeCoverageAttribute
is used. For other project types, theDebuggerNonUserCodeAttribute
is used. - Added support for the
NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
compiler constant which removes the code coverage attributes. - The
NULLABLE_ATTRIBUTES_EXCLUDE_FROM_CODE_COVERAGE
compiler constant no longer has any effects. Code coverage is now disabled by default. - The
NullableAttributes.cs
file now wraps the attributes with a#pragma warning disable
and#pragma warning restore
block to disable both compiler- and code-analysis warnings.
This release adds the // <auto-generated>
header to the NullableAttributes.cs
file so that
code analyzers like StyleCop ignore the file during the static code analysis.
Thanks to @skarllot for suggesting and making this change!
This release updates the package, so that the attributes file is no longer included in projects targeting a framework >= .NET Standard 2.1. For any target version below, the file is still automatically included. This ensures that the package can easily be installed in libraries which are multi-targeting different frameworks, without them having to define conditional compilation constants.
In addition, a small typo in the XML documentation was fixed.
The initial release.
This release covers the following attributes:
AllowNullAttribute
DisallowNullAttribute
DoesNotReturnAttribute
DoesNotReturnIfAttribute
MaybeNullAttribute
MaybeNullWhenAttribute
NotNullAttribute
NotNullIfNotNullAttribute
NotNullWhenAttribute
Furthermore, the following compiler directives are supported in the source file:
NULLABLE_ATTRIBUTES_DISABLE
NULLABLE_ATTRIBUTES_EXCLUDE_FROM_CODE_COVERAGE