Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #57115
This outer loop test has apparently never passed as it was written backwards: it was intended to test that if you have a service A depending on (requiring) service B, then a call
serviceControllerForB.Stop(stopDependentServices: false))
will throw IOE. Instead it was stopping service A, which of course works fine.The confusion was likely because the word dependency is overloaded in that it can mean both depended-on and depending-on. When we created a test service XYZ that depends on another test service, we named the latter XYZ.Dependency (ie XYZ ---> XYZ.Dependency). On the Win32 SCM API, services you depend on are named "dependencies". Nevertheless in everyday English, "dependency" is often used to mean the reverse -- "the thing depending on another". On ServiceController, the API is clearer: DependentServices are those that depend on YOU, and ServicesDependedOn are those you depend on; the method
Stop(bool stopDependentServices)
has a boolean to first stop services that depend on you (to which you are a prerequisite).Renamed the test service that's depended on to be XYZ.Prerequisite.
Fixed test to attempt to stop that instead.
Added more of the handy off-by-default tracing in the tests.
Note these tests only run in Windows+OuterLoop+Elevated, which may be one reason it wasn't noticed.