Repository navigation
feat: enable C# emitter in playground with backend server - #10346
Merged
JoshLove-msft merged 21 commits intoApr 21, 2026
Merged
Conversation
- Split emitter into emit-generate.ts (Node.js) and emit-generate.browser.ts (browser stub) - Browser stub POSTs code model to playground server for generation - Created .NET playground server (ASP.NET Core) that runs the generator - Added Dockerfile for containerized deployment - Pipeline: ACR build + App Service deployment with managed identity - Bundle upload to blob storage for browser-side emitter loading - Website: added C# to playground with server URL configuration - Fix: explicit ValueExpression conversion in spread expressions to prevent SIGSEGV when ParameterProvider is spread into ValueExpression collections Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ployment Only add new parameters (PlaygroundBundleBuildScript, PlaygroundServerDockerfile, PlaygroundServerAppName) and server deployment section. No changes to existing publish/ESRP pipeline logic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JoshLove-msft
requested review from
Alitzel Mendez (AlitzelMendez),
ShivangiReja,
Brian Terlson (bterlson),
Christopher Radek (chrisradek),
Christopher Scott (christothes),
iscai-msft,
Jorge Rangel (jorgerangel-msft),
Jose Arriaga Maldonado (joseharriaga),
Jesse Squire (jsquire),
m-nash,
Mark Cowlishaw (markcowl),
Srikanta (srnagar),
Timothee Guerin (timotheeguerin) and
Will Temple (witemple-msft)
as code owners
April 12, 2026 18:40
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
commit: |
Contributor
|
No changes needing a change description found. |
Contributor
Author
|
Will have a follow up PR for some UX enhancements to show a compiling spinner and change highlighting. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
|
You can try these changes here
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JoshLove-msft
commented
Apr 13, 2026
Mark Cowlishaw (markcowl)
left a comment
Contributor
There was a problem hiding this comment.
I think we should be able to test changes using the typespec - PR Tools ci checks, so should update that workflow to ensure proper setup
Remove default server URL from browser stub to prevent it from leaking to third-party sites. The URL must be explicitly set via globalThis.__TYPESPEC_PLAYGROUND_SERVER_URL__ by the host site. Moved the URL configuration back to the website playground. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The server URL is hardcoded in the browser stub with no globalThis fallback. No configuration needed from the website. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
Yes, that would capture the website changes, but the emitter changes would need to be published via the emitter pipeline. |
The publish stage didn't set a Node version, defaulting to Node 20 on the agent. The bundle-uploader depends on asset-emitter which requires Node >=22. Added NodeTool@0 step before the bundle upload. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The publish stage checks out fresh source with the original package.json version (e.g. 0.1.0). The bundle uploader reads this version for latest.json. Added a step to apply the build number (e.g. 0.1.0-beta.12345) before bundling, matching Build-Packages.ps1 behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ADO template parser was failing on the inline script. Use the auto-set BUILD_BUILDNUMBER environment variable instead of the macro syntax. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
C# emitter sets BuildPrereleaseVersion=true so gets -alpha tag, matching Build-Packages.ps1 behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Server-side (Program.cs):
- Request size limit: 10 MB max body via Kestrel
- Content-Type validation: must be application/json
- JSON parse error handling: returns 400 on invalid JSON
- Subprocess timeout: 5 minutes, kills process tree on timeout (504)
- Security headers: X-Content-Type-Options, X-Frame-Options,
Referrer-Policy
Client-side (emit-generate.browser.ts):
- Validate response content-type is application/json
- Validate response shape: { files: Array<{ path, content }> }
- Validate each file entry has string path and content
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JoshLove-msft
force-pushed
the
feat/csharp-playground-server
branch
from
April 15, 2026 02:37
c36f99a to
5cb4659
Compare
Mock responses now include Headers with content-type to match the response validation added in the browser stub. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Checks Content-Length header against a 10 MB limit before parsing the response JSON to protect against unexpectedly large responses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mark Cowlishaw (markcowl)
approved these changes
Apr 21, 2026
Jorge Rangel (jorgerangel-msft)
approved these changes
Apr 21, 2026
Timothee Guerin (timotheeguerin)
approved these changes
Apr 21, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 21, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10228