Skip to content
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

✨ Improve nullable annotations for net7.0 multi-targeting #1175

Merged
merged 1 commit into from
Dec 28, 2022

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.

1 participant