Skip to content

[release/11.0.1xx] Prevent CA2025 analyzer crash for direct field arguments - #56340

Merged
tannergooding merged 3 commits into
release/11.0.1xxfrom
backport/pr-55904-to-release/11.0.1xx
Sep 21, 2026
Merged

tannergooding merged 3 commits into
release/11.0.1xxfrom
backport/pr-55904-to-release/11.0.1xx

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #55904 to release/11.0.1xx

Fixes #53926

RC2 backport approval has been obtained; servicing-approved still needs to be recorded on this PR.

Customer Impact

  • Customer reported
  • Found internally

When CA2025 is enabled, passing a non-local disposable argument to a task-returning invocation, awaiting the task later, and analyzing disposal in the same method can crash the analyzer with NullReferenceException/AD0001. This interrupts analysis and can fail warnings-as-errors builds. The backport removes the analyzer crash; it does not address an application crash or enable this opt-in rule.

Regression

  • Yes
  • No

The issue investigation reports reproduction with .NET 10 and .NET 11, with .NET 9 as a negative control. This is an existing prior-release regression, not a newly introduced .NET 11 rule.

Testing

Includes NonLocalArgumentsAwaitedElsewhereBeforeDispose_NoDiagnosticAsync, covering field, property, and method-result arguments in both C# and Visual Basic, followed by delayed awaits and disposal. The final source diff and included coverage were inspected; the backport workflow completed successfully. Release-branch test results remain pending and are not implied by successful backport creation.

Risk

Low. The change filters null entries from the existing local-reference extraction helper. Converted and unconverted local references retain their existing handling. Non-local arguments were already unsupported by this tracking path; filtering them removes the exception rather than removing working field/property analysis. No diagnostic severity, default enablement, or new field-analysis support is introduced.

Note

This PR description was drafted with GitHub Copilot.

Copilot AI and others added 3 commits September 17, 2026 14:10
Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
Cover field, property, and method-returned StreamReader arguments in both C# and Visual Basic.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
github-actions Bot requested a review from a team as a code owner September 17, 2026 14:10
@github-actions github-actions Bot added the backport PR that has been backported to a servicing branch label Sep 17, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@artl93 artl93 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.

Customer reported. Regression. Analyzers should not crash. Approved for me.

@tannergooding
tannergooding merged commit 84676df into release/11.0.1xx Sep 21, 2026
20 of 21 checks passed
@tannergooding
tannergooding deleted the backport/pr-55904-to-release/11.0.1xx branch September 21, 2026 18:53
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc2 milestone Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport PR that has been backported to a servicing branch Servicing-approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants