You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mock test builds emit nullable-reference and assertion-style warnings #7828
Building the mock test project emits nullable-reference and assertion-style warnings from existing test sources. These warnings make new diagnostics harder to spot during validation. The tests should express their intended nullability and assertions without those warnings.
The affected sources are present on main at d4c0670f412a07caea6652f810c5c81a4571b339. The warnings were observed when compiling the project for both net10.0 and net11.0 while validating #7820.
Expected and actual
Expected: test assertions and nullable values compile without nullable-reference or assertion-style warnings.
Actual examples:
CS8602 in AsyncTests.cs:428 and :442, and in MockAssertionExtensionsTests.cs:54,78,92,116 when dereferencing an exception returned by Assert.ThrowsAsync.
CS8620 in KitchenSinkConcreteTests.cs:491,497, KitchenSinkAbstractTests.cs:517,523, and RealWorldScenarioTests.cs:574,576 for nullable mock argument matchers.
CS8631 in StringAndTypeMatcherTests.cs:114 for collection element nullability.
TUnitAssertions0005 in existing tests, including PerformanceOptimizationTests.cs:308, and TUnitAssertions0014 in OutRefAssignmentTests.cs:44.
The .NET 11 build log contains 17 CS8602, six CS8620, one CS8631, 91 TUnitAssertions0005, and one TUnitAssertions0014 diagnostics. Some assertions deliberately exercise assertion or verification behavior, so preserve that behavior when correcting them. Intentional interface hiding and type-parameter-shadowing fixtures are outside this request.
Environment
.NET SDK 11.0.100; Windows x64; targets net10.0 and net11.0. Existing analyzer-project and dependency restore warnings are tracked separately in #7410 and #7412.
Please correct these test-source warnings while preserving the tests' intended behavior.
Activity