Skip to content

Commit 9b99f8b

Browse files
committed
Merge main into copilot/support-generic-converters
# Conflicts: # src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs
2 parents 270b4e1 + 4c78a14 commit 9b99f8b

3,129 files changed

Lines changed: 119612 additions & 32378 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.CodeQL.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file configures CodeQL runs and TSA bug autofiling. For more information, see:
2-
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/codeql/troubleshooting/bugs/generated-library-code
2+
# https://eng.ms/docs/coreai/devdiv/one-engineering-system-1es/1es-docs/codeql/troubleshooting/bugs/generated-library-code
33
# (Access restricted to Microsoft employees only.)
44

55
path_classifiers:
@@ -15,3 +15,43 @@ path_classifiers:
1515
# files are generated as part of build-time checks in CMake and are not compiled
1616
# or linked into any product binaries.
1717
- artifacts/obj/**/CMakeFiles/**/CheckFunctionExists.c
18+
19+
queries:
20+
#
21+
# REPO-WIDE RULE EXCLUSIONS
22+
#
23+
- exclude:
24+
queryid:
25+
# [Serializable] doesn't imply that a type is *safe* to [de]serialize; only that it is
26+
# *possible* to do so. The rules below incorrectly assume we're trying to make a safety
27+
# guarantee.
28+
- "cs/dangerous-deserialization-routine"
29+
- "cs/deserialization-of-pointer-type"
30+
# We already have CodeQL + Roslyn rules running to detect usage of dangerous deserialization
31+
# APIs. Those call sites are well-reviewed and don't benefit from extra alerts regarding
32+
# the possibility of loading malicious code.
33+
- "cs/deserialization-unexpected-subtypes"
34+
#
35+
# Don't warn about usage of non-compliant crypto within our own implementations or interop code,
36+
# since the rule would noisily try to warn us about *ourselves*. These exclusions are scoped
37+
# to just the crypto code itself. We still want alerts when consumers of crypto (even within this
38+
# repo) try to use non-compliant primitives; those call sites must be manually inspected
39+
# and suppressed if appropriate.
40+
#
41+
- exclude:
42+
queryid:
43+
- "cs/ecb-encryption"
44+
- "cs/encryption-with-vulnerable-cipher-mode"
45+
- "cs/weak-symmetric-algorithm"
46+
- "cs/obsolete-password-key-derivation"
47+
- "cs/cryptography/unapproved-usage-of-dsa"
48+
- "cs/weak-crypto"
49+
- "cs/weak-hmacs"
50+
- "java/weak-crypto-algorithm-or-hash"
51+
path:
52+
- "src/libraries/Common/src/Interop/Windows/BCrypt/**"
53+
- "src/libraries/Common/src/System/Security/Cryptography/**"
54+
- "src/libraries/Microsoft.Bcl.Cryptography/**"
55+
- "src/libraries/System.Security.Cryptography/**"
56+
- "src/libraries/System.Security.Cryptography.*/**"
57+
- "src/native/libs/System.Security.Cryptography.*/**"

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
]
1616
},
1717
"microsoft.dotnet.xharness.cli": {
18-
"version": "11.0.0-prerelease.26064.3",
18+
"version": "11.0.0-prerelease.26160.2",
1919
"commands": [
2020
"xharness"
2121
]

.devcontainer/devcontainer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
},
1515

1616
"features": {
17-
"ghcr.io/devcontainers/features/github-cli:1": {}
17+
"ghcr.io/devcontainers/features/github-cli:1": {},
18+
"ghcr.io/devcontainers/features/sshd:1": {},
19+
"ghcr.io/devcontainers/features/copilot-cli:1": {}
1820
},
1921

2022
// Configure tool-specific properties.

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ csharp_space_between_square_brackets = false
165165
# License header
166166
file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.
167167

168+
# xUnit1051: recommends TestContext.Current.CancellationToken (v3 pattern) which
169+
# is not yet adopted; suppress until a full v3 migration is performed.
170+
dotnet_diagnostic.xUnit1051.severity = none
171+
168172
[src/libraries/System.Net.Http/src/System/Net/Http/{SocketsHttpHandler/Http3RequestStream.cs,BrowserHttpHandler/BrowserHttpHandler.cs}]
169173
# disable CA2025, the analyzer throws a NullReferenceException when processing this file: https://github.com/dotnet/roslyn-analyzers/issues/7652
170174
dotnet_diagnostic.CA2025.severity = none

.github/copilot-instructions.md

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
excludeAgent: code-review-agent
2+
excludeAgent: code-review
33
---
44

55
**Any code you commit MUST compile, and new and existing tests related to the change MUST pass.**
@@ -8,7 +8,11 @@ You MUST make your best effort to ensure any code changes satisfy those criteria
88

99
If you make code changes, do not complete without checking the relevant code builds and relevant tests still pass after the last edits you make. Do not simply assume that your changes fix test failures you see, actually build and run those tests again to confirm.
1010

11-
Before completing, use the `code-review` skill to review your code changes. Any issues flagged as errors or warnings should be addressed before completing.
11+
When running under CCA and before completing, use the `code-review` skill to review your code changes. Any issues flagged as errors or warnings should be addressed before the task is considered complete.
12+
13+
When NOT running under CCA, skip the `code-review` skill if the user has stated they will review the changes themselves.
14+
15+
Before making changes to a directory, search for `README.md` files in that directory and its parent directories up to the repository root. Read any you find — they contain conventions, patterns, and architectural context relevant to your work.
1216

1317
If the changes are intended to improve performance, or if they could negatively impact performance, use the `performance-benchmark` skill to validate the impact before completing.
1418

@@ -25,6 +29,8 @@ In addition to the rules enforced by `.editorconfig`, you SHOULD:
2529
- Prefer `?.` if applicable (e.g. `scope?.Dispose()`).
2630
- Use `ObjectDisposedException.ThrowIf` where applicable.
2731
- When adding new unit tests, strongly prefer to add them to existing test code files rather than creating new code files.
32+
- When adding new test files, examine the directory structure of sibling tests first. Some test directories use flat files (e.g., `GCEvents.cs` alongside `GCEvents.csproj`) while others use per-test subdirectories. Match the existing convention.
33+
- When working with tests, look for `README.md` files along the directory hierarchy (starting from the test's directory and walking up). These contain build, run, and authoring guidance specific to that test area.
2834
- When adding new unit tests, avoid adding a regression comment citing a GitHub issue or PR number unless explicitly asked to include such information.
2935
- When writing tests, prefer using `[Theory]` with multiple data sources (like `[InlineData]` or `[MemberData]`) over multiple duplicative `[Fact]` methods. Fewer test methods that validate more inputs are better than many similar test methods.
3036
- If you add new code files, ensure they are listed in the csproj file (if other files in that folder are listed there) so they build.
@@ -34,6 +40,13 @@ In addition to the rules enforced by `.editorconfig`, you SHOULD:
3440
- For markdown (`.md`) files, ensure there is no trailing whitespace at the end of any line.
3541
- When adding XML documentation to APIs, follow the guidelines at [`docs.prompt.md`](/.github/prompts/docs.prompt.md).
3642

43+
When NOT running under CCA, guidance for creating commits and pushing changes:
44+
45+
- Never squash and force push unless explicitly instructed. Always push incremental commits on top of previous PR changes.
46+
- Never push to an active PR without being explicitly asked, even in autopilot/yolo mode. Always wait for explicit instruction to push.
47+
- Never chain commit and push in the same command. Always commit first, report what was committed, then wait for an explicit push instruction. This creates a mandatory decision point.
48+
- Prefer creating a new commit rather than amending an existing one. Exceptions: (1) explicitly asked to amend, or (2) the existing commit is obviously broken with something minor (e.g., typo or comment fix) and hasn't been pushed yet.
49+
3750
---
3851

3952
# Building & Testing in dotnet/runtime
@@ -150,15 +163,58 @@ cd src/tests
150163

151164
### Runtime Tests
152165

153-
**Build:**
166+
Subdirectories under `src/tests/` may contain `README.md` files with
167+
area-specific guidance (e.g., EventPipe test patterns).
168+
169+
**Build all tests:**
154170
```bash
155171
./build.sh clr+libs -lc release -rc checked
156172
./src/tests/build.sh checked
157173
./src/tests/run.sh checked
158174
```
159175

176+
**Build a single test project** (path is relative to the repo root):
177+
```bash
178+
# Use -priority1 ("-Priority 1" on Windows) for tests with <CLRTestPriority>1</CLRTestPriority>,
179+
# otherwise the build silently reports "0 test projects" and builds nothing.
180+
src/tests/build.sh -Test tracing/eventpipe/eventsvalidation/GCEvents.csproj x64 Release -priority1
181+
```
182+
183+
Other useful flags (run `src/tests/build.sh -h` for the full list):
184+
185+
| Flag | Description |
186+
|------|-------------|
187+
| `-Test <path>` | Build one project |
188+
| `-Dir <path>` | Build all projects in a directory |
189+
| `-Tree <path>` | Build a subtree recursively |
190+
| `-priority1` (`-Priority 1` on Windows) | Include priority 1 tests |
191+
| `-GenerateLayoutOnly` | Generate Core_Root layout only |
192+
193+
**Generate Core_Root layout** (required before running individual tests):
194+
```bash
195+
src/tests/build.sh -GenerateLayoutOnly x64 Release
196+
```
197+
198+
**Run a single test:**
199+
```bash
200+
export CORE_ROOT=$(pwd)/artifacts/tests/coreclr/<os>.x64.Release/Tests/Core_Root
201+
cd artifacts/tests/coreclr/<os>.x64.Release/<test-path>/
202+
$CORE_ROOT/corerun <TestName>.dll
203+
# Exit code 100 = pass, any other value = fail.
204+
```
205+
160206
---
161207

208+
## Adding new tests
209+
210+
When creating a regression test for a bug fix:
211+
212+
1. **Verify the test FAILS without the fix** — build and run against the unfixed code.
213+
2. **Verify the test PASSES with the fix** — apply the fix, rebuild, and run again.
214+
3. If the fix is not yet merged locally, manually apply the minimal changes from the PR/commit to verify.
215+
216+
Do not mark a regression test task as complete until both conditions are confirmed.
217+
162218
## Troubleshooting
163219

164220
| Error | Solution |
@@ -167,10 +223,11 @@ cd src/tests
167223
| "testhost" missing / FileNotFoundException | Run baseline build first (Step 2 above) |
168224
| Build timeout | Wait up to 40 min; only fail if no output for 5 min |
169225
| "Target does not exist" | Avoid specifying a target framework; the build will auto-select `$(NetCoreAppCurrent)` |
226+
| "0 test projects" after `build.sh -Test` | The test has `<CLRTestPriority>` > 0; add `-priority1` to the build command |
170227

171228
**When reporting failures:** Include logs from `artifacts/log/` and console output for diagnostics.
172229

173-
**Windows:** Use `build.cmd` instead of `build.sh`. Set PATH: `set PATH=%CD%\.dotnet;%PATH%`
230+
**Windows:** Use `build.cmd` instead of `build.sh`.
174231

175232
---
176233

0 commit comments

Comments
 (0)