Closed TSIoT closed 4 years ago
Hello @TSIoT, thanks for using EmbedIO!
I fail to see why SWAN's logger should throw PlatformNotSupportedException
on Android. Can you elaborate on that, attaching the exception's stack trace if possible?
I have enable all exception: Then it throw exception when I initial the WebServer instance: Here are the detials of exception: {System.PlatformNotSupportedException: Operation is not supported on this platform. at System.Console.get_WindowHeight () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/mcs/class/corlib/System/Console.cs:879 at Swan.Terminal.get_IsConsolePresent () [0x00017] in <869ca606d31f4fc18ff59301f10d0773>:0 }
I can reproduce this problem by a clean Xamarin.Forms project only use Swan.Logging. Android : Android 9.0 Visual Studio Professional 2019 16.5.4 Xamarin.Forms: 4.2.0.815419
As you can see from SWAN's source code, the exception is expected, as part of a test to determine whether a console is present; it is properly handled by SWAN internally, so it will not be a problem when not debugging.
Thanks for your response :) I agree that this is not a problem of EmbedIo. But if an exception throw every time then it is not an "exception" even in debug mode. However, I will pos this issue to Swan's git. Thank you again!
I use embedio in XamrinForms Android. Everything is working fine until I enable all Common Language Runtime Exception. It throw System.PlatformNotSupportedException from the followin line:
_webServer = new WebServer(HttpListenerMode.EmbedIO, url);
I believe this probelm is come from Swan.Logging:$"Running HTTPListener: {listener.Name}".Info(LogSource);
Embedio is working fine if I keep ignore this exception.