[msbuild/tools] Add netstandard2.0 helper string functions.#25375
[msbuild/tools] Add netstandard2.0 helper string functions.#25375rolfbjarne wants to merge 2 commits into
Conversation
rolfbjarne
commented
May 8, 2026
- Add a 'StringUtils.IsNullOrEmpty' with proper nullability attributes, because the netstandard2.0 version doesn't have it.
- Add a 'string.EndsWith(char)' overload.
* Add a 'StringUtils.IsNullOrEmpty' with proper nullability attributes, because the netstandard2.0 version doesn't have it. * Add a 'string.EndsWith(char)' overload.
There was a problem hiding this comment.
Pull request overview
This PR improves cross-target compatibility for the tooling/MSBuild code by adding small netstandard2.0-friendly string helpers in tools/common, and updating call sites to use them so nullable flow analysis works consistently across target frameworks.
Changes:
- Added
StringUtils.IsNullOrEmptyannotated with[NotNullWhen(false)]to improve nullable flow analysis innetstandard2.0builds. - Added a
string.EndsWith(char)extension method for non-NETbuilds, and simplified a call site to use thecharoverload. - Updated multiple call sites to use
StringUtils.IsNullOrEmptyinstead ofstring.IsNullOrEmpty.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/dotnet-linker/LinkerConfiguration.cs | Uses StringUtils.IsNullOrEmpty for nullable-friendly optimize-flags handling. |
| tools/common/StringUtils.cs | Introduces IsNullOrEmpty helper and a non-NET EndsWith(char) extension; refactors parsing to use the helper. |
| tools/common/StaticRegistrar.cs | Switches nullable checks on single_assembly to StringUtils.IsNullOrEmpty. |
| tools/common/Assembly.cs | Switches nullable/optional metadata checks to StringUtils.IsNullOrEmpty. |
| tools/common/Application.cs | Switches RuntimeIdentifier check to StringUtils.IsNullOrEmpty; adds an early-return guard in ParseRegistrar. |
| msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs | Uses StringUtils.IsNullOrEmpty to make minimumOSVersionInManifest nullable flow consistent across TFMs. |
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.
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.
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.
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.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #4e9bfbe] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #4e9bfbe] Build passed (Build packages) ✅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 |
✅ [PR Build #4e9bfbe] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #4e9bfbe] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 175 tests passed 🎉 Tests counts✅ 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 |