WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit e13f79f

Browse files
Merge branch 'main' into fix/docs-lazycs-summary-111921
2 parents 6b00d93 + 3dde055 commit e13f79f

File tree

2,870 files changed

+21958
-19676
lines changed

Some content is hidden

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

2,870 files changed

+21958
-19676
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ In addition to the rules enforced by `.editorconfig`, you SHOULD:
2323
- When running tests, if possible use filters and check test run counts, or look at test logs, to ensure they actually ran.
2424
- Do not finish work with any tests commented out or disabled that were not previously commented out or disabled.
2525
- When writing tests, do not emit "Act", "Arrange" or "Assert" comments.
26+
- For markdown (`.md`) files, ensure there is no trailing whitespace at the end of any line.
2627

2728
---
2829

.github/workflows/backport.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ jobs:
4646
4747
**IMPORTANT**: If this backport is for a servicing release, please verify that:
4848
49-
- The PR target branch is `release/X.0-staging`, not `release/X.0`.
49+
- For .NET 8 and .NET 9: The PR target branch is `release/X.0-staging`, not `release/X.0`.
50+
- For .NET 10+: The PR target branch is `release/X.0` (no `-staging` suffix).
5051
5152
## Package authoring no longer needed in .NET 9
5253

.github/workflows/jit-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
os:
1616
- name: linux
1717
image: ubuntu-latest
18-
container: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-cross-amd64
18+
container: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0-cross-amd64
1919
extension: '.sh'
2020
cross: '--cross'
2121
rootfs: '/crossrootfs/x64'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ We welcome contributions! Many people all over the world have helped make this p
3737

3838
## Reporting security issues and security bugs
3939

40-
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) <secure@microsoft.com>. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue). You can also find these instructions in this repo's [Security doc](SECURITY.md).
40+
Security issues and bugs should be reported privately to the Microsoft Security Response Center (MSRC) via the [MSRC Researcher Portal](https://msrc.microsoft.com/report/vulnerability/new). You should receive a response within 24 hours. Further information can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue). You can also find these instructions in this repo's [Security doc](SECURITY.md).
4141

4242
Also see info about related [Microsoft .NET Bounty Program](https://www.microsoft.com/msrc/bounty-dot-net-core).
4343

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ The .NET Core and ASP.NET Core support policy, including supported versions can
66

77
## Reporting a Vulnerability
88

9-
Security issues and bugs should be reported privately to the Microsoft Security Response Center (MSRC), either by emailing [email protected] or via the portal at https://msrc.microsoft.com.
9+
Security issues and bugs should be reported privately to the Microsoft Security Response Center (MSRC), via the [MSRC Researcher Portal](https://msrc.microsoft.com/report/vulnerability/new).
1010
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your
11-
original message. Further information, including the MSRC PGP key, can be found in the [MSRC Report an Issue FAQ](https://www.microsoft.com/en-us/msrc/faqs-report-an-issue).
11+
original message. Further information can be found in the [MSRC Report an Issue FAQ](https://www.microsoft.com/en-us/msrc/faqs-report-an-issue).
1212

1313
Reports via MSRC may qualify for the .NET Core Bug Bounty. Details of the .NET Core Bug Bounty including terms and conditions are at [https://aka.ms/corebounty](https://aka.ms/corebounty).
1414

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,27 @@ should be added to `net10.0`. [More Information on TargetFrameworks](https://lea
4444

4545
New public APIs must be documented with triple-slash comments on top of them. Visual Studio automatically generates the structure for you when you type `///`.
4646

47+
[API writing guidelines](https://github.com/dotnet/dotnet-api-docs/wiki) has information about language and proper style for writing API documentation.
4748
If your new API or the APIs it calls throw any exceptions, those need to be manually documented by adding the `<exception></exception>` elements.
4849

49-
After your change is merged, we will eventually port them to the dotnet-api-docs repo, where we will review them for language and proper style (For more information, see the [API writing guidelines](https://github.com/dotnet/dotnet-api-docs/wiki)).
50+
After your change is merged, we will eventually port them to the [dotnet-api-docs](https://github.com/dotnet/dotnet-api-docs) repo. The tools used for this port live in [api-docs-sync](https://github.com/dotnet/api-docs-sync) repo. Once the dotnet-api-docs change
51+
is merged, your comments will start showing up in the official API documentation at https://learn.microsoft.com, and later they'll appear in IntelliSense
52+
in Visual Studio and Visual Studio Code.
5053

51-
Once the dotnet-api-docs change is merged, your comments will start showing up in the official API documentation at https://learn.microsoft.com, and later they'll appear in IntelliSense in Visual Studio and Visual Studio Code.
52-
Once the documentation is official, any subsequent updates to it must be made directly in https://github.com/dotnet/dotnet-api-docs/. It's fine to make updates to the triple slash comments later, they just won't automatically flow into the official docs.
54+
The rest of the documentation workflow depends on whether the assembly has the `UseCompilerGeneratedDocXmlFile` property set in its project file:
55+
56+
**For libraries without this property (or with it set to `true`, which is the default):**
57+
- Source comments in this repo are the source of truth for documentation.
58+
- Triple-slash comments in source code are synced to dotnet-api-docs periodically (every preview).
59+
- More recently introduced libraries typically follow this workflow.
60+
61+
**For libraries with `<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>`:**
62+
- The [dotnet-api-docs](https://github.com/dotnet/dotnet-api-docs) repo is the source of truth for documentation.
63+
- Triple-slash comments in source code are synced to dotnet-api-docs **only once** for newly introduced APIs. After the initial sync, all subsequent documentation
64+
updates must be made directly in the dotnet-api-docs repo.
65+
- It's fine to make updates to the triple-slash comments later to aid local development, they just won't automatically flow into the official docs. Copilot can help with porting small changes
66+
in triple-slash comments to dotnet-api-docs. [PortToDocs](https://github.com/dotnet/api-docs-sync/blob/main/docs/PortToDocs.md) tool works better for ports of large changes.
67+
- Older libraries typically follow this workflow. Libraries in this mode can work towards a better workflow in the future by using api-docs-sync tools to port back docs to source, then removing the `UseCompilerGeneratedDocXmlFile` property.
5368

5469
## FAQ
5570

docs/coding-guidelines/project-guidelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ The `UseCompilerGeneratedDocXmlFile` property controls how XML documentation fil
192192
</PropertyGroup>
193193
```
194194

195-
Setting `UseCompilerGeneratedDocXmlFile` to `false` is typically done for stable APIs where manually curated documentation exists that should be preferred over compiler-generated documentation.
195+
See the [Documentation](adding-api-guidelines.md#documentation) section in the API guidelines for more details about the documentation workflow.
196196

197197
If a project sets this to `false` but the Microsoft.Private.Intellisense package doesn't have documentation for the assembly, a warning is shown suggesting to remove the property to let the compiler generate the file.
198198

docs/design/coreclr/botr/readytorun-format.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ The COR header and ECMA 335 metadata pointed to by the COM descriptor data direc
3030
in the COFF header represent a full copy of the input IL and MSIL metadata it was generated from.
3131

3232
**Composite R2R files** currently conform to Windows PE executable file format as the
33-
native envelope. Moving forward we plan to gradually add support for platform-native
34-
executable formats (ELF on Linux, MachO on OSX) as the native envelopes. There is a
33+
native envelope. Moving forward we [plan to gradually add support for platform-native
34+
executable formats](./readytorun-platform-native-envelope.md) (ELF on Linux, MachO on OSX) as the native envelopes. There is a
3535
global CLI / COR header in the file, but it only exists to facilitate pdb generation, and does
3636
not participate in any usages by the CoreCLR runtime. The ReadyToRun header structure is pointed to
3737
by the well-known export symbol `RTR_HEADER` and has the `READYTORUN_FLAG_COMPOSITE` flag set.

docs/design/coreclr/botr/readytorun-overview.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Some of this information can be omitted or stored in more efficient form, e.g.:
6060
- The garbage collection information can be omitted for environments with conservative garbage collection, such as IL2CPP.
6161
- The full metadata information is not strictly required for 'private' methods or types so it is possible to strip it from the CLI image.
6262
- The metadata can be stored in more efficient form, such as the .NET Native metadata format.
63-
- The platform native executable format (ELF, Mach-O) can be used as envelope instead of PE to take advantage of platform OS loader.
63+
- As of .NET 10, the PE format is used on all platforms. A [future improvement](#platform-native-envelope-support) could be support for the platform native executable format (ELF, Mach-O) to take advantage of platform OS loader.
6464

6565

6666
## Definition of Version Compatibility for Native Code
@@ -332,4 +332,8 @@ Another important observation is that `MethodTable` contains other very frequent
332332

333333
# Current State
334334

335-
The design and implementation is a work in progress under code name ReadyToRun (`FEATURE_READYTORUN`). RyuJIT is used as the code generator to produce the ReadyToRun images currently.
335+
As of .NET 6, the .NET SDK can publish applications as ReadyToRun using the `crossgen2` tool. The tool lives under `src/coreclr/aot/crossgen2`. Support in the coreclr runtime is under `FEATURE_READYTORUN`. RyuJIT is used as the code generator to produce the ReadyToRun images currently.
336+
337+
## Platform-Native Envelope Support
338+
339+
Through .NET 10, ReadyToRun uses the PE format on all platforms. In .NET 11, we plan to start adding support for other formats, with Mach-O being the first target. For more details, see [ReadyToRun Platform-Native Envelope](./readytorun-platform-native-envelope.md).
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# ReadyToRun Platform Native Envelope
2+
3+
Up through .NET 10, ReadyToRun (R2R) uses the Windows PE format as the native envelope on every platform. Non‑Windows platforms therefore load a PE file with the .NET loader performing the required fixups and code activation.
4+
5+
In .NET 11, we plan to start adding support beyond the PE format. We will target support for:
6+
- Composite R2R only
7+
- Mach-O object files emitted by `crossgen2`
8+
- Runtime using a composite R2R image that is a Mach-O shared library
9+
- Linking the object files into a shared library is expected to be handled by the SDK and is not covered in this document.
10+
11+
The tentative high-level design is outlined below. As we implement this support, this document should be updated with more details and the [ReadyToRun overview](./readytorun-overview.md) and [ReadyToRun format](./readytorun-format.md) should be updated to reflect the changes.
12+
13+
## crossgen2: producing Mach-O object files
14+
15+
Mach‑O support will only be supported for composite ReadyToRun when the target OS is macOS. It will be opt-in via a new `crossgen2` flag:
16+
- `--obj-format macho`
17+
18+
`crossgen2` will:
19+
- Produce a Mach-O object file as the composite R2R image with the `RTR_HEADER` export for the `READYTORUN_HEADER`.
20+
- Mark each input IL assembly as a component R2R assembly: `READYTORUN_FLAG_COMPONENT`.
21+
- Mark each input IL assembly with a new flag indicating that the associated composite image is in the platform-native format: `READYTORUN_FLAG_PLATFORM_NATIVE_IMAGE`
22+
23+
`crossgen2` does not produce the final shared library. A separate SDK / build linking step must preserve the `RTR_HEADER` export in the final `dylib`.
24+
25+
## Runtime: consuming a platform-native R2R image
26+
27+
The runtime will be updated to handle platform-native R2R images during assembly load.
28+
29+
1. Load IL assembly and determine if it is a R2R assembly.
30+
2. If it is not a component R2R assembly, proceed with existing R2R load logic.
31+
- We will not have platform-native support for this scenario
32+
3. If it is a component R2R assembly with the new `READYTORUN_FLAG_PLATFORM_NATIVE_IMAGE` flag set:
33+
a. Read `OwnerCompositeExecutable` value.
34+
b. Invoke host callback with component assembly path and owner composite name.
35+
c. On success, obtain pointer to composite `READYTORUN_HEADER` and use it for native method lookup / fixups.
36+
d. On failure, fall back to IL/JIT path.
37+
4. If the platform-native flag is not set, proceed with existing R2R load logic (PE assembly lookup and load).
38+
39+
### Host callback
40+
41+
The [`host_runtime_contract`](/src/native/corehost/host_runtime_contract.h) will be updated with a new callback for getting native code information.
42+
43+
```c
44+
struct native_code_context
45+
{
46+
size_t size; // size of this struct
47+
const char* assembly_path; // component assembly path
48+
const char* owner_composite_name; // name from component R2R header
49+
};
50+
51+
struct native_code_data
52+
{
53+
size_t size; // size of this struct
54+
void* r2r_header_ptr; // ReadyToRun header
55+
size_t image_size; // size of the image
56+
void* image_base; // base address where the image was loaded
57+
};
58+
59+
bool get_native_code_data(
60+
const struct native_code_context* context,
61+
/*out*/ struct native_code_data* data
62+
);
63+
```
64+
65+
This leaves it to the host to do the actual load (for example, `dlopen` of a shared library, using something statically linked into the host itself) of the platform-native image. It is also responsible for any caching desired.

0 commit comments

Comments
 (0)