Skip to content

ServiceController tests fail to start test service #1262

Closed
@danmoseley

Description

@danmoseley

These tests verify ServiceBase and ServiceController but are rarely run because you need to specify outerloop AND you have to be elevated. They currently are failing for me -- I tried two machines.

C:\git\runtime\src\libraries\System.ServiceProcess.ServiceController\tests>msbuild /t:rebuildandtest /p:outerloop=true
...
...
    Discovering: System.ServiceProcess.ServiceController.Tests (method display = ClassAndMethod, method display options
   = None)
    Discovered:  System.ServiceProcess.ServiceController.Tests (found 36 of 37 test cases)
    Starting:    System.ServiceProcess.ServiceController.Tests (parallel test collections = on, max threads = 4)...

       System.InvalidOperationException : Cannot start service '4cb85dca-edbf-430c-afe2-61f5d782f266.Dependent' on com
  puter '.'.
        ---- System.ComponentModel.Win32Exception : Access is denied.
        Stack Trace:
          C:\git\runtime\src\libraries\System.ServiceProcess.ServiceController\src\System\ServiceProcess\ServiceControl
  ler.cs(844,0): at System.ServiceProcess.ServiceController.Start(String[] args)
          C:\git\runtime\src\libraries\System.ServiceProcess.ServiceController\src\System\ServiceProcess\ServiceControl
  ler.cs(804,0): at System.ServiceProcess.ServiceController.Start()
          C:\git\runtime\src\libraries\System.ServiceProcess.ServiceController\tests\System.ServiceProcess.ServiceContr
  oller.TestService\TestServiceInstaller.cs(106,0): at System.ServiceProcess.Tests.TestServiceInstaller.Install()
          C:\git\runtime\src\libraries\System.ServiceProcess.ServiceController\tests\TestServiceProvider.cs(123,0): at
  System.ServiceProcess.Tests.TestServiceProvider.CreateTestServices()
          C:\git\runtime\src\libraries\System.ServiceProcess.ServiceController\tests\TestServiceProvider.cs(77,0): at S
  ystem.ServiceProcess.Tests.TestServiceProvider..ctor(String serviceName, String userName)
          C:\git\runtime\src\libraries\System.ServiceProcess.ServiceController\tests\TestServiceProvider.cs(62,0): at S
  ystem.ServiceProcess.Tests.TestServiceProvider..ctor()
          C:\git\runtime\src\libraries\System.ServiceProcess.ServiceController\tests\ServiceControllerTests.cs(24,0): a
  t System.ServiceProcess.Tests.ServiceControllerTests..ctor()
          ----- Inner Stack Trace -----

This is definitely an elevated prompt. I tried Debugger.Launch() in the TestService constructor, and it does not fire. I looked at the Security event log, and it does not have any "failed" messages. "net start " gives access denied as well. So it's not the test harness.

@Anipik do you repro this?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions