Skip to content

Remove redundant null-forgiving operator on cts in Program.cs - #12190

Merged
jonathanpeppers merged 2 commits into
mainfrom
copilot/fix-redundant-null-forgiving-operator
Jul 21, 2026
Merged

Remove redundant null-forgiving operator on cts in Program.cs#12190
jonathanpeppers merged 2 commits into
mainfrom
copilot/fix-redundant-null-forgiving-operator

Conversation

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

cts in src/Microsoft.Android.Run/Program.cs is a non-nullable CancellationTokenSource initialized at declaration, making the ! in cts!.Token redundant and a violation of the repo's "never use !" rule.

Change

  • src/Microsoft.Android.Run/Program.cs: Remove postfix ! from cts!.Token.IsCancellationRequestedcts.Token.IsCancellationRequested
// Before
while (!cts!.Token.IsCancellationRequested) {

// After
while (!cts.Token.IsCancellationRequested) {

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix redundant null-forgiving operator on cts! in Program.cs Remove redundant null-forgiving operator on cts in Program.cs Jul 21, 2026
Copilot AI requested a review from jonathanpeppers July 21, 2026 02:31
@jonathanpeppers
jonathanpeppers marked this pull request as ready for review July 21, 2026 13:31
Copilot AI review requested due to automatic review settings July 21, 2026 13:31
@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) July 21, 2026 13:32
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Jul 21, 2026

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

Removes an unnecessary null-forgiving operator in Microsoft.Android.Run where cts is already a non-nullable CancellationTokenSource initialized at declaration, aligning the code with the repo’s “never use !” guidance.

Changes:

  • Replace cts!.Token.IsCancellationRequested with cts.Token.IsCancellationRequested in the logcat/app-exit wait loop.

@jonathanpeppers
jonathanpeppers merged commit b2190b5 into main Jul 21, 2026
45 checks passed
@jonathanpeppers
jonathanpeppers deleted the copilot/fix-redundant-null-forgiving-operator branch July 21, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix-finder] Remove redundant null-forgiving operator on cts! in Microsoft.Android.Run/Program.cs

4 participants