-
Notifications
You must be signed in to change notification settings - Fork 554
[msbuild] Add the latest .NET version as a target framework for MSBuild projects #24522
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
base: main
Are you sure you want to change the base?
Conversation
…ld projects This way we actually get nullability warnings from the compiler. And then fix all the nullability warnings.
There was a problem hiding this 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.0and the latest .NET version - Fixed nullability warnings by adding null-forgiving operators (
!) toPath.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.
| #if NET | ||
| if (string.IsNullOrEmpty (minimumOSVersionInManifest)) { | ||
| #else | ||
| if (string.IsNullOrEmpty (minimumOSVersionInManifest) || minimumOSVersionInManifest is null) { |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The #else branch contains a redundant null check. The expression 'string.IsNullOrEmpty (minimumOSVersionInManifest) || minimumOSVersionInManifest is null' is redundant because IsNullOrEmpty already checks for null. The additional 'is null' check is unnecessary.
| if (string.IsNullOrEmpty (minimumOSVersionInManifest) || minimumOSVersionInManifest is null) { | |
| if (string.IsNullOrEmpty (minimumOSVersionInManifest)) { |
✅ [CI Build #2a5fc45] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #2a5fc45] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
🔥 [CI Build #2a5fc45] Build failed (Build macOS tests) 🔥Build failed for the job 'Build macOS tests' (with job status 'Failed') Pipeline on Agent |
🚀 [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 Pipeline on Agent |
This way we actually get nullability warnings from the compiler.
And then fix all the nullability warnings.