Skip to content

Cleanup CurrentTestApplicationModuleInfo#7693

Merged
Youssef1313 merged 1 commit intomainfrom
dev/ygerges/cleanup
Apr 9, 2026
Merged

Cleanup CurrentTestApplicationModuleInfo#7693
Youssef1313 merged 1 commit intomainfrom
dev/ygerges/cleanup

Conversation

@Youssef1313
Copy link
Copy Markdown
Member

@Youssef1313 Youssef1313 commented Apr 8, 2026

  • Remove the unneeded isMonoMuxer local variable. The fallback already returns commandLineArguments so there is no need to special case mono per the existing logic.
  • Adds a TODO for an existing suspicious code.

Copilot AI review requested due to automatic review settings April 8, 2026 15:21
Copy link
Copy Markdown
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 cleans up CurrentTestApplicationModuleInfo in Microsoft.Testing.Platform by simplifying argument selection logic and calling out suspicious executable-detection behavior.

Changes:

  • Removes the redundant isMonoMuxer local/switch arm in GetCurrentExecutableInfo.
  • Adds a TODO noting suspicious logic in IsCurrentTestApplicationModuleExecutable.

Copy link
Copy Markdown
Member

@Evangelink Evangelink left a comment

Choose a reason for hiding this comment

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

Review Summary

Thanks for the cleanup, @Youssef1313! I reviewed both changes in detail.

1. Mono muxer arm removal — Correct

I verified that the (_, _, true) => commandLineArguments arm was provably redundant. When mono is active, both isAppHost and isDotnetMuxer are false, so the default arm _ => commandLineArguments produces the identical result. The removal also eliminates a redundant IsCurrentTestApplicationHostMonoMuxer evaluation (which called GetProcessPath() + Path.GetFileNameWithoutExtension() a second time). Clean improvement.

2. TODO on IsCurrentTestApplicationModuleExecutableValid bug identification ⚠️

The processPath != ".dll" check compares a full file path to the literal ".dll", which will never match — making the property always return true. This cascades into IsAppHostOrSingleFileOrNativeAot effectively becoming !isDotnet && !isMono.

The TODO is a reasonable approach for a cleanup PR, though I'd suggest making it more descriptive (see inline comment) and/or filing an issue to track it, since the fix has behavioral implications for RetryOrchestrator and TestHostControllersTestHost.

Non-blocking suggestions

  • Make TODO text more specific about why it's always true and what callers are affected
  • Add a brief // includes mono muxer note to the default switch arm to preserve documentation value
  • Consider adding unit tests with mocked IEnvironment/IProcessHandler for the executable info switch branches (pre-existing gap)

Overall this is a clean, low-risk change. LGTM with minor suggestions.

@Youssef1313 Youssef1313 merged commit a723db6 into main Apr 9, 2026
15 checks passed
@Youssef1313 Youssef1313 deleted the dev/ygerges/cleanup branch April 9, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants