Skip to content

Add Unity-aware async correctness diagnostics - #491

Closed
Sebastien Lebreton (sailro) wants to merge 1 commit into
mainfrom
feature/426-async-diagnostics
Closed

Add Unity-aware async correctness diagnostics#491
Sebastien Lebreton (sailro) wants to merge 1 commit into
mainfrom
feature/426-async-diagnostics

Conversation

@sailro

@sailro Sebastien Lebreton (sailro) commented Sep 9, 2026

Copy link
Copy Markdown
Member

Fixes #426

Checklist

  • I have read the Contribution Guide ;
  • There is an approved issue describing the change when contributing a new analyzer or suppressor ;
  • I have added tests that prove my fix is effective or that my feature works ;
  • I have added necessary documentation (if appropriate) ;

Short description of what this resolves:

Adds the four async correctness checks highlighted in #426, with support for UniTask and Unity Awaitable as well as .NET Task and ValueTask types.

Changes proposed in this pull request:

  • Add UNT0045 and UNT0046 for async-void methods and delegates, using resolved signatures and preserving recognized Unity callback, event-handler, override, and interface contracts.
  • Add UNT0047 for task-to-string conversions, including interpolation, concatenation, formatting APIs, and Unity logging.
  • Add UNT0048 for null task returns, distinguishing null operations from valid null async results and value-type defaults, including nested functions and expression bodies.
  • Reuse TypeSymbolExtensions, ScriptInfo, and existing load-callback detection; preserve existing Unity message matching rather than broadening it to every task-like type.
  • Add diagnostic resources, documentation, shared compile-only UniTask test types, and regression coverage.

No automatic code fixes are provided because changing signatures or inserting await can alter caller contracts and execution order. The issue-approval checklist item is left unchecked because the issue does not record explicit approval.

Validation

  • Analyzer/test project build succeeded.
  • All 347 focused tests passed, covering the new diagnostics, related existing analyzers, and diagnostic ID consistency.
  • The full suite, including network-based documentation-link checks, was not run.

Add UNT0045-UNT0048 for async void usage, task-to-string conversions, and null task returns. Reuse Unity callback and type matching, with UniTask/Awaitable support and regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sailro
Sebastien Lebreton (sailro) requested a review from a team as a code owner September 9, 2026 13:28
@sailro
Sebastien Lebreton (sailro) deleted the feature/426-async-diagnostics branch September 9, 2026 13:43
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.

Could you introduce these two analyzers about async method to unity analyser?

1 participant