Skip to content

[msbuild] Add the latest .NET version as a target framework for MSBuild projects#24522

Merged
rolfbjarne merged 1 commit intomainfrom
dev/rolf/msbuild-nullable
Jan 22, 2026
Merged

[msbuild] Add the latest .NET version as a target framework for MSBuild projects#24522
rolfbjarne merged 1 commit intomainfrom
dev/rolf/msbuild-nullable

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

This way we actually get nullability warnings from the compiler.

And then fix all the nullability warnings.

…ld projects

This way we actually get nullability warnings from the compiler.

And then fix all the nullability warnings.
@rolfbjarne rolfbjarne requested a review from Copilot January 16, 2026 15:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the latest .NET version as an additional target framework for MSBuild projects to enable nullability warnings from the compiler. The changes include fixing numerous nullability warnings throughout the codebase by adding null-forgiving operators and null-coalescing patterns where appropriate.

Changes:

  • Updated project files to multi-target both netstandard2.0 and the latest .NET version
  • Fixed nullability warnings by adding null-forgiving operators (!) to Path.GetDirectoryName() calls
  • Added null-conditional operators and null-coalescing patterns to handle potential null references
  • Updated external dependency reference

Reviewed changes

Copilot reviewed 61 out of 61 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Tasks.Windows.csproj Changed from single target framework to multi-targeting
msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj Changed from single target framework to multi-targeting
msbuild/Xamarin.Localization.MSBuild/Xamarin.Localization.MSBuild.csproj Changed from single target framework to multi-targeting
tools/common/FileUtils.cs Added null-forgiving operator to Path.GetDirectoryName()
msbuild/Xamarin.MacDev.Tasks/Tasks/*.cs Fixed nullability warnings across multiple task files with null-forgiving operators and null-conditional patterns
msbuild/Xamarin.MacDev.Tasks/StringParserService.cs Simplified variable declaration using pattern matching
msbuild/Xamarin.MacDev.Tasks/Extensions/ITaskItemExtensions.cs Added null-forgiving operator for dictionary value cast
external/Xamarin.MacDev Updated submodule commit reference
Comments suppressed due to low confidence (2)

msbuild/Xamarin.MacDev.Tasks/Tasks/SmartCopy.cs:1

  • The struct name changed from 'timespec' to 'Timespec', but this deviates from the standard POSIX naming convention for the timespec structure. If this struct represents the POSIX timespec type, it should retain the lowercase 'timespec' name for clarity and consistency with the native API it represents.
    msbuild/Xamarin.MacDev.Tasks/Tasks/Zip.cs:1
  • Two separate comments have been merged onto the same line without proper separation. These should be on separate lines or combined into a single coherent comment.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #2a5fc45] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #2a5fc45] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #2a5fc45] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #2a5fc45] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #2a5fc45] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #2a5fc45] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #2a5fc45] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #2a5fc45] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🚀 [CI Build #2a5fc45] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 121 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 9 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@rolfbjarne rolfbjarne merged commit 5f15d7f into main Jan 22, 2026
49 of 51 checks passed
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.

5 participants