-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Description
IsWindowsService fails when an App is started as a service from services.msc MMC plugin.
---> System.InvalidOperationException: Process has exited, so the requested information is not available.
at System.Diagnostics.Process.get_ProcessName()
at Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceHelpers.IsWindowsService()
Reproduction Steps
Create an executable, call Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceHelpers.IsWindowsService() and register this app as a Windows Service. Start this service from the services.msc MMC plugin. It will fail.
Expected behavior
Should work and return true or false...
Actual behavior
Exception
Regression?
Yes, worked with preview.1
Known Workarounds
No workaround.
Configuration
CoreCLR Version: 7.0.22.15202
.NET Version: 7.0.0-preview.2.22152.2
Other information
CoreCLR Version: 7.0.22.15202
.NET Version: 7.0.0-preview.2.22152.2
---> System.InvalidOperationException: Process has exited, so the requested information is not available.
at System.Diagnostics.Process.get_ProcessName()
at Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceHelpers.IsWindowsService()