Open
Description
Repro steps
- dotnet build .\src\libraries\Microsoft.Extensions.Hosting\tests\
- .\build.cmd -vs .\src\libraries\Microsoft.Extensions.Hosting\Microsoft.Extensions.Hosting.sln
- Open the Test Explorer window
- Run all tests
Expected results
All tests should pass clean
Actual results
Tests that depend on EventLog fail with:
System.PlatformNotSupportedException : EventLog access is not supported on this platform.
Stack Trace:
EventLog.ctor(String logName, String machineName, String source) line 30
WindowsEventLog.ctor(String logName, String machineName, String sourceName) line 20
EventLogSettings.CreateDefaultEventLog() line 61
EventLogSettings.get_EventLog() line 39
EventLogLogger.ctor(String name, EventLogSettings settings, IExternalScopeProvider externalScopeProvider) line 37
EventLogLoggerProvider.CreateLogger(String name) line 50
LoggerInformation.ctor(ILoggerProvider provider, String category) line 72
LoggerFactory.CreateLoggers(String categoryName) line 199
LoggerFactory.CreateLogger(String categoryName) line 131
Logger`1.ctor(ILoggerFactory factory) line 29
Analysis
It appears the Test Explorer window is not respecting the TFMs in Hosting:
It should only be running the tests for $(NetCoreAppCurrent)-Windows_NT
, but it looks like it is running for both $(NetCoreAppCurrent)-Windows_NT
and $(NetCoreAppCurrent)
cc @ViktorHofer