Skip to content

[http-client-csharp] Adopt streaming/jsonl Spector scenario and fix BinaryContent wrapping#10740

Open
JonathanCrd wants to merge 3 commits into
microsoft:mainfrom
JonathanCrd:joncarde/spector-streaming-jsonl
Open

[http-client-csharp] Adopt streaming/jsonl Spector scenario and fix BinaryContent wrapping#10740
JonathanCrd wants to merge 3 commits into
microsoft:mainfrom
JonathanCrd:joncarde/spector-streaming-jsonl

Conversation

@JonathanCrd
Copy link
Copy Markdown
Member

@JonathanCrd JonathanCrd commented May 19, 2026

Summary

This PR adopts the streaming/jsonl Spector scenario for the C# HTTP client emitter and fixes a generator bug discovered during adoption.

Closes #10738

Bug Fix

When ScmMethodProviderCollection.GetProtocolMethodArguments() navigates MethodParameterSegments to resolve a property path (e.g., streamstream.Body), the resolved BinaryData expression was passed directly as a BinaryContent protocol argument — causing a CS1503 compilation error. The fix wraps the expression with BinaryContent.Create() when the protocol parameter is a content parameter.

This also fixed a pre-existing latent bug in the Sample-TypeSpec NoContentType method (info.Action had the same issue).

Spector Adoption

  • Removed streaming/jsonl from ``
  • Generated stub project under Spector/http/streaming/jsonl/
  • Added JsonlTests.cs with BasicSend and BasicReceive tests
  • Added project reference in Spector.Tests.csproj
  • Updated launchSettings.json via full Generate.ps1

Validation

  • All 1335 ClientModel generator tests pass
  • All 37 Local tests pass
  • Stubs and real (non-stubbed) code both compile
  • Full Generate.ps1 run completed successfully

🤖 Created with JonathanCrd's copilot

JonathanCrd and others added 3 commits May 19, 2026 15:32
…n MethodParameterSegments navigation

When MethodParameterSegments navigation resolves to a BinaryData property,
the expression was passed directly as a BinaryContent protocol argument
without wrapping. This caused a CS1503 compilation error.

Wrap the resolved property expression with RequestContentApiSnippets.Create()
when the protocol parameter is a content parameter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ntent fix

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove streaming/jsonl from failingSpecs list
- Add generated stub project under Spector/http/streaming/jsonl/
- Add JsonlTests.cs with BasicSend and BasicReceive tests
- Add project reference in Spector.Tests.csproj
- Update launchSettings.json via full Generate.ps1

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label May 19, 2026
@JonathanCrd JonathanCrd self-assigned this May 19, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 19, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-csharp@10740

commit: 952f63e

@github-actions
Copy link
Copy Markdown
Contributor

No changes needing a change description found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[http-client-csharp] Add support for Streaming/JSONL scenarios

1 participant