Skip to content

[CA1310] Specify StringComparison in SdkManager.Licenses.cs - #12346

Merged
jonathanpeppers merged 1 commit into
dotnet:mainfrom
mauroa:dev/maagno/3012463
Aug 11, 2026
Merged

jonathanpeppers merged 1 commit into
dotnet:mainfrom
mauroa:dev/maagno/3012463

Conversation

@mauroa

@mauroa mauroa commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Fixes CA1310 (Specify StringComparison for correctness) flagged by DevDiv work item 3012463 ([roslynanalyzers:Warning]).

Change

In SdkManager.Licenses.cs, ParseLicenseOutput matched a license-header line with line.TrimEnd().EndsWith(":") without an explicit StringComparison. This adds StringComparison.Ordinal (a delimiter/token match, so ordinal is correct and culture-invariant). No behavioral change.

Originally scoped against the archived dotnet/android-tools; retargeted here since that source now lives in dotnet/android.

Fixes CA1310 ('Specify StringComparison for correctness') flagged by
DevDiv work item 3012463. The line.TrimEnd().EndsWith(":") call in
ParseLicenseOutput omitted an explicit StringComparison; use
StringComparison.Ordinal since this is a delimiter/token match.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mauroa
mauroa marked this pull request as ready for review August 11, 2026 16:52
Copilot AI lite review requested due to automatic review settings August 11, 2026 16:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 addresses Roslyn analyzer warning CA1310 in the Android SDK tooling code by making the string comparison in ParseLicenseOutput explicit and culture-invariant, aligning the implementation with the intended β€œtoken/delimiter match” semantics.

Changes:

  • Updates the license-header detection to use EndsWith (":", StringComparison.Ordinal) to satisfy CA1310 and ensure correct, culture-invariant behavior.

πŸ’‘ Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@jonathanpeppers jonathanpeppers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are some test failures caused by the .NET releases today; I'll fix separately.

These related ones are green:

Image

@jonathanpeppers
jonathanpeppers merged commit 9892aed into dotnet:main Aug 11, 2026
37 of 44 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants