Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformNotSupported MacOS #344

Closed
helviett opened this issue Feb 14, 2020 · 5 comments · Fixed by #353
Closed

PlatformNotSupported MacOS #344

helviett opened this issue Feb 14, 2020 · 5 comments · Fixed by #353
Assignees
Labels
bug good first issue This seems like a good issue if you're a new contributor.
Milestone

Comments

@helviett
Copy link

Describe the bug
We've decided to update MacOS + Xamarin + XCode to the latest stable versions. That made us update your library from 2.2.5 to 2.5.1 (latest currently). The cli started to throw exception System.PlatformNotSupportedException: Operation is not supported on this platform.

To Reproduce
Steps to reproduce the behavior:

var cli = new CommandLineApplication();
cli.Execute(emptyArgs);

Expected behavior
Work as usual.

Additional context
Full stacktrace:

System.PlatformNotSupportedException: Operation is not supported on this platform.
  at System.Console.remove_CancelKeyPress (System.ConsoleCancelEventHandler value) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/corlib/System/Console.cs:947 
  at McMaster.Extensions.CommandLineUtils.PhysicalConsole.remove_CancelKeyPress (System.ConsoleCancelEventHandler value) [0x00000] in <7f833d3ed5424320a314ef2658925b83>:0 
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync (System.String[] args, System.Threading.CancellationToken cancellationToken) [0x00137] in <7f833d3ed5424320a314ef2658925b83>:0 
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00016] in <7f833d3ed5424320a314ef2658925b83>:0 
  at Launcher.MainClass.Main (System.String[] args) [0x00144] in /Users/gameforest/Desktop/Citrus/Orange/Launcher/Main.cs:388

Full info about system:

=== Visual Studio Community 2019 for Mac ===

Version 8.4.5 (build 19)
Installation UUID: 877191a5-d7c4-4943-99dc-315c0d7d6560
  GTK+ 2.24.23 (Raleigh theme)
  Xamarin.Mac 5.16.1.25 (issue-7441-d16-3-vsmac / 881172e73)

  Package version: 606000155

=== Mono Framework MDK ===

Runtime:
  Mono 6.6.0.155 (2019-08/296a9afdb24) (64-bit)
  Package version: 606000155

=== Roslyn (Language Service) ===

3.4.0-beta4-19562-05+ff930dec4565e2bc424ad3bf3e22ecb20542c87d

=== NuGet ===

Version: 5.3.0.6192

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.101/Sdks
SDK Versions:
  3.1.101
  2.0.0
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
  3.1.1
  2.1.15
  2.0.0

=== Xamarin.Profiler ===

Version: 1.6.13.11
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 10.1.3.7 (Visual Studio Community)
Commit: xamarin-android/d16-4/d66aed0
Android SDK: /Users/gameforest/Library/Developer/Xamarin/android-sdk-macosx
  Supported Android versions:
    4.4    (API level 19)
    4.4.87 (API level 20)
    5.0    (API level 21)
    5.1    (API level 22)
    6.0    (API level 23)
    7.0    (API level 24)
    7.1    (API level 25)
    8.0    (API level 26)
    8.1    (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.4
SDK Build Tools Version: 28.0.3

Build Information: 
Mono: fd9f379
Java.Interop: xamarin/java.interop/d16-4@c4e569f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.28.0@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/master@9f4ed4b

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/gameforest/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.4.0.10
Hash: 2c49a7d
Branch: remotes/origin/d16-4
Build date: 2020-01-30 10:22:44 UTC

=== Android Device Manager ===

Version: 16.4.0.30
Hash: f9172e2
Branch: remotes/origin/d16-4
Build date: 2020-01-30 10:23:04 UTC

=== Xamarin Designer ===

Version: 16.4.0.479
Hash: 074544417
Branch: remotes/origin/d16-4
Build date: 2020-01-22 22:50:22 UTC

=== Apple Developer Tools ===

Xcode 11.3.1 (15715)
Build 11C504

=== Xamarin.Mac ===

Version: 6.10.0.17 (Visual Studio Community)
Hash: 5f802ef53
Branch: xcode11.3
Build date: 2020-01-07 11:53:06-0500

=== Xamarin.iOS ===

Version: 13.10.0.17 (Visual Studio Community)
Hash: 5f802ef53
Branch: xcode11.3
Build date: 2020-01-07 11:53:06-0500

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 804050019
Git revision: 5b9e12b8142016693a4b0f0bdac84ffac1d84c28
Build date: 2020-02-07 12:51:25+00
Build branch: release-8.4
Xamarin extensions: 5b9e12b8142016693a4b0f0bdac84ffac1d84c28

=== Operating System ===

Mac OS X 10.15.3
Darwin 19.3.0 Darwin Kernel Version 19.3.0
    Thu Jan  9 20:58:23 PST 2020
    root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
@helviett helviett added the bug label Feb 14, 2020
@natemcmaster
Copy link
Owner

Are you able to keep using 2.2.5 until we can fix this? Seems like a simple fix would be to suppress this exception around this line:

finally
{
_context.Console.CancelKeyPress -= cancelHandler;
}

Also (rhetorical question), why in the world does Xamarin allow adding an event handler to ConsoleKeyPress, but not removing that same handler?

@natemcmaster natemcmaster added the good first issue This seems like a good issue if you're a new contributor. label Feb 18, 2020
@natemcmaster natemcmaster added this to the 2.6 milestone Feb 18, 2020
@helviett
Copy link
Author

Are you able to keep using 2.2.5 until we can fix this? Seems like a simple fix would be to suppress this exception around this line:

finally
{
_context.Console.CancelKeyPress -= cancelHandler;
}

Also (rhetorical question), why in the world does Xamarin allow adding an event handler to ConsoleKeyPress, but not removing that same handler?

Yep, but one day we'll have to bring support for a new version of iOS in our game engine :)

@helviett
Copy link
Author

@natemcmaster the version of library doesn't matter, cause we experience the same issue on 2.2.5 on Mojave. Here is a full system specification:

=== Visual Studio Community 2019 for Mac ===

Version 8.3.10 (build 2)
Installation UUID: 7bd83e47-a735-4ff0-89ea-d6d6c4bb5bfe
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

Package version: 604000208

=== Mono Framework MDK ===

Runtime:
Mono 6.4.0.208 (2019-06/07c23f2ca43) (64-bit)
Package version: 604000208

=== NuGet ===

Version: 5.3.0.6192

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks
SDK Versions:
3.0.100
2.1.700
2.1.505
2.1.504
2.1.302
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.0.0
2.1.13
2.1.11
2.1.9
2.1.8
2.1.2

=== Xamarin.Profiler ===

Version: 1.6.12.29
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 11.2 (15526)
Build 11B52

=== Xamarin.Mac ===

Version: 6.6.0.12 (Visual Studio Community)
Hash: e3c2b406d
Branch: xcode11.2
Build date: 2019-11-01 00:12:07-0400

=== Xamarin.iOS ===

Version: 13.6.0.12 (Visual Studio Community)
Hash: e3c2b406d
Branch: xcode11.2
Build date: 2019-11-01 00:12:08-0400

=== Xamarin.Android ===

Version: 10.0.6.2 (Visual Studio Community)
Commit: xamarin-android/d16-3/c407838
Android SDK: /Users/gameforest/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 27.0.3

Build Information:
Mono: mono/mono@476d72b9e32
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3fd
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/gameforest/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 1.4.0.65
Hash: c33b107
Branch: remotes/origin/d16-3
Build date: 2019-11-19 20:33:22 UTC

=== Android Device Manager ===

Version: 1.2.0.116
Hash: d2b2af0
Branch: remotes/origin/d16-3
Build date: 2019-11-19 20:33:42 UTC

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Xamarin Designer ===

Version: 16.3.0.256
Hash: 8a223bfd7
Branch: remotes/origin/d16-3
Build date: 2019-11-01 21:02:02 UTC

=== Build Information ===

Release ID: 803100002
Git revision: add3a4998a5cb5b081e0404e1fe13acfecb7801d
Build date: 2019-11-20 13:35:15+00
Build branch: release-8.3
Xamarin extensions: 79c69708816813b498283eeda7bcb4d464433a04

=== Operating System ===

Mac OS X 10.14.5
Darwin 18.6.0 Darwin Kernel Version 18.6.0
Thu Apr 25 23:16:27 PDT 2019
root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

@natemcmaster
Copy link
Owner

As a workaround for the Xamarin issue, I suggest you implement IConsole (you could copy from the source for PhysicalConsole), but make the CancelKeyPress handler no-op.

the version of library doesn't matter, cause we experience the same issue on 2.2.5 on Mojave.

You are getting the same stack trace and error in 2.2.5? Are you 100% sure? There is no usage of CancelKeyPress in v2.2.5. Please check if this is another error.

@helviett
Copy link
Author

As a workaround for the Xamarin issue, I suggest you implement IConsole (you could copy from the source for PhysicalConsole), but make the CancelKeyPress handler no-op.

the version of library doesn't matter, cause we experience the same issue on 2.2.5 on Mojave.

You are getting the same stack trace and error in 2.2.5? Are you 100% sure? There is no usage of CancelKeyPress in v2.2.5. Please check if this is another error.

Perhaps I was mistaken. Can't reproduce it now. Thank you for your workaround :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue This seems like a good issue if you're a new contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants