Repository navigation
Microsoft.Extensions.Hosting.Tests.ConsoleLifetimeExitTests failing in Windows mono with PlatformNotSupportedException #57184
Copy link
Copy link
Closed
Labels
Milestone
Description
EnsureEnvironmentExitDoesntHang and EnsureEnvironmentExitCode tests failing in CI:
Stack trace (similar call stack for EnsureEnvironmentExitDoesntHang):
at Microsoft.DotNet.RemoteExecutor.Program.Main(String[] args) in /_/src/Microsoft.DotNet.RemoteExecutor/src/Program.cs:line 94
Microsoft.Extensions.Hosting.Tests.ConsoleLifetimeExitTests.EnsureEnvironmentExitCode [FAIL]
Microsoft.DotNet.RemoteExecutor.RemoteExecutionException : Remote process failed with an unhandled exception.
Stack Trace:
Child exception:
System.PlatformNotSupportedException: This API is specific to the way in which Windows handles asynchronous I/O, and is not supported on this platform.
/_/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolBoundHandle.PlatformNotSupported.cs(24,0): at System.Threading.ThreadPoolBoundHandle.BindHandle(SafeHandle handle)
/_/src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs(76,0): at System.IO.FileSystemWatcher.StartRaisingEvents()
/_/src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.cs(638,0): at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()
/_/src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.cs(151,0): at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)
/_/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs(416,0): at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
/_/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs(153,0): at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
/_/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFileProvider.cs(359,0): at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)
/_/src/libraries/Microsoft.Extensions.Configuration.FileExtensions/src/FileConfigurationProvider.cs(33,0): at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0()
/_/src/libraries/Microsoft.Extensions.Primitives/src/ChangeToken.cs(71,0): at Microsoft.Extensions.Primitives.ChangeToken.ChangeTokenRegistration`1[[System.Action, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor(Func`1 changeTokenProducer, Action`1 changeTokenConsumer, Action state)
/_/src/libraries/Microsoft.Extensions.Primitives/src/ChangeToken.cs(32,0): at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
/_/src/libraries/Microsoft.Extensions.Configuration.FileExtensions/src/FileConfigurationProvider.cs(32,0): at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)
/_/src/libraries/Microsoft.Extensions.Configuration.Json/src/JsonConfigurationProvider.cs(20,0): at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider..ctor(JsonConfigurationSource source)
/_/src/libraries/Microsoft.Extensions.Configuration.Json/src/JsonConfigurationSource.cs(21,0): at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
/_/src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationBuilder.cs(51,0): at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
/_/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs(230,0): at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
/_/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs(146,0): at Microsoft.Extensions.Hosting.HostBuilder.Build()
/_/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs(329,0): at Microsoft.Extensions.Hosting.HostingHostBuilderExtensions.RunConsoleAsync(IHostBuilder hostBuilder, CancellationToken cancellationToken)
/_/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/ConsoleLifetimeExitTests.cs(101,0): at Microsoft.Extensions.Hosting.Tests.ConsoleLifetimeExitTests.<>c.<<EnsureEnvironmentExitCode>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
/_/src/Microsoft.DotNet.RemoteExecutor/src/Program.cs(65,0): at Microsoft.DotNet.RemoteExecutor.Program.Main(String[] args)
Child process:
Microsoft.Extensions.Hosting.Unit.Tests, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 Microsoft.Extensions.Hosting.Tests.ConsoleLifetimeExitTests+<>c System.Threading.Tasks.Task <EnsureEnvironmentExitCode>b__6_0()
Reactions are currently unavailable
Activity
eerhardt commentedon Aug 11, 2021
Why isn’t this always failing if it is a PNSE?
I see the error is coming from the FileSystemWatcher. Is there something about the watcher that is non-deterministic?
davidfowl commentedon Aug 11, 2021
Do we run mono tests on windows or are the wrong assets getting copied
eerhardt commentedon Aug 11, 2021
We run mono tests on windows. There are numerous hosting tests already disabled for this issue:
runtime/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostTests.cs
Lines 37 to 39 in 4ea7dc4
runtime/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostTests.cs
Lines 50 to 52 in 4ea7dc4
But I would have thought if a test was going to fail for this error, it would always fail. I can easily add the
ActiveIssueattributes like above to these tests. But I'd like to understand why the error doesn't always happen.cc @steveisok @SamMonoRT
steveisok commentedon Aug 11, 2021
@eerhardt I saw these today and marked them for skipping in #57114
As for why it's flaky, I'm not sure and that is weird. @lateralusX would probably know best when he comes back from vacation.
danmoseley commentedon Aug 11, 2021
Hit again in #57235
Disable System.Drawing.Common tests for mobile workloads and skip a f…
lateralusX commentedon Aug 24, 2021
@steveisok, just doing a quick look at the code it looks like it should be deterministic, given that the things being watched are always present on file system. Should we spend time to investigate this (Mono on Windows is not an official supported platform) or do a bigger pass once/if we decide to move ahead with Mono Windows support and decide to use an implementation of ThreadPoolBoundHandle not raising PNSE?
Disable System.Drawing.Common tests for mobile workloads and skip a f…