Skip to content

Add MCP003 analyzer: warn when WithHttpTransport doesn't set Stateless#1471

Open
halter73 wants to merge 1 commit intohalter73/stateless-docsfrom
halter73/stateless-analyzer
Open

Add MCP003 analyzer: warn when WithHttpTransport doesn't set Stateless#1471
halter73 wants to merge 1 commit intohalter73/stateless-docsfrom
halter73/stateless-analyzer

Conversation

@halter73
Copy link
Copy Markdown
Contributor

Add a Roslyn DiagnosticAnalyzer (MCP003) that warns when WithHttpTransport is called without explicitly setting HttpServerTransportOptions.Stateless. This protects users from breaking changes if the default changes from stateful to stateless in the future.

The analyzer detects:

  • No delegate passed: .WithHttpTransport()
  • Null literal: .WithHttpTransport(null)
  • Lambda without Stateless assignment
  • Method groups and delegate variables (cannot trace)

Add a Roslyn DiagnosticAnalyzer (MCP003) that warns when WithHttpTransport
is called without explicitly setting HttpServerTransportOptions.Stateless.
This protects users from breaking changes if the default changes from
stateful to stateless in the future.

The analyzer detects:
- No delegate passed: .WithHttpTransport()
- Null literal: .WithHttpTransport(null)
- Lambda without Stateless assignment
- Method groups and delegate variables (cannot trace)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant