Xamarin.Mac: WebHost.RunAsync without CancellationToken fails with Unsupported platform exception
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
WebHost.RunAsync() fails with unsupported platform exception with Xamarin.Mac if no cancellation token specified. If CancellationToken is set - no exceptions
Expected Behavior
No exception and valid behavior
Steps To Reproduce
var webHost = new WebHostBuilder()
.UseUrls(url)
.ConfigureServices(services =>
{
services.AddRouting();
})
.Configure(app =>
{
app.UseRouter(router);
})
.UseKestrel()
.Build();
listeningTask = webHost.RunAsync()
.ContinueWith(x =>
{
if (x.IsFaulted)
{
Logger.Debug(x.Exception, "Run async failed");
}
});
Exceptions (if any)
System.PlatformNotSupportedException: Operation is not supported on this platform. at System.Console.add_CancelKeyPress (System.ConsoleCancelEventHandler value) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System/Console.cs:948 at Microsoft.AspNetCore.Hosting.WebHostExtensions.AttachCtrlcSigtermShutdown (System.Threading.CancellationTokenSource cts, System.Threading.ManualResetEventSlim resetEvent, System.String shutdownMessage) [0x00031] in <127e718ac42e4542a71b54cec3ef156b>:0 at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync (Microsoft.AspNetCore.Hosting.IWebHost host, System.Threading.CancellationToken token) [0x000ca] in <127e718ac42e4542a71b54cec3ef156b>:0
.NET Version
No response
Anything else?
Visual Studio for Mac information:
=== Visual Studio Enterprise 2019 for Mac ===
Version 8.10.17 (build 2) Installation UUID: bca04928-dcb5-4e15-8241-ef7d600b17ff GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
Package version: 612000162
=== Mono Framework MDK ===
Runtime: Mono 6.12.0.162 (2020-02/2ca650f1f62) (64-bit) Package version: 612000162
=== Roslyn (Language Service) ===
3.10.0-4.21269.26+029847714208ebe49668667c60ea5b0a294e0fcb
=== NuGet ===
Version: 5.9.0.7134
=== .NET SDK (x64) ===
SDK: /usr/local/share/dotnet/sdk/5.0.404/Sdks SDK Versions: 5.0.404 3.1.416 MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 5.0.13 3.1.22
=== .NET Core 3.1 SDK ===
SDK: 3.1.416
=== .NET 5.0 SDK ===
SDK: 5.0.404
=== Xamarin.Profiler ===
Version: 1.6.15.68 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Xamarin.Android ===
Not Installed
=== Eclipse Temurin JDK ===
Java SDK: Not Found
=== Android SDK Manager ===
Version: 16.10.0.13 Hash: 1b81df5 Branch: remotes/origin/d16-10 Build date: 2021-11-12 01:17:32 UTC
=== Android Device Manager ===
Version: 16.10.0.15 Hash: 89dcc0b Branch: remotes/origin/d16-10 Build date: 2021-11-12 01:17:52 UTC
=== Apple Developer Tools ===
Xcode 13.2.1 (19586) Build 13C100
=== Xamarin.Mac ===
Version: 8.4.0.0 (Visual Studio Enterprise) Hash: 8fc41ae82 Branch: xcode13.2 Build date: 2021-12-09 01:07:56-0500
=== Xamarin.iOS ===
Xamarin.iOS not installed. Can’t find mtouch or the Version file at /Library/Frameworks/Xamarin.iOS.framework/Versions/Current.
=== Xamarin Designer ===
Version: 16.11.0.60 Hash: 56f9b80b0 Branch: remotes/origin/d16-11 Build date: 2021-12-15 02:44:16 UTC
=== Build Information ===
Release ID: 810170002 Git revision: 58f7763d4d64fcf005a474d25a5d9fd5ce46d7f5 Build date: 2022-01-05 12:51:28-05 Build branch: release-8.10
=== Operating System ===
Mac OS X 12.2.0 Darwin 21.3.0 Darwin Kernel Version 21.3.0 Wed Jan 5 21:37:58 PST 2022 root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top GitHub Comments
At first glance, PNSE in System/Console.cs on Mono side seems to be expected behavior - at least there has not been any relevant changes for a couple of years.
This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.
See our Issue Management Policies for more information.