Skip to content

[http-server-csharp] add arrayDeclarationContext#10327

Merged
markcowl merged 8 commits intomainfrom
sramsey/csharp-service-arrayDeclarationContext
Apr 17, 2026
Merged

[http-server-csharp] add arrayDeclarationContext#10327
markcowl merged 8 commits intomainfrom
sramsey/csharp-service-arrayDeclarationContext

Conversation

@sophia-ramsey
Copy link
Copy Markdown
Member

In my work in the openai-openapi-pr repo, the service emitter would not compile and gave the following error message:

Error: Emit context must have a scope set in order to create references to declarations.
    at compilerAssert (asset-emitter.js)
    at invokeReference (asset-emitter.js)
    at CSharpCodeEmitter.collectionDeclaration (service.js)
    at CSharpCodeEmitter.arrayDeclaration (service.js)

I fixed the issue when I added arrayDeclarationContext to the local node_modules in my repo. Here is the fix that I made as well as a test that demonstrates the issue.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

All changed packages have been documented.

  • @typespec/http-server-csharp
Show changes

@typespec/http-server-csharp - fix ✏️

add arrayDeclarationContext

@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Apr 9, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 9, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-server-csharp@10327

commit: e546542

@sophia-ramsey sophia-ramsey force-pushed the sramsey/csharp-service-arrayDeclarationContext branch from 215dc6d to 91d3430 Compare April 9, 2026 20:46
Copy link
Copy Markdown
Contributor

@markcowl markcowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! A few comments. I think the context is necessary, but the dedicated emitted file is not useful and we should avoid emitting it if possible.

Comment thread packages/http-server-csharp/test/generation.test.ts Outdated
Comment thread packages/http-server-csharp/test/generation.test.ts Outdated
Comment thread packages/http-server-csharp/test/generation.test.ts Outdated
Comment thread packages/http-server-csharp/test/generation.test.ts Outdated
Comment thread packages/http-server-csharp/test/generation.test.ts
Comment thread packages/http-server-csharp/src/lib/service.ts
@sophia-ramsey sophia-ramsey marked this pull request as ready for review April 13, 2026 23:23
Copy link
Copy Markdown
Contributor

@markcowl markcowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor change, otherwise this looks good.

Comment thread packages/http-server-csharp/test/generation.test.ts Outdated
@markcowl markcowl added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit b6a0a02 Apr 17, 2026
31 checks passed
@markcowl markcowl deleted the sramsey/csharp-service-arrayDeclarationContext branch April 17, 2026 01:48
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.

4 participants