Skip to content

Conversation

@rolfbjarne
Copy link
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
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.

#if NET
if (string.IsNullOrEmpty (minimumOSVersionInManifest)) {
#else
if (string.IsNullOrEmpty (minimumOSVersionInManifest) || minimumOSVersionInManifest is null) {
Copy link

Copilot AI Jan 16, 2026

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.

Suggested change
if (string.IsNullOrEmpty (minimumOSVersionInManifest) || minimumOSVersionInManifest is null) {
if (string.IsNullOrEmpty (minimumOSVersionInManifest)) {

Copilot uses AI. Check for mistakes.
@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2
Copy link
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
Copy link
Collaborator

🔥 [CI Build #2a5fc45] Build failed (Build macOS tests) 🔥

Build failed for the job 'Build macOS tests' (with job status 'Failed')

Pipeline on Agent
Hash: 2a5fc458778357ec5ffd4689e0fdc582542fc4eb [PR build]

@vs-mobiletools-engineering-service2
Copy link
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]

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.

3 participants