Skip to content

Commit 0aa6fcf

Browse files
authored
Merge branch 'copilot/refactor-startcore-method-arguments' into copilot/add-standard-input-output-properties
2 parents c8b8723 + 4199424 commit 0aa6fcf

574 files changed

Lines changed: 19596 additions & 5997 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.

.github/copilot-instructions.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ When NOT running under CCA, guidance for creating commits and pushing changes:
4646
- Never push to an active PR without being explicitly asked, even in autopilot/yolo mode. Always wait for explicit instruction to push.
4747
- 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.
4848
- 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+
- **Before posting to GitHub (PRs, issues, comments):** Include the AI-generated content disclosure (see below).
50+
51+
## AI-Generated Content Disclosure
52+
53+
When posting any content to GitHub under a user's credentials — opening PRs, creating issues, commenting on PRs or issues, posting review comments, or any other public-facing action — and the account is **not** a dedicated "copilot" or "bot" account/app, you **MUST** include a concise, visible note (e.g. a `> [!NOTE]` alert) indicating the content was AI/Copilot-generated.
54+
55+
This applies to all GitHub interactions: PR descriptions, issue bodies, comments, review comments, etc. Exceptions:
56+
- The account is a recognized bot or Copilot app account (e.g., `github-actions[bot]`, `copilot`), where the AI origin is already apparent from the account identity.
57+
- The user explicitly asks you to omit the disclosure.
4958

5059
---
5160

.github/skills/api-proposal/SKILL.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,7 @@ Present the complete draft to the user for review. Iterate based on feedback bef
270270

271271
### Phase 5: Publish
272272

273-
> **Agent disclaimer:** When publishing to GitHub on behalf of a user account, prepend the following disclaimer to the proposal body:
274-
>
275-
> ```markdown
276-
> > [!NOTE]
277-
> > This proposal was drafted with the help of an AI agent. Please review for accuracy and remove this notice once you're satisfied with the content.
278-
> ```
273+
> **AI-generated content disclosure:** When posting any content to GitHub (issue body, PR body, comments) under a user's credentials — i.e., the account is **not** a dedicated "copilot" or "bot" account/app — prepend a concise, visible note (e.g. a `> [!NOTE]` alert) indicating the content was AI/Copilot-generated. This applies to the initial proposal, iteration updates, and any follow-up comments posted on the user's behalf. Skip this if the user explicitly asks you to omit it.
279274
280275
#### Step 1: Push and capture commit URL
281276

.github/skills/ci-analysis/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Analyze CI build status and test failures in Azure DevOps and Helix for dotnet r
99

1010
> 🚨 **NEVER** use `gh pr review --approve` or `--request-changes`. Only `--comment` is allowed. Approval and blocking are human-only actions.
1111
12+
> 📝 **AI-generated content disclosure:** When posting any content to GitHub (PR comments, retry commands, analysis summaries) under a user's credentials — i.e., the account is **not** a dedicated "copilot" or "bot" account/app — you **MUST** include a concise, visible note (e.g. a `> [!NOTE]` alert) indicating the content was AI/Copilot-generated. Skip this if the user explicitly asks you to omit it.
13+
1214
**Workflow**: Gather PR context (Step 0) → run the script → read the human-readable output + `[CI_ANALYSIS_SUMMARY]` JSON → synthesize recommendations yourself. The script collects data; you generate the advice. For supplementary investigation beyond the script, MCP tools (AzDO, Helix, GitHub) provide structured access when available; the script and `gh` CLI work independently when they're not.
1315

1416
## When to Use This Skill

.github/skills/code-review/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ When the environment supports launching sub-agents with different models (e.g.,
9898

9999
When presenting the final review (whether as a PR comment or as output to the user), use the following structure. This ensures consistency across reviews and makes the output easy to scan.
100100

101+
> 📝 **AI-generated content disclosure:** When posting review content to GitHub (PR review comments, PR comments) under a user's credentials — i.e., the account is **not** a dedicated "copilot" or "bot" account/app — you **MUST** include a concise, visible note (e.g. a `> [!NOTE]` alert) indicating the content was AI/Copilot-generated. Skip this if the user explicitly asks you to omit it.
102+
101103
### Structure
102104

103105
```

.github/skills/issue-triage/SKILL.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,12 @@ Key points:
461461
with these explicit instructions; the constraint above prevents *autonomous*
462462
actions before the human decision, not user-directed actions after it.
463463

464+
When posting any content to GitHub (issue comments, label changes with explanations)
465+
under a user's credentials -- i.e., the account is **not** a dedicated "copilot"
466+
or "bot" account/app -- you **MUST** include a concise, visible note (e.g. a
467+
`> [!NOTE]` alert) indicating the content was AI/Copilot-generated. Skip this if
468+
the user explicitly asks you to omit it.
469+
464470
- **NEVER** use `gh issue close`, `gh issue edit`, `gh issue comment`, or
465471
`gh pr review --approve`/`--request-changes` **unless the user explicitly
466472
asks you to** after picking an outcome.

.github/skills/performance-benchmark/SKILL.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,17 @@ public class Bench
125125

126126
Post a comment on the PR to trigger EgorBot with your benchmark. The general format is:
127127

128+
> 📝 **AI-generated content disclosure:** When posting benchmark comments to GitHub under a user's credentials — i.e., the account is **not** a dedicated "copilot" or "bot" account/app — you **MUST** include a concise, visible note (e.g. a `> [!NOTE]` alert) indicating the content was AI/Copilot-generated. Skip this if the user explicitly asks you to omit it.
129+
128130
@EgorBot [targets] [options] [BenchmarkDotNet args]
129131

130132
```cs
131133
// Your benchmark code here
132134
```
133-
> **Note:** The @EgorBot command must not be inside the code block. Only the benchmark code should be inside the code block.
135+
> **Note:** When using @EgorBot, follow these formatting rules:
136+
> - The @EgorBot command must not be inside the code block.
137+
> - Only the benchmark code should be inside the code block.
138+
> - Do not place any additional text between the @EgorBot command line and the code block, as EgorBot will treat it as additional command arguments.
134139
135140
### Target Flags
136141

.github/skills/vmr-codeflow-status/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Analyze the health of VMR codeflow PRs in both directions:
1111

1212
> 🚨 **NEVER** use `gh pr review --approve` or `--request-changes`. Only `--comment` is allowed. Approval and blocking are human-only actions.
1313
14+
> 📝 **AI-generated content disclosure:** When posting any content to GitHub (PR comments, analysis summaries) under a user's credentials — i.e., the account is **not** a dedicated "copilot" or "bot" account/app — you **MUST** include a concise, visible note (e.g. a `> [!NOTE]` alert) indicating the content was AI/Copilot-generated. Skip this if the user explicitly asks you to omit it.
15+
1416
**Workflow**: Run the script → read the human-readable output + `[CODEFLOW_SUMMARY]` JSON → synthesize recommendations yourself. The script collects data; you generate the advice.
1517

1618
## Prerequisites

docs/design/datacontracts/BuiltInCOM.md

Lines changed: 71 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ public struct COMInterfacePointerData
1313
public TargetPointer MethodTable;
1414
}
1515

16+
public struct SimpleComCallWrapperData
17+
{
18+
public ulong RefCount;
19+
public bool IsNeutered;
20+
public bool IsAggregated;
21+
public bool IsExtendsCOMObject;
22+
public bool IsHandleWeak;
23+
public TargetPointer OuterIUnknown;
24+
}
25+
1626
public record struct RCWCleanupInfo(
1727
TargetPointer RCW,
1828
TargetPointer Context,
@@ -32,15 +42,20 @@ public record struct RCWData(
3242
bool IsFreeThreaded,
3343
bool IsDisconnected);
3444

35-
public ulong GetRefCount(TargetPointer ccw);
36-
// Check whether the COM wrappers handle is weak.
37-
public bool IsHandleWeak(TargetPointer ccw);
3845
// Resolves a COM interface pointer to the ComCallWrapper.
3946
// Returns TargetPointer.Null if interfacePointer is not a recognised COM interface pointer.
47+
// Use GetStartWrapper on the result to navigate to the start of the chain.
4048
public TargetPointer GetCCWFromInterfacePointer(TargetPointer interfacePointer);
41-
// Enumerate the COM interfaces exposed by the ComCallWrapper chain.
49+
// Enumerates COM interfaces exposed by the ComCallWrapper chain.
4250
// ccw may be any ComCallWrapper in the chain; the implementation navigates to the start.
4351
public IEnumerable<COMInterfacePointerData> GetCCWInterfaces(TargetPointer ccw);
52+
// Returns the GC object handle from the given ComCallWrapper.
53+
public TargetPointer GetObjectHandle(TargetPointer ccw);
54+
// Returns the data stored in the SimpleComCallWrapper associated with the given ComCallWrapper.
55+
public SimpleComCallWrapperData GetSimpleComCallWrapperData(TargetPointer ccw);
56+
// Navigates to the start ComCallWrapper in a linked chain.
57+
// If ccw is already the start wrapper (or the only wrapper), returns ccw unchanged.
58+
public TargetPointer GetStartWrapper(TargetPointer ccw);
4459
// Enumerate entries in the RCW cleanup list.
4560
// If cleanupListPtr is Null, the global g_pRCWCleanupList is used.
4661
public IEnumerable<RCWCleanupInfo> GetRCWCleanupList(TargetPointer cleanupListPtr);
@@ -57,13 +72,15 @@ public RCWData GetRCWData(TargetPointer rcw);
5772
Data descriptors used:
5873
| Data Descriptor Name | Field | Meaning |
5974
| --- | --- | --- |
75+
| `ComCallWrapper` | `Handle` | GC object handle (`m_ppThis`); dereference to get the managed object pointer |
6076
| `ComCallWrapper` | `SimpleWrapper` | Address of the associated `SimpleComCallWrapper` |
6177
| `ComCallWrapper` | `IPtr` | Base address of the COM interface pointer array |
6278
| `ComCallWrapper` | `Next` | Next wrapper in the linked chain (all-bits-set sentinel = end of list) |
6379
| `ComMethodTable` | `Flags` | Flags word; bit `0x10` (`LayoutComplete`) must be set for valid vtable |
6480
| `ComMethodTable` | `MethodTable` | Pointer to the managed `MethodTable` for this COM interface |
65-
| `SimpleComCallWrapper` | `RefCount` | The wrapper refcount value |
66-
| `SimpleComCallWrapper` | `Flags` | Bit flags for wrapper properties |
81+
| `SimpleComCallWrapper` | `OuterIUnknown` | Outer `IUnknown` pointer for aggregated CCWs (`m_pOuter`) |
82+
| `SimpleComCallWrapper` | `RefCount` | The wrapper refcount value (includes `CLEANUP_SENTINEL` bit) |
83+
| `SimpleComCallWrapper` | `Flags` | Bit flags for wrapper properties (aggregated, extends-COM, handle-weak, etc.) |
6784
| `SimpleComCallWrapper` | `MainWrapper` | Pointer back to the first (start) `ComCallWrapper` in the chain |
6885
| `SimpleComCallWrapper` | `VTablePtr` | Base address of the standard interface vtable pointer array (used for SCCW IP resolution) |
6986
| `RCWCleanupList` | `FirstBucket` | Head of the bucket linked list |
@@ -87,7 +104,6 @@ Data descriptors used:
87104
Global variables used:
88105
| Global Name | Type | Purpose |
89106
| --- | --- | --- |
90-
| `ComRefcountMask` | `long` | Mask applied to `SimpleComCallWrapper.RefCount` to produce the visible refcount |
91107
| `CCWNumInterfaces` | `uint` | Number of vtable pointer slots in each `ComCallWrapper` (`NumVtablePtrs = 5`) |
92108
| `CCWThisMask` | `nuint` | Alignment mask applied to a standard CCW IP to recover the `ComCallWrapper` pointer |
93109
| `TearOffAddRef` | pointer | Address of `Unknown_AddRef`; identifies standard CCW interface pointers |
@@ -108,16 +124,26 @@ Contracts used:
108124

109125
``` csharp
110126

111-
private enum CCWFlags
127+
// Mirrors enum SimpleComCallWrapperFlags in src/coreclr/vm/comcallablewrapper.h
128+
private enum SimpleComCallWrapperFlags : uint
112129
{
113-
IsHandleWeak = 0x4,
130+
IsAggregated = 0x1,
131+
IsExtendsCom = 0x2,
132+
IsHandleWeak = 0x4,
114133
}
115-
134+
// Mirrors enum Masks in src/coreclr/vm/comcallablewrapper.h
116135
private enum ComMethodTableFlags : ulong
117136
{
118137
LayoutComplete = 0x10,
119138
}
120139

140+
[Flags]
141+
private enum ComRefCount : long
142+
{
143+
ComRefCountMask = 0x000000007FFFFFFFL,
144+
CleanupSentinel = 0x80000000L,
145+
}
146+
121147
[Flags]
122148
private enum RCWFlags : uint
123149
{
@@ -127,21 +153,6 @@ private enum RCWFlags : uint
127153
MarshalingTypeFreeThreaded = 0x100u,
128154
}
129155

130-
public ulong GetRefCount(TargetPointer address)
131-
{
132-
var ccw = _target.ReadPointer(address + /* ComCallWrapper::SimpleWrapper offset */);
133-
ulong refCount = _target.Read<ulong>(ccw + /* SimpleComCallWrapper::RefCount offset */);
134-
long refCountMask = _target.ReadGlobal<long>("ComRefcountMask");
135-
return refCount & (ulong)refCountMask;
136-
}
137-
138-
public bool IsHandleWeak(TargetPointer address)
139-
{
140-
var ccw = _target.ReadPointer(address + /* ComCallWrapper::SimpleWrapper offset */);
141-
uint flags = _target.Read<uint>(ccw + /* SimpleComCallWrapper::Flags offset */);
142-
return (flags & (uint)CCWFlags.IsHandleWeak) != 0;
143-
}
144-
145156
// See ClrDataAccess::DACGetCCWFromAddress in src/coreclr/debug/daccess/request.cpp.
146157
// Resolves a COM interface pointer to the ComCallWrapper.
147158
// Returns TargetPointer.Null if interfacePointer is not a recognised COM IP.
@@ -158,6 +169,41 @@ public IEnumerable<COMInterfacePointerData> GetCCWInterfaces(TargetPointer ccw)
158169
// - slot 0 of the first wrapper (IUnknown/IDispatch) yields null MethodTable
159170
}
160171

172+
// Returns the GC object handle from the given ComCallWrapper.
173+
public TargetPointer GetObjectHandle(TargetPointer ccw)
174+
=> _target.ReadPointer(ccw + /* ComCallWrapper::Handle offset */);
175+
176+
// Returns data from the SimpleComCallWrapper associated with the given ComCallWrapper.
177+
// Applies ComRefCountMask to produce the visible RefCount and checks CLEANUP_SENTINEL for IsNeutered.
178+
public SimpleComCallWrapperData GetSimpleComCallWrapperData(TargetPointer ccw)
179+
{
180+
TargetPointer sccw = _target.ReadPointer(ccw + /* ComCallWrapper::SimpleWrapper offset */);
181+
ulong rawRefCount = _target.Read<ulong>(sccw + /* SimpleComCallWrapper::RefCount offset */);
182+
uint flags = _target.Read<uint>(sccw + /* SimpleComCallWrapper::Flags offset */);
183+
return new SimpleComCallWrapperData
184+
{
185+
RefCount = rawRefCount & ComRefCount.ComRefCountMask,
186+
IsNeutered = (rawRefCount & ComRefCount.CleanupSentinel) != 0,
187+
IsAggregated = (flags & (uint)SimpleComCallWrapperFlags.IsAggregated) != 0,
188+
IsExtendsCOMObject = (flags & (uint)SimpleComCallWrapperFlags.IsExtendsCom) != 0,
189+
IsHandleWeak = (flags & (uint)SimpleComCallWrapperFlags.IsHandleWeak) != 0,
190+
OuterIUnknown = _target.ReadPointer(sccw + /* SimpleComCallWrapper::OuterIUnknown offset */),
191+
};
192+
}
193+
194+
// Navigates to the start ComCallWrapper in a linked chain.
195+
// If ccw is already the start wrapper (or the only wrapper), returns ccw unchanged.
196+
public TargetPointer GetStartWrapper(TargetPointer ccw)
197+
{
198+
TargetPointer next = _target.ReadPointer(ccw + /* ComCallWrapper::Next offset */);
199+
if (next != Null)
200+
{
201+
TargetPointer sccw = _target.ReadPointer(ccw + /* ComCallWrapper::SimpleWrapper offset */);
202+
ccw = _target.ReadPointer(sccw + /* SimpleComCallWrapper::MainWrapper offset */);
203+
}
204+
return ccw;
205+
}
206+
161207
public IEnumerable<RCWCleanupInfo> GetRCWCleanupList(TargetPointer cleanupListPtr)
162208
{
163209
// Resolve the cleanup list address.

0 commit comments

Comments
 (0)