---
applyTo: "packages/http-client-csharp/**/*"
---

# http-client-csharp Development

## Setup

- These setup instructions supersede those from copilot-instructions. There is no need to run any `pnpm` commands when working on http-client-csharp development. There is also no need to add change logs.
- Do not change the `global.json` file. Install the appropriate .NET SDK if not already installed in the environment.
- http-client-csharp code is located under `packages/http-client-csharp`.
- For any tasks that do not involve changes to the `package.json` file, perform the following steps:
  - Run `npm ci`
  - Run `npm run build`
- If the task involves changing the emitter dependencies in `package.json`, run `npm install` instead of `npm ci`. You will still need to run `npm run build`.

## Development & Testing

- Add tests to the appropriate test file that covers the fix/feature.
- Validate the test fails as the feature/fix has not yet been implemented.
- Implement the feature/fix
- Validate that the test now passes.
- Add negative test cases as well as positive test cases.
- When adding new tests look for an existing test class that would be appropriate. Only create a new test class if you are adding a new TypeProvider or there is otherwise no existing test class that would make sense.
- If your test requires inputting C# code (either to test customization or to validate the expected output), put the code in a new file under the TestData folder for the corresponding test class. Do not inline literal C# test code. Examine tests that use `Helpers.GetExpectedFromTest` to determine the correct folder structure for TestData files.
- Regenerate all generated libraries by running `eng/scripts/Generate.ps1`.
- Ensure all unit tests are passing.
- Do not comment out or delete any existing tests.
- Run the Cop static-analysis checks locally with `npm run cop` (which invokes `eng/scripts/Invoke-Cop.ps1`). This downloads the pinned Agent Cop release and runs the rules under `cop-checks/` against the generator, failing on any violation. Ensure it reports `cop checks passed.` before committing C# changes.
