Skip to content

Drop the null forgiving operator from generated TestContext getter - #1901

Merged
SimonCropp merged 1 commit into
mainfrom
fix-generator-null-forgiving
Aug 29, 2026
Merged

Drop the null forgiving operator from generated TestContext getter#1901
SimonCropp merged 1 commit into
mainfrom
fix-generator-null-forgiving

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

The generated getter used CurrentTestContext.Value!.TestContext. A consuming SDK-style project targeting net462, net472 or net48 defaults to LangVersion 7.3, where ! is CS8370, so UsesVerify.g.cs failed to compile for exactly the target frameworks Verify.MSTest ships. The repo never saw it because ProjectDefaults forces LangVersion=preview.

The generated file carries an header, so nullable warnings are suppressed there regardless.

The generated getter used CurrentTestContext.Value!.TestContext. A consuming
SDK-style project targeting net462, net472 or net48 defaults to LangVersion 7.3,
where ! is CS8370, so UsesVerify.g.cs failed to compile for exactly the target
frameworks Verify.MSTest ships. The repo never saw it because ProjectDefaults
forces LangVersion=preview.

The generated file carries an <auto-generated /> header, so nullable warnings
are suppressed there regardless.
@SimonCropp SimonCropp added this to the 33.0.0 milestone Aug 29, 2026
@SimonCropp
SimonCropp merged commit bca0430 into main Aug 29, 2026
6 of 7 checks passed
@SimonCropp
SimonCropp deleted the fix-generator-null-forgiving branch August 29, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant