Skip to content

Commit 0b10860

Browse files
authored
Merge branch 'main' into fix/74020-jit-shift-opt
2 parents 4aa8c26 + 891c183 commit 0b10860

File tree

548 files changed

+7843
-21381
lines changed

Some content is hidden

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

548 files changed

+7843
-21381
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+
});

Build.proj

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
<Project Sdk="Microsoft.Build.Traversal">
22

33
<ItemGroup>
4-
<!-- Subsets are already imported by Directory.Build.props. -->
4+
<ProjectReference Include="$(RepoTasksDir)tasks.proj" BuildInParallel="false" />
5+
<!-- Subsets.props which defines @(ProjectToBuild) is already imported in Directory.Build.props. -->
56
<ProjectReference Include="@(ProjectToBuild)" />
6-
<!-- Only include tasks.proj during restore and build incrementally via a target. -->
7-
<ProjectReference Include="$(RepoTasksDir)tasks.proj" Condition="'$(MSBuildRestoreSessionId)' != ''" />
87
</ItemGroup>
98

109
<Import Project="$(RepositoryEngineeringDir)SubsetValidation.targets" />
1110
<Import Project="$(RepositoryEngineeringDir)restore\optimizationData.targets" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
1211

13-
<Target Name="BuildLocalTasks"
14-
BeforeTargets="Build">
15-
<MSBuild Projects="$(RepoTasksDir)tasks.proj"
16-
Targets="BuildIncrementally" />
17-
</Target>
18-
1912
<Target Name="SetupBootstrapLayout"
2013
AfterTargets="Build"
2114
Condition="'$(Subset)' == 'bootstrap'">
@@ -51,4 +44,5 @@
5144
SkipUnchangedFiles="true" />
5245
<Message Importance="high" Text="Bootstrap files copied to $(ArtifactsDir)bootstrap" />
5346
</Target>
47+
5448
</Project>

Directory.Build.props

Lines changed: 12 additions & 12 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">
@@ -132,8 +133,7 @@
132133
<MonoAOTCompilerDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</MonoAOTCompilerDir>
133134
<MonoTargetsTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoTargetsTasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</MonoTargetsTasksDir>
134135
<TestExclusionListTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'TestExclusionListTasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</TestExclusionListTasksDir>
135-
<InstallerTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'installer.tasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)', 'installer.tasks.dll'))</InstallerTasksAssemblyPath>
136-
<InstallerTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' != 'Core'">$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'installer.tasks', '$(TasksConfiguration)', '$(NetFrameworkToolCurrent)', 'installer.tasks.dll'))</InstallerTasksAssemblyPath>
136+
<InstallerTasksAssemblyPath>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'installer.tasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)', 'installer.tasks.dll'))</InstallerTasksAssemblyPath>
137137
<Crossgen2SdkOverridePropsPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'Crossgen2Tasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)', 'Microsoft.NET.CrossGen.props'))</Crossgen2SdkOverridePropsPath>
138138
<Crossgen2SdkOverrideTargetsPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'Crossgen2Tasks', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)', 'Microsoft.NET.CrossGen.targets'))</Crossgen2SdkOverrideTargetsPath>
139139
<AppleAppBuilderTasksAssemblyPath>$([MSBuild]::NormalizePath('$(AppleAppBuilderDir)', 'AppleAppBuilder.dll'))</AppleAppBuilderTasksAssemblyPath>
@@ -178,7 +178,7 @@
178178

179179
<PropertyGroup>
180180
<DotNetHostBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(TargetRid).$(HostConfiguration)', 'corehost'))</DotNetHostBinDir>
181-
<DotNetCdacBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'mscordaccore_universal', '$(Configuration)', '$(NetCoreAppCurrent)', '$(PortableTargetRid)', 'publish'))</DotNetCdacBinDir>
181+
<DotNetCdacBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'mscordaccore_universal', '$(Configuration)', '$(PortableTargetRid)', 'publish'))</DotNetCdacBinDir>
182182
</PropertyGroup>
183183

184184
<!--Feature switches -->

Directory.Build.targets

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
<Import Project="$(RepositoryEngineeringDir)packaging.targets" Condition="'$(IsPackable)' == 'true' and '$(MSBuildProjectExtension)' != '.pkgproj'" />
3232
<Import Project="$(RepositoryEngineeringDir)slngen.targets" Condition="'$(IsSlnGen)' == 'true'" />
3333

34+
<PropertyGroup>
35+
<NetCoreAppCurrentBuildSettings>$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)</NetCoreAppCurrentBuildSettings>
36+
<NativeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', '$(NetCoreAppCurrentBuildSettings)'))</NativeBinDir>
37+
<NetCoreAppCurrentTestHostPath Condition="'$(UseDefaultTestHost)' != 'true'">$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'testhost', '$(NetCoreAppCurrentBuildSettings)'))</NetCoreAppCurrentTestHostPath>
38+
<NetCoreAppCurrentTestHostSharedFrameworkPath Condition="'$(UseDefaultTestHost)' != 'true'">$([MSBuild]::NormalizeDirectory('$(NetCoreAppCurrentTestHostPath)', 'shared', '$(MicrosoftNetCoreAppFrameworkName)', '$(ProductVersion)'))</NetCoreAppCurrentTestHostSharedFrameworkPath>
39+
</PropertyGroup>
40+
3441
<!--
3542
When .NET gets built from source, make the SDK aware there are bootstrap packages
3643
for Microsoft.NETCore.App.Runtime.<rid> and Microsoft.NETCore.App.Crossgen2.<rid>.
@@ -209,4 +216,6 @@
209216
<Analyzer Remove="@(_targetingPackExcludedAnalyzerReferenceWithProjectName->Metadata('OriginalIdentity'))" />
210217
</ItemGroup>
211218
</Target>
219+
220+
<Import Project="$(RepositoryEngineeringDir)pruning.targets" />
212221
</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

0 commit comments

Comments
 (0)