Ensure output directory exists before writing files in http-client-csharp emitter#10138
Draft
Ensure output directory exists before writing files in http-client-csharp emitter#10138
Conversation
…nt-csharp emitter Add mkdirp calls to writeCodeModel and writeConfiguration to create the output directory before writing files, preventing ENOENT errors when the output directory does not exist. This follows the same pattern as the compiler's emitFile utility. Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/9fd1ce42-8ee7-4871-bcb0-b02cca563152
Copilot
AI
changed the title
[WIP] Fix http-client-csharp error when metadata.json is missing
Ensure output directory exists before writing files in http-client-csharp emitter
Mar 25, 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.
writeCodeModelandwriteConfigurationcallhost.writeFile()without ensuring the output directory exists, causingENOENTwhen the emitter runs against a clean output path. This affects downstream emitters (e.g.@azure-typespec/http-client-csharp) that call these exported functions before the directory is created by$onEmit.await context.program.host.mkdirp(outputFolder)to bothwriteCodeModelandwriteConfiguration, matching the defensive pattern used by the compiler'semitFileutilitymkdirp, add test asserting directory creationWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
telemetry.astro.build/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/bin/astro.mjs build sh eams�� pnpm gen-version--llmstxt sh /usr/bin/uname --no-emit cat reams/reference uname -p build.json sh k/typespec/typespec/node_modules--output-dir r --no-emit sh s/.bin/tspd sh(dns block)If you need me to access, download, or install something from one of these locations, you can either:
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.