Skip to content

Test failure System.ServiceProcess.Tests.ServiceBaseTests.LogWritten #62616

Closed

Description

@VincentBu

Run: runtime-libraries-coreclr outerloop 20211209.3

Failed test:

net7.0-windows-Release-x64-CoreCLR_release-Windows.81.Amd64.Open
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten_AutoLog_False
- System.ServiceProcess.Tests.ServiceBaseTests.PropagateExceptionFromOnStart
- System.ServiceProcess.Tests.ServiceBaseTests.TestOnContinueBeforePause
- System.ServiceProcess.Tests.ServiceBaseTests.TestOnExecuteCustomCommand
- System.ServiceProcess.Tests.ServiceBaseTests.TestOnPauseAndContinueThenStop
- System.ServiceProcess.Tests.ServiceBaseTests.TestOnPauseThenStop
- System.ServiceProcess.Tests.ServiceBaseTests.TestOnStartThenStop
- System.ServiceProcess.Tests.ServiceControllerTests.ConstructWithDisplayName
- System.ServiceProcess.Tests.ServiceControllerTests.ConstructWithMachineName
- System.ServiceProcess.Tests.ServiceControllerTests.ConstructWithServiceName
- System.ServiceProcess.Tests.ServiceControllerTests.Start_NullArg_ThrowsArgumentNullException
- System.ServiceProcess.Tests.ServiceControllerTests.*

net7.0-windows-Release-x64-CoreCLR_release-(Windows.Nano.1809.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504
- System.ServiceProcess.Tests.ServiceBaseTests.PropagateExceptionFromOnStart
- System.ServiceProcess.Tests.ServiceBaseTests.TestOnContinueBeforePause
- System.ServiceProcess.Tests.ServiceBaseTests.TestOnExecuteCustomCommand
- System.ServiceProcess.Tests.ServiceBaseTests.*

net7.0-windows-Release-x64-CoreCLR_release-(Windows.Server.Core.1909.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:windowsservercore-2004-helix-amd64-20200904200251-272704c
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten_AutoLog_False
- System.ServiceProcess.Tests.ServiceBaseTests.*

net7.0-windows-Release-x64-CoreCLR_release-Windows.10.Amd64.Server19H1.Open
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten_AutoLog_False
- System.ServiceProcess.Tests.ServiceBaseTests.*

net7.0-windows-Release-x64-CoreCLR_release-Windows.10.Amd64.ServerRS5.Open
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten_AutoLog_False
- System.ServiceProcess.Tests.ServiceBaseTests.*

net7.0-windows-Release-x86-CoreCLR_release-Windows.10.Amd64.ServerRS5.Open
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten_AutoLog_False
- System.ServiceProcess.Tests.ServiceBaseTests.*

net7.0-windows-Release-x86-CoreCLR_release-Windows.7.Amd64.Open
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten_AutoLog_False
- System.ServiceProcess.Tests.ServiceBaseTests.*

net7.0-windows-Release-x86-CoreCLR_release-Windows.10.Amd64.Server19H1.Open
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten
- System.ServiceProcess.Tests.ServiceBaseTests.LogWritten_AutoLog_False
- System.ServiceProcess.Tests.ServiceBaseTests.*

Error message:

System.TypeLoadException : Could not load type 'Advapi32' from assembly 'System.ServiceProcess.ServiceController.TestService, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' because the method 'CreateService' has no implementation (no RVA).


Stack trace
   at System.ServiceProcess.Tests.TestServiceInstaller.Install()
   at System.ServiceProcess.Tests.TestServiceProvider.CreateTestServices() in /_/src/libraries/System.ServiceProcess.ServiceController/tests/TestServiceProvider.cs:line 131
   at System.ServiceProcess.Tests.TestServiceProvider..ctor(String serviceName) in /_/src/libraries/System.ServiceProcess.ServiceController/tests/TestServiceProvider.cs:line 84
   at System.ServiceProcess.Tests.TestServiceProvider..ctor() in /_/src/libraries/System.ServiceProcess.ServiceController/tests/TestServiceProvider.cs:line 69
   at System.ServiceProcess.Tests.ServiceBaseTests..ctor() in /_/src/libraries/System.ServiceProcess.ServiceController/tests/ServiceBaseTests.cs:line 29
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) in /_/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs:line 3747

Activity

  1. ghost added
    untriaged
    on Dec 10, 2021
  2. danmoseley commented on Dec 13, 2021

    @danmoseley
    Contributor

    this was apparently broken by 23c386a. For some reason, the generator is not emitting the stub for the CreateService pinvoke. If I add <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> I see all the other stubs.

    Incidentally I wonder whether (no RVA). could be trimmed from the message. It won't mean much to most people, and it initially made me assume some exotic loader problem rather than the pinvoke stub being literally missing.

  3. danmoseley commented on Dec 13, 2021

    @danmoseley
    Contributor

    Here's the issue

    diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CreateService.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CreateService.cs
    index 3c05b2d080b..abfe75e9611 100644
    --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CreateService.cs
    +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CreateService.cs
    @@ -10,7 +10,7 @@ internal static partial class Interop
         internal static partial class Advapi32
         {
             [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
    -        public static extern IntPtr CreateService(SafeServiceHandle databaseHandle, string serviceName, string displayName, int access, int serviceType,
    +        public static partial IntPtr CreateService(SafeServiceHandle databaseHandle, string serviceName, string displayName, int access, int serviceType,
                 int startType, int errorControl, string binaryPath, string loadOrderGroup, IntPtr pTagId, string dependencies,
                 string servicesStartName, string password);

    The analyzer/fixer should error out when [GeneratedDllImport] is applied to something extern and not partial shouldn't it?

    BTW for some reason I simply could not induce VS to load the sources for the analyzer, despite having private symbols loaded. No idea why that is, so I just had to use trial and error.

  4. ghost added
    in-pr
    on Dec 13, 2021
  5. ghost removed
    in-pr
    on Dec 13, 2021
  6. ghost locked as resolved and limited conversation to collaborators on Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-x64arch-x86area-Interop-coreclros-windowsuntriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions