Add analyzer to suggest input parameter binding over GetInput()#550
Add analyzer to suggest input parameter binding over GetInput()#550YunchuWang merged 7 commits intomainfrom
Conversation
Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
|
@copilot resolve conflict |
Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR implements a new Roslyn analyzer (DURABLE0009) that suggests using input parameter binding instead of calling ctx.GetInput<T>() in orchestration methods. This is an informational diagnostic to guide developers toward the preferred pattern, especially since GetInput<T>() is marked as potentially deprecated in the codebase.
Key Changes:
- Implements
GetInputOrchestrationAnalyzerwith Info severity to detectctx.GetInput<T>()usage - Adds comprehensive test coverage for various orchestration patterns (Durable Functions, TaskOrchestrator, and OrchestratorFunc)
- Includes resource strings for diagnostic messages
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Analyzers/Orchestration/GetInputOrchestrationAnalyzer.cs |
New analyzer detecting GetInput() usage in orchestration methods and suggesting input parameter binding |
test/Analyzers.Tests/Orchestration/GetInputOrchestrationAnalyzerTests.cs |
Comprehensive test suite covering empty code, non-orchestrations, various orchestration patterns, nested calls, and multiple invocations |
src/Analyzers/Resources.resx |
Resource strings for analyzer title and message format |
src/Analyzers/AnalyzerReleases.Unshipped.md |
Documentation entry for new DURABLE0009 diagnostic |
|
@copilot update pr description to follow .github/PULL_REQUEST_TEMPLATE.md |
|
LGTM |
Updated PR description to follow SummaryWhat changed?
Why is this change needed?The Issues / work itemsProject checklist
AI-assisted code disclosure (required)Was an AI tool used?
If AI was used:
AI verification:
TestingAutomated tests
Manual validation
Notes for reviewers
|

Summary
What changed?
GetInputOrchestrationAnalyzer(DURABLE0009) that detects usage ofctx.GetInput<T>()in orchestration methodsAnalyzerReleases.Unshipped.mdWhy is this change needed?
The
GetInput<T>()method is marked as potentially deprecated and input parameter binding is the recommended approach for accessing orchestration input. This Info-level analyzer helps guide developers toward the preferred pattern without blocking their builds.Issues / work items
Project checklist
AI-assisted code disclosure (required)
Was an AI tool used?
If AI was used:
src/Analyzers/Orchestration/GetInputOrchestrationAnalyzer.cs(analyzer implementation)test/Analyzers.Tests/Orchestration/GetInputOrchestrationAnalyzerTests.cs(test suite)src/Analyzers/Resources.resx(diagnostic messages)src/Analyzers/AnalyzerReleases.Unshipped.md(release tracking)operation.TargetMethodbased on code review feedbackCSharpCodeFixVerifiertoCSharpAnalyzerVerifierfor consistencyAI verification:
Testing
Automated tests
Manual validation
context.GetInput<T>()usageNotes for reviewers
[OrchestrationTrigger],TaskOrchestrator<TInput, TOutput>classes, andAddOrchestratorFunclambdasCSharpAnalyzerVerifierinstead ofCSharpCodeFixVerifierOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.