Enable nullability and warnings-as-errors globally#25292
Enable nullability and warnings-as-errors globally#25292rolfbjarne wants to merge 14 commits intomainfrom
Conversation
And fix any resulting issues.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #71b9d62] Build passed (Detect API changes) ✅Pipeline on Agent |
|
🔥 Failed to compare API and create generator diff 🔥 Failed to run apidiff Pipeline on Agent |
✅ [PR Build #71b9d62] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #71b9d62] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🔥 [CI Build #71b9d62] Test results 🔥Test results❌ Tests failed on VSTS: test results 2 tests crashed, 5 tests failed, 133 tests passed. Failures❌ dotnettests tests (iOS)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ dotnettests tests (MacCatalyst)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ dotnettests tests (macOS)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ dotnettests tests (tvOS)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (MacCatalyst)🔥 Failed catastrophically on VSTS: test results - monotouch_maccatalyst (no summary found). Html Report (VSDrops) Download ❌ windows tests🔥 Failed catastrophically on VSTS: test results - windows (no summary found). Html Report (VSDrops) Download ❌ xtro tests1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Summary
Enable nullable reference types, treat-warnings-as-errors, and use the latest C# language version globally across the entire repository via
Directory.Build.props.Changes
Global settings (
Directory.Build.props)<Nullable>enable</Nullable>globally.<TreatWarningsAsErrors>true</TreatWarningsAsErrors>globally.<LangVersion>latest</LangVersion>globally (when not already set).Cleanup: remove per-project redundant settings
<Nullable>enable</Nullable>from ~100+.csprojfiles, since it's now set globally.<TreatWarningsAsErrors>and<WarningsAsErrors>settings that are now redundant.<LangVersion>settings that are now covered by the global default.Fix nullability warnings in test code
ProtocolTest.cs,Registrar.cs,RuntimeTest.cs.ResourcesTest.cs.generate-frameworks-constants.cs.🤖 Pull request created by Copilot
With this change, nullability is fully enabled everywhere, so: