Skip to content

Conversation

@Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Dec 4, 2025

Copilot AI review requested due to automatic review settings December 4, 2025 11:13
@Youssef1313 Youssef1313 requested a review from a team as a code owner December 4, 2025 11:13
@dotnetrepoman dotnetrepoman bot added this to the December 2025 milestone Dec 4, 2025
- Apply a workaround similar to the following:

```xml
<Target Name="WorkaroundMacOSDumpIssue" AfterTargets="Build" Condition="$([MSBuild]::IsOSPlatform('OSX')) AND '$(UseAppHost)' != 'false' AND '$(OutputType)' == 'Exe' AND '$(TargetFramework)' != '' AND '$(RunCommand)' != '' AND '$(RunCommand)' != 'dotnet'" AND '$(IsTestingPlatformApplication)'=='true'>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JanKrivanek @YuliiaKovalova @rainersigwald Please review this from build incrementality point of view. Can this cause issues for incremental builds?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR documents known issues with generating hang dumps on macOS in the Microsoft Testing Platform Extensions documentation. The content addresses authentication popup issues that prevent dump generation in CI environments and provides two workarounds.

Key Changes

  • Added a "Considerations for macOS" section explaining dump generation authentication issues
  • Provided two workaround options: disabling UseAppHost or applying code signing with entitlements
  • Included complete MSBuild target and plist configuration examples

Comment on lines 75 to 76
- Set `UseAppHost` MSBuild property to false, which will cause the managed assembly to run under `dotnet` instead of the apphost executable. However, this doesn't work for xunit.v3. See [xunit/xunit#3432 GitHub issues](https://github.com/xunit/xunit/issues/3432).
- Apply a workaround similar to the following:
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list items need periods at the end since they contain complete sentences with more than three words. Both bullet points should end with a period according to the Markdown style guidelines.

Copilot generated this review using guidance from repository custom instructions.
Taking dumps when running on macOS can be problematic. If you found that a dump has started to be taken, but never finishes, in CI environments where you don't have direct access to the machine, this most likely means that macOS showed a popup asking for authentication and is waiting for you to type password, which is not feasible to do in such environments. The issue might also manifest as an error similar to the following:

```output
[createdump] This failure may be because createdump or the application is not properly signed and entitled.
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Oxford comma in the list. Change "signed and entitled" to "signed, and entitled" according to the mandatory Oxford comma rule in the Markdown style guidelines.

Copilot generated this review using guidance from repository custom instructions.
</plist>
```

The MSBuild target above can be placed in Directory.Build.targets so that it applies to all projects.
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence "The MSBuild target above can be placed in Directory.Build.targets so that it applies to all projects." is more than three words and should end with a period according to the Markdown style guidelines.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +91 to +101
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggested entitlements in mtp-test-entitlements.plist (com.apple.security.get-task-allow, com.apple.security.cs.debugger, com.apple.security.cs.disable-library-validation, com.apple.security.cs.allow-dyld-environment-variables, com.apple.security.cs.allow-jit) significantly weaken macOS code signing protections; if applied broadly (as later suggested via Directory.Build.targets), this can enable debugging and task access on production binaries, facilitating code injection and tampering. An attacker or unprivileged process could leverage these entitlements to attach, modify, or bypass library validation in production environments. Limit this workaround strictly to test/debug builds (e.g., add Condition="'$(Configuration)' == 'Debug' AND '$(IsTestingPlatformApplication)'=='true'"), avoid com.apple.security.get-task-allow and com.apple.security.cs.debugger for any release builds, and ensure it is not placed in Directory.Build.targets for projects that produce deployable artifacts.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blowdart Please take a look. The condition IsTestingPlatformApplication should limit the workaround only to test applications. Is there any security considerations to document more clearly here?

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Youssef1313 Youssef1313 requested a review from blowdart December 4, 2025 11:21
To work around this, there are two options:

- Set `UseAppHost` MSBuild property to false, which will cause the managed assembly to run under `dotnet` instead of the apphost executable. However, this doesn't work for xunit.v3. See [xunit/xunit#3432 GitHub issue](https://github.com/xunit/xunit/issues/3432).
- Apply a workaround similar to the following:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be a simpler workaround to force UseAppHost=false (e.g. by passing it to msbuild as /p:UseAppHost=false) so that the xunit block does not kick in? Or is there something that actually does not work in xunit3 + MTP without apphost?

Copy link
Member Author

@Youssef1313 Youssef1313 Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you pass /p:UseAppHost=false on the command line, they cannot override it - the line in xunit targets that sets it to true is going to be ignored,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas xunit doesn't set it to true, they produce an error when it's set to false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants