Skip to content

Deprecate EnableShutdownAfterTestRun which is no-op#15576

Merged
nohwnd merged 4 commits into
mainfrom
dev/ygerges/EnableShutdownAfterTestRun
Mar 26, 2026
Merged

Deprecate EnableShutdownAfterTestRun which is no-op#15576
nohwnd merged 4 commits into
mainfrom
dev/ygerges/EnableShutdownAfterTestRun

Conversation

@Youssef1313
Copy link
Copy Markdown
Member

@nohwnd Thoughts?

Copilot AI review requested due to automatic review settings March 24, 2026 15:03
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

Deprecates the EnableShutdownAfterTestRun framework handle property (now a no-op) and removes engine usage of the flag so it can’t influence execution behavior.

Changes:

  • Marked EnableShutdownAfterTestRun as obsolete (compile-time error) on interface and implementations.
  • Removed engine read-path for EnableShutdownAfterTestRun during runs.
  • Removed now-irrelevant unit tests validating the property’s previous behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Adapter/FrameworkHandleTests.cs Removes tests that asserted the property’s previous getter/setter behavior.
src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/IFrameworkHandle.cs Marks the property obsolete (error) at the public interface level.
src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs Removes engine logic that read the property to affect run behavior.
src/Microsoft.TestPlatform.CrossPlatEngine/Adapter/FrameworkHandle.cs Marks implementation property obsolete (error).
src/Microsoft.TestPlatform.Common/ExtensionDecorators/SerialTestRunDecoratorFrameworkHandle.cs Marks decorator property obsolete (error) but still forwards to obsolete member.
src/Microsoft.TestPlatform.Common/ExtensionDecorators/SerialTestRunDecorator.cs Marks decorator property obsolete (error) but still forwards to obsolete member.

/// and should be used only when absolutely required as using it degrades the performance of the subsequent run.
/// It throws InvalidOperationException when it is attempted to be enabled when keepAlive is false.
/// </summary>
[Obsolete("This property has no effect", error: true)]
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Marking a member on a public interface as [Obsolete(..., error: true)] is an immediate compile-time breaking change for any external adapter that implements IFrameworkHandle or references the property. If the intent is “deprecate” rather than “remove now”, consider changing to error: false (warning) and planning removal in a major version, or introducing a new interface/versioned API so existing implementers aren’t forced into a hard break.

Suggested change
[Obsolete("This property has no effect", error: true)]
[Obsolete("This property has no effect", error: false)]

Copilot uses AI. Check for mistakes.
Comment on lines 18 to 22
/// and should be used only when absolutely required as using it degrades the performance of the subsequent run.
/// It throws InvalidOperationException when it is attempted to be enabled when keepAlive is false.
/// </summary>
[Obsolete("This property has no effect", error: true)]
bool EnableShutdownAfterTestRun { get; set; }
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The XML doc comment still describes functional behavior (“throws InvalidOperationException…”, perf impact) but the new obsolete message says the property has no effect. Please update the XML doc to match the new contract (no-op / deprecated) to avoid misleading adapter authors.

Copilot uses AI. Check for mistakes.
}

[Obsolete("This property has no effect", error: true)]
public bool EnableShutdownAfterTestRun { get => _frameworkHandle.EnableShutdownAfterTestRun; set => _frameworkHandle.EnableShutdownAfterTestRun = value; }
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

This property forwards to _frameworkHandle.EnableShutdownAfterTestRun, which is now [Obsolete(..., error: true)] on the interface. Accessing an obsolete member with error: true typically fails compilation even inside another obsolete member, so this forwarding implementation is likely to break the build. Since the property is declared “no effect”, implement it as a local no-op (e.g., constant false + empty setter) to avoid referencing the obsolete member.

Suggested change
public bool EnableShutdownAfterTestRun { get => _frameworkHandle.EnableShutdownAfterTestRun; set => _frameworkHandle.EnableShutdownAfterTestRun = value; }
public bool EnableShutdownAfterTestRun { get => false; set { } }

Copilot uses AI. Check for mistakes.
Comment thread src/Microsoft.TestPlatform.Common/ExtensionDecorators/SerialTestRunDecorator.cs Outdated
@nohwnd
Copy link
Copy Markdown
Member

nohwnd commented Mar 24, 2026

https://grep.app/search?q=EnableShutdownAfterTestRun looks to be used in places where I would expect it to be used, go ahead.

@nohwnd
Copy link
Copy Markdown
Member

nohwnd commented Mar 24, 2026

probably with error:false, we will break the users when we remove it, and having one extra property that we don't use is not a problem.

Comment thread src/Microsoft.TestPlatform.CrossPlatEngine/Adapter/FrameworkHandle.cs Outdated
Comment thread src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/IFrameworkHandle.cs Outdated
Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
Copilot AI review requested due to automatic review settings March 24, 2026 16:38
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment on lines 59 to 63
/// and should be used only when absolutely required as using it degrades the performance of the subsequent run.
/// It throws InvalidOperationException when it is attempted to be enabled when keepAlive is false.
/// </summary>
[Obsolete("This property has no effect", error: false)]
public bool EnableShutdownAfterTestRun { get; set; }
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Same issue as on the interface: the implementation’s doc comment still claims it can throw and affects performance, but the property is now explicitly a no-op. Update/remove the outdated documentation to avoid misleading future maintainers and API consumers.

Copilot uses AI. Check for mistakes.

public bool EnableShutdownAfterTestRun { get => _frameworkHandle.EnableShutdownAfterTestRun; set => _frameworkHandle.EnableShutdownAfterTestRun = value; }
[Obsolete("This property has no effect", error: false)]
public bool EnableShutdownAfterTestRun { get => _frameworkHandle.EnableShutdownAfterTestRun; set => _frameworkHandle.EnableShutdownAfterTestRun = value; }
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Line 116 is mis-indented relative to surrounding members, which can violate formatting/style rules and may fail style analyzers in builds. Indent public bool EnableShutdownAfterTestRun ... to match the class’s standard member indentation.

Suggested change
public bool EnableShutdownAfterTestRun { get => _frameworkHandle.EnableShutdownAfterTestRun; set => _frameworkHandle.EnableShutdownAfterTestRun = value; }
public bool EnableShutdownAfterTestRun { get => _frameworkHandle.EnableShutdownAfterTestRun; set => _frameworkHandle.EnableShutdownAfterTestRun = value; }

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nohwnd nohwnd merged commit 5001484 into main Mar 26, 2026
6 checks passed
@nohwnd nohwnd deleted the dev/ygerges/EnableShutdownAfterTestRun branch March 26, 2026 03:41
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