Skip to content

Extract and share generated COM stubs for IActivationFactory / ActivationFactory in PR #128214#128265

Closed
Copilot wants to merge 1 commit into
mainfrom
copilot/pr-128214-add-generated-code-comment
Closed

Extract and share generated COM stubs for IActivationFactory / ActivationFactory in PR #128214#128265
Copilot wants to merge 1 commit into
mainfrom
copilot/pr-128214-add-generated-code-comment

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

This updates the PR with the exact source-generator output for the new GeneratedComInterface/GeneratedComClass test types added in #128214.
Specifically, it captures and publishes the emitted code for IActivationFactory and ActivationFactory from ComInterfaceGenerator.Tests with compiler-generated file emission enabled.

  • What was added

    • Built src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/ComInterfaceGenerator.Tests.csproj with:
      • EmitCompilerGeneratedFiles=true
      • InteropCompilerGeneratedFilesOutputPath=/tmp/pr128214-generated
    • Extracted generated files:
      • .../ComInterfaceGenerator.Tests.IActivationFactory.cs
      • .../ComInterfaceGenerator.Tests.ActivationFactory.cs
    • Prepared PR comment content containing both files in fenced csharp blocks, labeled by file/type.
  • Generated output excerpt

[global::System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(
    CallConvs = new[] { typeof(global::System.Runtime.CompilerServices.CallConvMemberFunction) })]
internal static int ABI_GetActivationFactory(
    global::System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch* __this_native,
    global::System.Guid* __iid_native__param,
    void** __factory_native__param)
{
    // ...
    int __factory_native__queryInterfaceHResult =
        global::System.Runtime.InteropServices.Marshal.QueryInterface(
            (global::System.IntPtr)__factory_native__unknown, in iid, out __factory_native__queriedInterface);
    // ...
}
Original prompt

The user wants to build the relevant unit test project for PR #128214 with EmitCompilerGeneratedFiles=true, extract the generated source for the IActivationFactory and ActivationFactory types, and add that generated code as a comment on the PR.

Context:

  • Repository: dotnet/runtime
  • PR: Honor MarshalAs.IidParameterIndex for out object in source-generated COM stubs #128214, titled "Honor MarshalAs.IidParameterIndex for out object in source-generated COM stubs"
  • The relevant changed test code appears in src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/GeneratedComClassTests.cs and defines:
    • [GeneratedComInterface] partial interface IActivationFactory
    • [GeneratedComClass] partial class ActivationFactory : IActivationFactory
  • Build the appropriate test project with /p:EmitCompilerGeneratedFiles=true (likely src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/ComInterfaceGenerator.Tests.csproj; if generation for the compile-only unit test source is needed, also inspect/build src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/ComInterfaceGenerator.Unit.Tests.csproj).
  • Locate generated compiler files under the relevant obj/.../generated output and identify generated code corresponding to IActivationFactory and ActivationFactory.
  • Post a PR comment on Honor MarshalAs.IidParameterIndex for out object in source-generated COM stubs #128214 containing the generated code in fenced csharp blocks, clearly labeled by type/file.

Do not make source changes unless required to complete the task. If no source changes are needed, report the generated code/comment result.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Can you build the unit tests project with EmitCompilerGeneratedFiles=true and copy the generated code for the IActivationFactory and ActivationFactory types to a comment on this PR?

Assistant: I can’t directly run the build or post a PR comment from here because I don’t have a shell/build runner or a PR-comment write tool available in this session.

You can run this locally from the repo root:

dotnet build src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/ComInterfaceGenerator.Tests.csproj \
  /p:EmitCompilerGeneratedFiles=true

If you specifically meant the source-generator unit test project:

dotnet build src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/ComInterfaceGenerator.Unit.Tests.csproj \
  /p:EmitCompilerGeneratedFiles=true

Then look under the project’s obj directory for generated files, usually something like:

src/libraries/System.Runtime.InteropServices/tests/<project>/obj/<Configuration>/<TFM>/generated/

Search for:

find src/libraries/System.Runtime.InteropServices/tests -path '*generated*' \
  \( -name '*IActivationFactory*' -o -name '*ActivationFactory*' -o -name '*.cs' \) \
  -print

For PR comment text, I’d suggest:

Built the relevant test project with:

```bash
dotnet build src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/ComInterfaceGenerator.Tests.csproj /p:EmitCompilerGeneratedFiles=true
```

Generated code for `IActivationFactory` / `ActivationFactory`:

```csharp
// paste generated code here
```

If you paste the generated files here, I can format the exact PR comment for you.

User: Now you should be able to

Assistant: I’ve started the requested repository task: build the test project with EmitCompilerGeneratedFiles=true, extract the generated IActivationFactory / ActivationFactory code, and post it as a comment on #128214.

This pull request was created from Copilot chat.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copilot AI changed the title [WIP] Add generated code for IActivationFactory and ActivationFactory Extract and share generated COM stubs for IActivationFactory / ActivationFactory in PR #128214 May 15, 2026
Copilot AI requested a review from jtschuster May 15, 2026 18:58
@jtschuster jtschuster closed this May 15, 2026
Copilot stopped work on behalf of jtschuster due to an error May 15, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants