To be fixed by #11851
None. See #11851 for better understanding.
No exception will be thrown.
An exception will be thrown if any previously started dependent service that could be stopped was not stopped after a service was forced to stop.
-or-
An InvalidOperationException will be thrown if the Status of any of ServiceController.DependentServices whose Status was Running or StartPending and whose CanStop was true did not became Stopped or StopPending after a Stop-Service command was executed with the -Force flag for a service.
None.
Please start your discussion.
Steps to reproduce
None.
I wonder what are you going to fix if you haven't repo steps? :-)
I wonder what are you going to fix if you haven't repo steps?
Repro steps are possible, but I don't feel they are necessary.
Do you agree that a collection can not be modified during enumeration? If yes, there is an invalid piece of code. For now I don't need to care under what circumstances it will be executed. It could be even unreachable, or exist only for completeness or readability. Even so I don't think a bug is very readable.
A bug is serious enough if it can be directly observed through codes. Why do you need reproduce steps to see it or prove it? #11862 is declared to be a "fix", do you need repro steps for it as well?
@NextTurn We have templates for issues and PRs. They are designed to make it easier for people to understand what is going wrong. You will save them a lot of time if you follow these patterns. Thanks!
Will these ceremonies help to understand this specific bug at all?
Is it not possible to fix not reproduced bugs at all?
Merge #11863.
Set-Location '.\test\tools\TestRawService\'
dotnet.exe build
Set-Location '.\bin\Debug\netcoreapp3.1\'
New-Service -Name 'testrawservice1' -BinaryPathName (Get-Item '.\TestRawService.exe').FullName
New-Service -Name 'testrawservice2' -BinaryPathName (Get-Item '.\TestRawService.exe').FullName -DependsOn 'testrawservice1'
Start-Service 'testrawservice2'
Stop-Service 'testrawservice1' -Force
Stop-Service : Service 'testrawservice1 (testrawservice1)' cannot be stopped due to the following error: Cannot stop testrawservice2 service on computer '.'.
At line:1 char:1
+ Stop-Service raw1 -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Stop-Service], ServiceCommandException
+ FullyQualifiedErrorId : CouldNotStopService,Microsoft.PowerShell.Commands.StopServiceCommand
Stop-Service : Collection was modified; enumeration operation may not execute.
At line:1 char:1
+ Stop-Service raw1 -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Stop-Service], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.StopServiceCommand