Skip to content

Conversation

@angularsen
Copy link
Owner

@angularsen angularsen commented Dec 28, 2022

Inspired by article: https://www.meziantou.net/how-to-use-nullable-reference-types-in-dotnet-standard-2-0-and-dotnet-.htm

Related to #1164

Changes

  • Add NullableAttributes.cs via Directory.Build.props to shim annotation attributes for netstandard2.0 and older .NET versions
  • Fix nullable warnings, observed when multitargeting net7.0 + netstandard2.0
  • Add [NotNullWhen(true)] to all Try methods
  • Remove redundant ! nullable suppressions

Inspired by article: https://www.meziantou.net/how-to-use-nullable-reference-types-in-dotnet-standard-2-0-and-dotnet-.htm

- Add `NullableAttributes.cs` via `Directory.Build.props` to shim annotation attributes for netstandard2.0 and older .NET versions
- Fix nullable annotations (observed when multitargeting net7.0 + netstandard2.0)
- Add `[NotNullWhen(true)]` to all `Try` methods
- Remove redundant `!` nullable suppressions
@angularsen angularsen changed the title ♻️ Fix nullable annotations ✨ Improve nullable annotations for net7.0 multi-targeting Dec 28, 2022
@angularsen angularsen merged commit 48b2e88 into master Dec 28, 2022
@angularsen angularsen deleted the agl/nullable-annotations branch December 28, 2022 15:07
@angularsen
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants