Skip to content

Commit bd15d1d

Browse files
authored
Merge branch 'main' into fix/74020-jit-shift-opt
2 parents e648f54 + 8d796d8 commit bd15d1d

File tree

527 files changed

+7728
-20741
lines changed

Some content is hidden

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

527 files changed

+7728
-20741
lines changed

.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.25601.7",
18+
"version": "11.0.0-prerelease.25603.1",
1919
"commands": [
2020
"xharness"
2121
]
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
---
2+
excludeAgent: coding-agent
3+
---
4+
5+
# Code Review Instructions for dotnet/runtime
6+
7+
These instructions guide code reviews for the dotnet/runtime repository. A compiler runs on every PR (as do a wealth of static analyzers for C# changes), so focus on higher-level concerns that require expert judgment rather than stylistic or syntactic issues.
8+
9+
## Review Priorities
10+
11+
### 1. Security
12+
13+
**Critical Security Concerns:**
14+
- **Input Validation & Sanitization**: Ensure all external inputs (user data, file I/O, network data) are properly validated and sanitized before use
15+
- **Injection Vulnerabilities**: Check for potential SQL injection, command injection, path traversal, or code injection risks
16+
- **Cryptographic Operations**: Verify proper use of cryptographic APIs, secure random number generation, and correct handling of keys/certificates
17+
- **Buffer Overflows**: In native code, check for proper bounds checking and safe memory operations
18+
- **Authentication & Authorization**: Ensure proper access control checks are in place and cannot be bypassed
19+
- **Information Disclosure**: Watch for accidental logging or exposure of sensitive data (credentials, keys, PII)
20+
- **Denial of Service**: Check for potential infinite loops, resource exhaustion, or algorithmic complexity attacks
21+
- **Deserialization**: Ensure safe deserialization practices, especially with untrusted data
22+
- **Race Conditions**: Identify potential TOCTOU (time-of-check-time-of-use) vulnerabilities in security-sensitive operations
23+
24+
### 2. Performance
25+
26+
**Performance Considerations:**
27+
- **Algorithmic Complexity**: Identify inefficient algorithms (O(n²) where O(n) is possible, unnecessary allocations)
28+
- **Memory Allocations**: Watch for excessive allocations in hot paths, consider stack allocation (stackalloc) or object pooling where appropriate
29+
- **Boxing**: Identify unnecessary boxing of value types
30+
- **String Operations**: Check for string concatenation in loops (use StringBuilder), excessive string allocations
31+
- **LINQ Performance**: Evaluate LINQ usage in performance-critical paths; consider more direct alternatives
32+
- **Async/Await Overhead**: Ensure async/await is used appropriately (not for trivial synchronous operations)
33+
- **Collection Choices**: Verify appropriate collection types for access patterns (List vs. HashSet vs. Dictionary)
34+
- **Lazy Initialization**: Check for opportunities to defer expensive operations
35+
- **Caching**: Identify repeated expensive computations that could be cached
36+
- **Span<T> and Memory<T>**: Encourage use of modern memory-efficient types for buffer manipulation
37+
- **Native Interop**: Ensure P/Invoke calls are efficient and properly marshaled
38+
39+
### 3. Backwards Compatibility
40+
41+
**Compatibility Requirements:**
42+
- **Public API Changes**: Any change to public APIs requires careful scrutiny
43+
- Breaking changes are generally not acceptable
44+
- New optional parameters, overloads, and interface implementations need careful consideration
45+
- Verify that API additions follow existing patterns and naming conventions
46+
- **Serialization Compatibility**: Ensure changes don't break serialization/deserialization of persisted data
47+
- **Configuration Changes**: Changes to configuration format or behavior must maintain backwards compatibility
48+
- **Binary Compatibility**: IL-level changes must preserve binary compatibility for existing assemblies
49+
- **Behavioral Changes**: Even non-breaking API changes can break consumers if behavior changes unexpectedly
50+
- Document behavioral changes clearly
51+
- Consider feature flags or opt-in mechanisms for significant behavior changes
52+
- **Obsolete APIs**: Check that proper obsolescence process is followed (attributes, documentation, migration path)
53+
54+
### 4. Cross-Component Interactions
55+
56+
**Integration Points:**
57+
- **Runtime/Library Boundaries**: Changes affecting CoreCLR, Mono, or NativeAOT must work across all runtimes
58+
- **Platform Differences**: Ensure changes work correctly across Windows, Linux, macOS, and other supported platforms
59+
- **Architecture Considerations**: Verify behavior is correct on x86, x64, ARM32, and ARM64
60+
- **Dependencies**: Changes to core libraries may impact higher-level libraries; consider cascading effects
61+
- **Threading Models**: Ensure thread-safety is maintained and synchronization primitives are used correctly
62+
- **Lifecycle Management**: Verify proper initialization, disposal patterns, and cleanup across component boundaries
63+
- **Shared State**: Carefully review any shared mutable state for thread-safety and consistency
64+
- **Error Handling**: Ensure exceptions and error codes are properly propagated across component boundaries
65+
66+
### 5. Correctness and Edge Cases
67+
68+
**Code Correctness:**
69+
- **Null Handling**: While the compiler enforces nullable reference types, verify runtime null checks are appropriate
70+
- **Boundary Conditions**: Test for off-by-one errors, empty collections, null inputs, maximum values
71+
- **Error Paths**: Ensure error handling is correct and complete; resources are properly cleaned up
72+
- **Concurrency**: Identify race conditions, deadlocks, or improper synchronization
73+
- **Exception Safety**: Verify operations maintain invariants even when exceptions occur
74+
- **Resource Management**: Ensure IDisposable is implemented correctly and resources are not leaked
75+
- **Numeric Overflow**: Check for potential integer overflow/underflow in calculations
76+
- **Culture/Locale Issues**: Verify culture-invariant operations where appropriate, proper localization otherwise
77+
- **Time Handling**: Check for timezone, daylight saving, and leap second handling issues
78+
79+
### 6. Design and Architecture
80+
81+
**Design Quality:**
82+
- **API Design**: Ensure new APIs are intuitive, follow framework design guidelines, and are hard to misuse
83+
- **Abstraction Level**: Verify abstractions are at the appropriate level and don't leak implementation details
84+
- **Separation of Concerns**: Check that responsibilities are properly separated
85+
- **Extensibility**: Consider whether the design allows for future extension without breaking changes
86+
- **SOLID Principles**: Evaluate adherence to single responsibility, open/closed, and other design principles
87+
- **Code Duplication**: Identify opportunities to reduce duplication while maintaining clarity
88+
- **Testability**: Ensure the code is designed to be testable (proper dependency injection, separation of concerns)
89+
90+
### 7. Testing
91+
92+
**Test Quality:**
93+
- **Coverage**: Ensure new functionality has appropriate test coverage
94+
- **Test Scenarios**: Verify tests cover happy paths, error paths, and edge cases
95+
- **Test Reliability**: Watch for flaky tests (timing dependencies, environmental assumptions)
96+
- **Test Performance**: Ensure tests run efficiently and don't unnecessarily slow down CI
97+
- **Platform-Specific Tests**: Verify platform-specific tests are properly conditioned
98+
- **Regression Tests**: Check that bugs being fixed have corresponding regression tests
99+
100+
### 8. Documentation and Code Clarity
101+
102+
**Documentation:**
103+
- **XML Documentation**: New public APIs must have clear XML documentation explaining purpose, parameters, return values, and exceptions. Do not comment on existing APIs that lack documentation.
104+
- **Complex Logic**: Comments should explain the "why" behind non-obvious decisions, not restate what the code does
105+
- **TODOs and FIXMEs**: Ensure they are tracked with issues and are appropriate for the change
106+
- **Breaking Changes**: Must be clearly documented with migration guidance
107+
108+
## What NOT to Focus On
109+
110+
The following are handled by automated tooling and don't need review comments:
111+
112+
- Code formatting and style (handled by `.editorconfig` and analyzers)
113+
- Naming convention violations (handled by analyzers)
114+
- Missing using directives (handled by compiler)
115+
- Most syntax errors (handled by compiler)
116+
- Simple code style preferences without technical merit
117+
118+
## Review Approach
119+
120+
1. **Understand the Context**: Read the PR description and linked issues to understand the goal. Consider as much relevant code from the containing project as possible. For public APIs, review any code in the repo that consumes the method.
121+
2. **Assess the Scope**: Verify the change is focused and not mixing unrelated concerns
122+
3. **Evaluate Risk**: Consider the risk level based on what components are affected and how widely used they are
123+
4. **Think Like an Attacker**: For security-sensitive code, consider how it might be exploited
124+
5. **Think Like a Consumer**: Consider how the API will be used and potentially misused
125+
6. **Consider Maintenance**: Think about long-term maintenance burden and technical debt
126+
127+
## Severity Guidelines
128+
129+
- **Critical**: Security vulnerabilities, data corruption, crashes, breaking changes
130+
- **High**: Performance regressions, resource leaks, incorrect behavior in common scenarios
131+
- **Medium**: Edge case bugs, suboptimal design, missing documentation
132+
- **Low**: Code clarity issues, minor inefficiencies, nice-to-have improvements

.github/copilot-instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
excludeAgent: code-review-agent
3+
---
4+
15
**Any code you commit SHOULD compile, and new and existing tests related to the change SHOULD pass.**
26

37
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.

.github/workflows/locker.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Locker - Lock stale issues and PRs
1+
name: Locker - Lock stale issues and PRs, unlock reopened ones
22
on:
33
schedule:
44
- cron: '37 8 * * *' # Once per day, early morning PT
@@ -13,14 +13,21 @@ on:
1313
required: true
1414
default: "30"
1515

16+
issues:
17+
types: [reopened]
18+
19+
pull_request_target:
20+
types: [reopened]
21+
1622
permissions:
1723
issues: write
1824
pull-requests: write
1925

2026
jobs:
21-
main:
27+
lock:
2228
runs-on: ubuntu-latest
23-
if: ${{ github.repository_owner == 'dotnet' }}
29+
# Only run the locking job for scheduled runs and manual dispatch, not for reopened events
30+
if: ${{ github.repository_owner == 'dotnet' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
2431
steps:
2532
- name: Checkout Actions
2633
uses: actions/checkout@v6
@@ -35,3 +42,20 @@ jobs:
3542
with:
3643
daysSinceClose: ${{ fromJson(inputs.daysSinceClose || 30) }}
3744
daysSinceUpdate: ${{ fromJson(inputs.daysSinceUpdate || 30) }}
45+
46+
unlock:
47+
runs-on: ubuntu-latest
48+
# Only run the unlocking job when issues or PRs are reopened
49+
if: ${{ github.repository_owner == 'dotnet' && (github.event_name == 'issues' || github.event_name == 'pull_request_target') && github.event.action == 'reopened' }}
50+
steps:
51+
- name: Unlock if issue/PR is locked
52+
uses: actions/github-script@v7
53+
if: ${{ github.event.issue.locked == true }}
54+
with:
55+
script: |
56+
console.log(`Unlocking locked issue/PR #${context.issue.number}.`);
57+
await github.rest.issues.unlock({
58+
issue_number: context.issue.number,
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
});

Directory.Build.props

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@
3636
- src/mono/msbuild/common/MonoAOTCompiler.props
3737
- src/tasks/AppleAppBuilder/Xcode.cs
3838
- src/tasks/MobileBuildTasks/Apple/AppleProject.cs
39+
- src/tasks/Crossgen2Tasks/Microsoft.NET.CrossGen.targets
3940
- https://github.com/dotnet/sdk repo > src/Installer/redist-installer/targets/GeneratePKG.targets
4041
-->
4142
<AndroidApiLevelMin>21</AndroidApiLevelMin>
42-
<iOSVersionMin>12.2</iOSVersionMin>
43-
<tvOSVersionMin>12.2</tvOSVersionMin>
43+
<iOSVersionMin>13.0</iOSVersionMin>
44+
<tvOSVersionMin>13.0</tvOSVersionMin>
4445
<macOSVersionMin>12.0</macOSVersionMin>
45-
<MacCatalystVersionMin>15.0</MacCatalystVersionMin>
46+
<MacCatalystVersionMin>15.2</MacCatalystVersionMin>
4647
</PropertyGroup>
4748

4849
<PropertyGroup>
@@ -57,19 +58,19 @@
5758

5859
<!-- The TFMs to build and test against. -->
5960
<PropertyGroup>
60-
<NetCoreAppCurrentVersion>10.0</NetCoreAppCurrentVersion>
61+
<NetCoreAppCurrentVersion>11.0</NetCoreAppCurrentVersion>
6162
<NetCoreAppCurrentIdentifier>.NETCoreApp</NetCoreAppCurrentIdentifier>
6263
<NetCoreAppCurrentTargetFrameworkMoniker>$(NetCoreAppCurrentIdentifier),Version=v$(NetCoreAppCurrentVersion)</NetCoreAppCurrentTargetFrameworkMoniker>
6364
<MicrosoftNetCoreAppFrameworkName>Microsoft.NETCore.App</MicrosoftNetCoreAppFrameworkName>
6465
<NetCoreAppCurrentBrandName>.NET $(NetCoreAppCurrentVersion)</NetCoreAppCurrentBrandName>
6566
<NetCoreAppCurrent>net$(NetCoreAppCurrentVersion)</NetCoreAppCurrent>
6667

6768
<!-- The previous supported .NET version. -->
68-
<NetCoreAppPrevious>net9.0</NetCoreAppPrevious>
69-
<NetCoreAppPrevious Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(NetCoreAppCurrent)</NetCoreAppPrevious>
69+
<NetCoreAppPrevious />
70+
<!-- <NetCoreAppPrevious Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(NetCoreAppCurrent)</NetCoreAppPrevious> -->
7071

7172
<!-- The minimum supported .NET version. -->
72-
<NetCoreAppMinimum>net8.0</NetCoreAppMinimum>
73+
<NetCoreAppMinimum>net10.0</NetCoreAppMinimum>
7374
<NetCoreAppMinimum Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(NetCoreAppCurrent)</NetCoreAppMinimum>
7475

7576
<!-- when this is updated, make sure to keep $(_NetCoreAppToolCurrent)
@@ -87,8 +88,8 @@
8788
<NetFrameworkToolCurrent Condition="'$(DotNetBuildSourceOnly)' == 'true'" />
8889
<NetFrameworkCurrent Condition="'$(DotNetBuildSourceOnly)' == 'true'" />
8990

90-
<ApiCompatNetCoreAppBaselineVersion>9.0.0</ApiCompatNetCoreAppBaselineVersion>
91-
<ApiCompatNetCoreAppBaselineTFM>net9.0</ApiCompatNetCoreAppBaselineTFM>
91+
<ApiCompatNetCoreAppBaselineVersion>10.0.0</ApiCompatNetCoreAppBaselineVersion>
92+
<ApiCompatNetCoreAppBaselineTFM>net10.0</ApiCompatNetCoreAppBaselineTFM>
9293
</PropertyGroup>
9394

9495
<PropertyGroup Label="CalculateConfiguration">
@@ -178,7 +179,7 @@
178179

179180
<PropertyGroup>
180181
<DotNetHostBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(TargetRid).$(HostConfiguration)', 'corehost'))</DotNetHostBinDir>
181-
<DotNetCdacBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'mscordaccore_universal', '$(Configuration)', '$(NetCoreAppCurrent)', '$(PortableTargetRid)', 'publish'))</DotNetCdacBinDir>
182+
<DotNetCdacBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'mscordaccore_universal', '$(Configuration)', '$(PortableTargetRid)', 'publish'))</DotNetCdacBinDir>
182183
</PropertyGroup>
183184

184185
<!--Feature switches -->

Directory.Build.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,6 @@
209209
<Analyzer Remove="@(_targetingPackExcludedAnalyzerReferenceWithProjectName->Metadata('OriginalIdentity'))" />
210210
</ItemGroup>
211211
</Target>
212+
213+
<Import Project="$(RepositoryEngineeringDir)pruning.targets" />
212214
</Project>

docs/coding-guidelines/adding-api-guidelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ the implementation without compat concerns in future releases.
2424

2525
### Determine target framework
2626

27-
`net10.0` is the target framework version currently under development and the new apis
28-
should be added to `net10.0`. [More Information on TargetFrameworks](https://learn.microsoft.com/dotnet/standard/frameworks)
27+
`net11.0` is the target framework version currently under development and the new apis
28+
should be added to `net11.0`. [More Information on TargetFrameworks](https://learn.microsoft.com/dotnet/standard/frameworks)
2929

3030
## Making the changes in repo
3131

docs/coding-guidelines/project-guidelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Below is a list of all the various options we pivot the project builds on:
2525
## Individual build properties
2626
The following are the properties associated with each build pivot
2727

28-
- `$(BuildTargetFramework) -> Any .NETCoreApp or .NETFramework TFM, e.g. net10.0`
28+
- `$(BuildTargetFramework) -> Any .NETCoreApp or .NETFramework TFM, e.g. net11.0`
2929
- `$(TargetOS) -> windows | linux | osx | freebsd | ... | [defaults to running OS when empty]`
3030
- `$(Configuration) -> Debug | Release | [defaults to Debug when empty]`
3131
- `$(TargetArchitecture) - x86 | x64 | arm | arm64 | [defaults to x64 when empty]`
@@ -59,7 +59,7 @@ A cross-targeting project which targets specific platform with `$(NetCoreAppCurr
5959
A full or individual project build is centered around BuildTargetFramework, TargetOS, Configuration and TargetArchitecture.
6060

6161
1. `$(BuildTargetFramework), $(TargetOS), $(Configuration), $(TargetArchitecture)` can individually be passed in to change the default values.
62-
2. If nothing is passed to the build then we will default value of these properties from the environment. Example: `net10.0-[TargetOS Running On]-Debug-x64`.
62+
2. If nothing is passed to the build then we will default value of these properties from the environment. Example: `net11.0-[TargetOS Running On]-Debug-x64`.
6363
3. When building an individual project (either from the CLI or an IDE), all target frameworks are built.
6464

6565
Any of the mentioned properties can be set via `/p:<Property>=<Value>` at the command line. When building using any of the wrapper scripts around it (i.e. build.cmd) a number of these properties have aliases which make them easier to pass (run build.cmd/sh -? for the aliases).

docs/project/dogfooding.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ This is the default case for applications - running against an installed .NET ru
124124
```XML
125125
<PropertyGroup>
126126
<OutputType>Exe</OutputType>
127-
<!-- Ensure that the target framework is correct e.g. 'net10.0' -->
128-
<TargetFramework>net10.0</TargetFramework>
127+
<!-- Ensure that the target framework is correct e.g. 'net11.0' -->
128+
<TargetFramework>net11.0</TargetFramework>
129129
<!-- modify version in this line with one reported by `dotnet --info` under ".NET runtimes installed" -> Microsoft.NETCore.App -->
130130
<RuntimeFrameworkVersion>9.0.0-preview.5.22224.3</RuntimeFrameworkVersion>
131131
</PropertyGroup>
@@ -147,8 +147,8 @@ make it self-contained by adding a RuntimeIdentifier (RID).
147147
```XML
148148
<PropertyGroup>
149149
<OutputType>Exe</OutputType>
150-
<!-- Ensure that the target framework is correct e.g. 'net10.0' -->
151-
<TargetFramework>net10.0</TargetFramework>
150+
<!-- Ensure that the target framework is correct e.g. 'net11.0' -->
151+
<TargetFramework>net11.0</TargetFramework>
152152
<!-- modify build in this line with version reported by `dotnet --info` as above under ".NET runtimes installed" -> Microsoft.NETCore.App -->
153153
<!-- moreover, this can be any valid Microsoft.NETCore.App package version from https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json -->
154154
<RuntimeFrameworkVersion>9.0.0-preview.5.22224.3</RuntimeFrameworkVersion>
@@ -159,7 +159,7 @@ make it self-contained by adding a RuntimeIdentifier (RID).
159159
```
160160
$ dotnet restore
161161
$ dotnet publish
162-
$ bin\Debug\net10.0\win-x64\publish\App.exe
162+
$ bin\Debug\net11.0\win-x64\publish\App.exe
163163
```
164164

165165
### Daily builds table

docs/workflow/building/coreclr/nativeaot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The paths to major components can be overridden using `IlcToolsPath`, `IlcSdkPat
3333
Run `build[.cmd|.sh] -c Release` from the repo root to build the NativeAOT toolchain packages. The build will place the toolchain packages at `artifacts\packages\Release\Shipping`. To publish your project using these packages:
3434

3535
* Add the package directory to your `nuget.config` file. For example, add `<add key="local" value="C:\runtime\artifacts\packages\Release\Shipping" />`
36-
* Run `dotnet add package Microsoft.DotNet.ILCompiler -v 10.0.0-dev` to add the local package reference to your project.
36+
* Run `dotnet add package Microsoft.DotNet.ILCompiler -v 11.0.0-dev` to add the local package reference to your project.
3737
* Run `dotnet publish --packages pkg -r [win-x64|linux-x64|osx-64] -c [Debug|Release]` to publish your project. `--packages pkg` option restores the package into a local directory that is easy to cleanup once you are done. It avoids polluting the global nuget cache with your locally built dev package.
3838

3939
## High Level Overview

0 commit comments

Comments
 (0)