Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
VincentBu opened this issue Dec 10, 2021 · 3 comments · Fixed by #62698
Closed

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

VincentBu opened this issue Dec 10, 2021 · 3 comments · Fixed by #62698
Labels
arch-x64 arch-x86 area-Interop-coreclr os-windows untriaged New issue has not been triaged by the area owner

Comments

@VincentBu
Copy link
Contributor

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)windows.10.amd64.serverrs5.open@mcr.microsoft.com/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)windows.10.amd64.server20h1.open@mcr.microsoft.com/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
@ghost
Copy link

ghost commented Dec 10, 2021

Tagging subscribers to this area: @dotnet/area-system-serviceprocess
See info in area-owners.md if you want to be subscribed.

Issue Details

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)windows.10.amd64.serverrs5.open@mcr.microsoft.com/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)windows.10.amd64.server20h1.open@mcr.microsoft.com/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
Author: VincentBu
Assignees: -
Labels:

arch-x86, area-System.ServiceProcess, os-windows, arch-x64

Milestone: -

@danmoseley
Copy link
Member

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.

@danmoseley
Copy link
Member

danmoseley commented Dec 13, 2021

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.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Dec 13, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Dec 13, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jan 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-x64 arch-x86 area-Interop-coreclr os-windows untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants