Skip to content

Commit eae9047

Browse files
authored
Merge branch 'main' into issue80393
2 parents 5878993 + 167d862 commit eae9047

File tree

10,355 files changed

+734775
-484667
lines changed

Some content is hidden

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

10,355 files changed

+734775
-484667
lines changed

.config/dotnet-tools.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
]
1616
},
1717
"microsoft.dotnet.xharness.cli": {
18-
"version": "10.0.0-prerelease.24610.1",
18+
"version": "10.0.0-prerelease.25330.2",
1919
"commands": [
2020
"xharness"
2121
]
2222
},
2323
"microsoft.visualstudio.slngen.tool": {
24-
"version": "11.1.0",
24+
"version": "12.0.15",
2525
"commands": [
2626
"slngen"
2727
]

.devcontainer/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,5 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
2424
liblttng-ust-dev \
2525
libssl-dev \
2626
libkrb5-dev \
27-
zlib1g-dev \
2827
ninja-build \
2928
tzdata

.devcontainer/android/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
2121
liblttng-ust-dev \
2222
libssl-dev \
2323
libkrb5-dev \
24-
zlib1g-dev \
2524
ninja-build \
26-
zlib1g-dev \
2725
ninja-build \
2826
openjdk-17-jdk \
2927
pulseaudio

.devcontainer/wasm-multiThreaded/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
2424
liblttng-ust-dev \
2525
libssl-dev \
2626
libkrb5-dev \
27-
zlib1g-dev \
2827
ninja-build
2928

3029
SHELL ["/bin/bash", "-c"]

.devcontainer/wasm/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
2323
liblttng-ust-dev \
2424
libssl-dev \
2525
libkrb5-dev \
26-
zlib1g-dev \
2726
ninja-build
2827

2928
SHELL ["/bin/bash", "-c"]

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ csharp_space_between_square_brackets = false
155155
# License header
156156
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.
157157

158+
[src/libraries/System.Net.Http/src/System/Net/Http/{SocketsHttpHandler/Http3RequestStream.cs,BrowserHttpHandler/BrowserHttpHandler.cs}]
159+
# disable CA2025, the analyzer throws a NullReferenceException when processing this file: https://github.com/dotnet/roslyn-analyzers/issues/7652
160+
dotnet_diagnostic.CA2025.severity = none
161+
158162
# C++ Files
159163
[*.{cpp,h,in}]
160164
curly_bracket_next_line = true

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
/src/coreclr/inc/corinfo.h @dotnet/jit-contrib
1111
/src/coreclr/inc/corjit.h @dotnet/jit-contrib
1212
/src/coreclr/jit/ @dotnet/jit-contrib
13+
/src/coreclr/interpreter/ @brzvlad @janvorli @kg
14+
/src/coreclr/vm/interpexec* @brzvlad @janvorli @kg
1315
/src/coreclr/nativeaot @MichalStrehovsky
1416
/src/coreclr/tools/Common @dotnet/crossgen-contrib @MichalStrehovsky
1517
/src/coreclr/tools/aot @dotnet/crossgen-contrib
@@ -112,3 +114,4 @@
112114
/docs/area-owners.* @jeffhandley
113115
/docs/issue*.md @jeffhandley
114116
/.github/policies/ @jeffhandley @mkArtakMSFT
117+
/.github/workflows/ @jeffhandley @dotnet/runtime-infrastructure

.github/copilot-instructions.md

Lines changed: 313 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,313 @@
1+
**Any code you commit SHOULD compile, and new and existing tests related to the change SHOULD pass.**
2+
3+
You MUST make your best effort to ensure your changes satisfy those criteria before committing. If for any reason you were unable to build or test the changes, you MUST report that. You MUST NOT claim success unless all builds and tests pass as described above.
4+
5+
You MUST refer to the [Building & Testing in dotnet/runtime](#building--testing-in-dotnetruntime) instructions and use the commands and approaches specified there before attempting your own suggestions.
6+
7+
You MUST follow all code-formatting and naming conventions defined in [`.editorconfig`](/.editorconfig).
8+
9+
In addition to the rules enforced by `.editorconfig`, you SHOULD:
10+
11+
- Prefer file-scoped namespace declarations and single-line using directives.
12+
- Ensure that the final return statement of a method is on its own line.
13+
- Use pattern matching and switch expressions wherever possible.
14+
- Use `nameof` instead of string literals when referring to member names.
15+
- Always use `is null` or `is not null` instead of `== null` or `!= null`.
16+
- Trust the C# null annotations and don't add null checks when the type system says a value cannot be null.
17+
- Prefer `?.` if applicable (e.g. `scope?.Dispose()`).
18+
- Use `ObjectDisposedException.ThrowIf` where applicable.
19+
- When adding new unit tests, strongly prefer to add them to existing test code files rather than creating new code files.
20+
- 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.
21+
- When running tests, if possible use filters and check test run counts, or look at test logs, to ensure they actually ran.
22+
- Do not finish work with any tests commented out or disabled that were not previously commented out or disabled.
23+
- When writing tests, do not emit "Act", "Arrange" or "Assert" comments.
24+
25+
---
26+
27+
# Building & Testing in dotnet/runtime
28+
29+
- [1. Prerequisites](#1-prerequisites)
30+
- [1.1. Determine Affected Components](#11-determine-affected-components)
31+
- [1.2. Baseline Setup](#12-baseline-setup)
32+
- [2. Iterative Build and Test Strategy](#2-iterative-build-and-test-strategy)
33+
- [2.1. Success Criteria](#21-success-criteria)
34+
- [3. CoreCLR (CLR) Workflow](#3-coreclr-clr-workflow)
35+
- [4. Mono Runtime Workflow](#4-mono-runtime-workflow)
36+
- [5. Libraries Workflow](#5-libraries-workflow)
37+
- [5.1. How To: Identify Affected Libraries](#51-how-to-identify-affected-libraries)
38+
- [5.2. How To: Build and Test Specific Library](#52-how-to-build-and-test-specific-library)
39+
- [6. WebAssembly (WASM) Libraries Workflow](#6-webassembly-wasm-libraries-workflow)
40+
- [7. Host Workflow](#7-host-workflow)
41+
- [8. Additional Notes](#8-additional-notes)
42+
- [8.1. Troubleshooting](#81-troubleshooting)
43+
- [8.2. Windows Command Equivalents](#82-windows-command-equivalents)
44+
- [8.3. References](#83-references)
45+
46+
## 1. Prerequisites
47+
48+
These steps need to be done **before** applying any changes.
49+
50+
### 1.1. Determine Affected Components
51+
52+
Identify which components will be impacted by the changes. If in doubt, analyze the paths of the files to be updated:
53+
54+
- **CoreCLR (CLR):** Changes in `src/coreclr/` or `src/tests/`
55+
- **Mono Runtime:** Changes in `src/mono/`
56+
- **Libraries:** Changes in `src/libraries/`
57+
- **WASM/WASI Libraries:** Changes in `src/libraries/` *and* the affected library targets WASM or WASI *and* the changes are included for the target (see below for details).
58+
- **Host:** Changes in `src/native/corehost/`, `src/installer/managed/`, or `src/installer/tests/`
59+
- If none above apply, it is most possibly an infra-only or a docs-only change. Skip build and test steps.
60+
61+
**WASM/WASI Library Change Detection**
62+
63+
A change is considered WASM/WASI-relevant if:
64+
65+
- The relevant `.csproj` contains explicit Browser/WASM or WASI targets (look for `<TargetFrameworks>`, `$(TargetPlatformIdentifier)`, or `Condition` attributes referencing `browser` or `wasi`, as well as `TARGET_BROWSER` or `TARGET_WASI` constants), **and**
66+
- The changed file is not excluded from the build for that platform in any way with a `Condition` attribute on `<ItemGroup>` or `<Compile>`.
67+
68+
---
69+
70+
### 1.2. Baseline Setup
71+
72+
Before applying any changes, ensure you have a full successful build of the needed runtime+libraries as a baseline.
73+
74+
1. Checkout `main` branch
75+
76+
2. From the repository root, run the build depending on the affected component. If multiple components are affected, subsequently run and verify the builds for all of them.
77+
- **CoreCLR (CLR):** `./build.sh clr+libs+host`
78+
- **Mono Runtime:** `./build.sh mono+libs`
79+
- **Libraries:** `./build.sh clr+libs -rc release`
80+
- **WASM/WASI Libraries:** `./build.sh mono+libs -os browser`
81+
- **Host:** `./build.sh clr+libs+host -rc release -lc release`
82+
83+
3. Verify the build completed without error.
84+
- _If the baseline build failed, report the failure and don't proceed with the changes._
85+
86+
4. From the repository root:
87+
- Configure PATH: `export PATH="$(pwd)/.dotnet:$PATH"`
88+
- Verify SDK Version: `dotnet --version` should match `sdk.version` in `global.json`.
89+
90+
5. Switch back to the working branch.
91+
92+
---
93+
94+
## 2. Iterative Build and Test Strategy
95+
96+
1. Apply the intended changes
97+
98+
2. **Attempt Build.** If the build fails, attempt to fix and retry the step (up to 5 attempts).
99+
100+
3. **Attempt Test.**
101+
- If a test _build_ fails, attempt to fix and retry the step (up to 5 attempts).
102+
- If a test _run_ fails,
103+
- Determine if the problem is in the test or in the source
104+
- If the problem is in the test, attempt to fix and retry the step (up to 5 attempts).
105+
- If the problem is in the source, reconsider the full changeset, attempt to fix and repeat the workflow.
106+
107+
4. **Workflow Iteration:**
108+
- Repeat build and test up to 5 cycles.
109+
- If issues persist after 5 workflow cycles, report failure.
110+
- If the same error persists after each fix attempt, do not repeat the same fix. Instead, escalate or report with full logs.
111+
112+
When retrying, attempt different fixes and adjust based on the build/test results.
113+
114+
### 2.1. Success Criteria
115+
116+
- **Build:**
117+
- Completes without errors.
118+
- Any non-zero exit code from build commands is considered a failure.
119+
120+
- **Tests:**
121+
- All tests must pass (zero failures).
122+
- Any non-zero exit code from test commands is considered a failure.
123+
124+
- **Workflow:**
125+
- On success: Report completion
126+
- Otherwise: Report error(s) with logs for diagnostics.
127+
- Collect logs from `artifacts/log/` and the console output for both build and test steps.
128+
- Attach relevant log files or error snippets when reporting failures.
129+
130+
---
131+
132+
## 3. CoreCLR (CLR) Workflow
133+
134+
From the repository root:
135+
136+
- Build:
137+
`./build.sh clr`
138+
139+
- Run tests:
140+
`cd src/tests && ./build.sh && ./run.sh`
141+
142+
- More info can be found in the dedicated workflow docs:
143+
- [Building CoreCLR Guide](/docs/workflow/building/coreclr/README.md)
144+
- [Building and Running CoreCLR Tests](/docs/workflow/testing/coreclr/testing.md)
145+
146+
---
147+
148+
## 4. Mono Runtime Workflow
149+
150+
From the repository root:
151+
152+
- Build:
153+
`./build.sh mono+libs`
154+
155+
- Run tests:
156+
157+
```bash
158+
./build.sh clr.host
159+
cd src/tests
160+
./build.sh mono debug /p:LibrariesConfiguration=debug
161+
./run.sh
162+
```
163+
164+
- More info can be found in the dedicated workflow docs:
165+
- [Building Mono](/docs/workflow/building/mono/README.md)
166+
- [Running test suites using Mono](/docs/workflow/testing/mono/testing.md)
167+
168+
---
169+
170+
## 5. Libraries Workflow
171+
172+
From the repository root:
173+
174+
- Build all libraries:
175+
`./build.sh libs -rc release`
176+
177+
- Run all tests for libraries:
178+
`./build.sh libs.tests -test -rc release`
179+
180+
- Build a specific library:
181+
- Refer to the section [5.2. How To: Build and Test Specific Library](#52-how-to-build-and-test-specific-library) below.
182+
183+
- Test a specific library:
184+
- Refer to the sections [5.1. How To: Identify Affected Libraries](#51-how-to-identify-affected-libraries) and [5.2. How To: Build and Test Specific Library](#52-how-to-build-and-test-specific-library) below.
185+
186+
- More info can be found in the dedicated workflow docs:
187+
- [Build Libraries](/docs/workflow/building/libraries/README.md)
188+
- [Testing Libraries](/docs/workflow/testing/libraries/testing.md)
189+
190+
### 5.1. How To: Identify Affected Libraries
191+
192+
For each changed file under `src/libraries/`, find the matching library and its test project(s).
193+
Most libraries use:
194+
195+
- Source: `src/libraries/<LibraryName>/src/<LibraryName>.csproj`
196+
197+
- Tests (single):
198+
- `src/libraries/<LibraryName>/tests/<LibraryName>.Tests.csproj`
199+
- OR `src/libraries/<LibraryName>/tests/<LibraryName>.Tests/<LibraryName>.Tests.csproj`
200+
201+
- Tests (multiple types):
202+
- `src/libraries/<LibraryName>/tests/FunctionalTests/<LibraryName>.Functional.Tests.csproj`
203+
- `src/libraries/<LibraryName>/tests/UnitTests/<LibraryName>.Unit.Tests.csproj`
204+
- Or similar.
205+
206+
---
207+
208+
### 5.2. How To: Build and Test Specific Library
209+
210+
If only one library is affected:
211+
212+
1. **Navigate to the library directory:**
213+
`cd src/libraries/<LibraryName>`
214+
215+
2. **Build the library:**
216+
`dotnet build`
217+
218+
3. **Build and run all test projects:**
219+
220+
- For each discovered `*.Tests.csproj` in the `tests` subdirectory:
221+
`dotnet build /t:test ./tests/<TestProject>.csproj`
222+
223+
- *Adjust path as needed. If in doubt, search with `find tests -name '*.csproj'`.*
224+
225+
- `dotnet build /t:test` is generally preferred over `dotnet test`
226+
227+
---
228+
229+
## 6. WebAssembly (WASM) Libraries Workflow
230+
231+
From the repository root:
232+
233+
- Build:
234+
`./build.sh libs -os browser`
235+
236+
- Run tests:
237+
`./build.sh libs.tests -test -os browser`
238+
239+
- More info can be found in the dedicated workflow docs:
240+
- [Build libraries for WebAssembly](/docs/workflow/building/libraries/webassembly-instructions.md)
241+
- [Testing Libraries on WebAssembly](/docs/workflow/testing/libraries/testing-wasm.md)
242+
243+
---
244+
245+
## 7. Host Workflow
246+
247+
From the repository root:
248+
249+
- Build:
250+
`./build.sh host -rc release -lc release`
251+
252+
- Run all tests:
253+
`./build.sh host.tests -rc release -lc release -test`
254+
255+
- More info can be found in the dedicated workflow docs:
256+
- [Building and running host tests](/docs/workflow/testing/host/testing.md)
257+
258+
---
259+
260+
## 8. Additional Notes
261+
262+
### 8.1. Troubleshooting
263+
264+
- **Shared Framework Missing**
265+
266+
- If the build fails with an error "The shared framework must be built before the local targeting pack can be consumed.", build both the runtime (clr or mono) and the libs.
267+
E.g., from the repo root, run `./build.sh clr+libs -rc release` if working on Libraries on CoreCLR. To find the applicable command, refer to the section [1.2. Baseline Setup](#12-baseline-setup).
268+
269+
- **Testhost Is Missing**
270+
271+
- If a test run fails with errors indicating a missing testhost, such as:
272+
- "Failed to launch testhost with error: System.IO.FileNotFoundException", or
273+
- "artifacts/bin/testhost/... No such file or directory",
274+
that means some of the prerequisites were not built.
275+
276+
- To resolve, build both the appropriate runtime (clr or mono) and the libs as a single command before running tests.
277+
E.g., from the repo root, run `./build.sh clr+libs -rc release` before testing Libraries on CoreCLR. To find the applicable command, refer to the section [1.2. Baseline Setup](#12-baseline-setup).
278+
279+
- **Build Timeout**
280+
281+
- Do not fail or cancel initial `./build.sh` builds due to timeout unless at least 40 minutes have elapsed.
282+
A full `clr+libs` build from scratch can take up to 32 minutes or more on some systems.
283+
284+
- Only wait for long-running `./build.sh` commands if they continue to produce output.
285+
If there is no output for 5 minutes, assume the build is stuck and fail early.
286+
287+
- **Target Does Not Exist**
288+
289+
- Avoid specifying a target framework when building unless explicitly asked.
290+
Build should identify and select the appropriate `$(NetCoreAppCurrent)` automatically.
291+
292+
---
293+
294+
### 8.2. Windows Command Equivalents
295+
296+
- Use `build.cmd` instead of `build.sh` on Windows.
297+
- Set PATH: `set PATH=%CD%\.dotnet;%PATH%`
298+
- All other commands are similar unless otherwise noted.
299+
300+
---
301+
302+
### 8.3. References
303+
304+
- [`.editorconfig`](/.editorconfig)
305+
- [Building CoreCLR Guide](/docs/workflow/building/coreclr/README.md)
306+
- [Building and Running CoreCLR Tests](/docs/workflow/testing/coreclr/testing.md)
307+
- [Building Mono](/docs/workflow/building/mono/README.md)
308+
- [Running test suites using Mono](/docs/workflow/testing/mono/testing.md)
309+
- [Build Libraries](/docs/workflow/building/libraries/README.md)
310+
- [Testing Libraries](/docs/workflow/testing/libraries/testing.md)
311+
- [Build libraries for WebAssembly](/docs/workflow/building/libraries/webassembly-instructions.md)
312+
- [Testing Libraries on WebAssembly](/docs/workflow/testing/libraries/testing-wasm.md)
313+
- [Building and running host tests](/docs/workflow/testing/host/testing.md)

0 commit comments

Comments
 (0)