KSP-CKAN / CKAN

The Comprehensive Kerbal Archive Network
https://forum.kerbalspaceprogram.com/index.php?/topic/197082-*
Other
1.99k stars 348 forks source link

Crash on startup: System.NotSupportedException: Specified method is not supported. #2769

Closed cpcallen closed 5 years ago

cpcallen commented 5 years ago

Background

CKAN Version: 1.25.4

KSP Version: 1.7.0

Operating System: macOS High Sierra 10.13.6

Have you made any manual changes to your GameData folder (i.e., not via CKAN)? Yes.

Problem

What steps did you take in CKAN?

Installed CKAN using homebrew. Installation succeeded, but running $ ckan encountered issue #2630, so I applied the suggested fix of installing the mono-mdk cask instead of the mono formula:

$ brew uninstall --ignore-dependencies mono
Uninstalling /usr/local/Cellar/mono/5.20.1.19... (3,824 files, 417MB)

$ brew cask install mono-mdk
[… SNIP …]
==> Satisfying dependencies
==> Downloading https://download.mono-project.com/archive/5.20.1/macos-10-universal/MonoFramework-MDK-5.20.1.19.macos10.xamarin.univ
######################################################################## 100.0%
[… SNIP …]
installer: The install was successful.
🍺  mono-mdk was successfully installed!

After restarting bash to pick up the new path for mono, I started ckan with no arguments.

What did you expect to happen?

Something useful, like a usage message.

What happened instead?

It promptly crashed:

$ ckan 
WARNING: The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at all
Setting up CKAN for the first time...
Creating /Users/cpcallen/Library/Application Support/Steam/SteamApps/common/Kerbal Space Program/CKAN
Scanning for installed mods...
System.NotSupportedException: Specified method is not supported.
  at System.Drawing.MacSupport.GetCGContextForView (System.IntPtr handle) [0x0001a] in <9b724d20ab5f4edb8ef04e1dfd7e70c6>:0 
  at System.Drawing.Graphics.FromHwnd (System.IntPtr hwnd) [0x00055] in <9b724d20ab5f4edb8ef04e1dfd7e70c6>:0 
  at System.Windows.Forms.Control.CreateGraphics () [0x00019] in <4e2b4a35de3c46448d5450fc4127b3cc>:0
[… SNIP …]
  at System.Activator.CreateInstance[T] () [0x00015] in <6e26a535bf76467f9082042847cb7d56>:0 
  at CKAN.ControlFactory.CreateControl[T] () [0x00017] in <2c2371fb3f2949b2a6dfae930758e6ee>:0 
  at CKAN.Main.RecreateDialogs () [0x00022] in <2c2371fb3f2949b2a6dfae930758e6ee>:0 
  at CKAN.Main..ctor (System.String[] cmdlineArgs, CKAN.KSPManager mgr, CKAN.GUIUser user, System.Boolean showConsole) [0x00288] in <2c2371fb3f2949b2a6dfae930758e6ee>:0 
  at (wrapper remoting-invoke-with-check) CKAN.Main..ctor(string[],CKAN.KSPManager,CKAN.GUIUser,bool)
  at CKAN.GUI.Main_ (System.String[] args, CKAN.KSPManager manager, System.Boolean showConsole) [0x0003b] in <2c2371fb3f2949b2a6dfae930758e6ee>:0 
  at CKAN.CmdLine.MainClass.Gui (CKAN.KSPManager manager, CKAN.CmdLine.GuiOptions options, System.String[] args) [0x00008] in <2c2371fb3f2949b2a6dfae930758e6ee>:0 
  at CKAN.CmdLine.MainClass.RunSimpleAction (CKAN.CmdLine.Options cmdline, CKAN.CmdLine.CommonOptions options, System.String[] args, CKAN.IUser user, CKAN.KSPManager manager) [0x002ab] in <2c2371fb3f2949b2a6dfae930758e6ee>:0 
  at CKAN.CmdLine.MainClass.Execute (CKAN.KSPManager manager, CKAN.CmdLine.CommonOptions opts, System.String[] args) [0x00187] in <2c2371fb3f2949b2a6dfae930758e6ee>:0 
  at CKAN.CmdLine.MainClass.Main (System.String[] args) [0x00091] in <2c2371fb3f2949b2a6dfae930758e6ee>:0  

Full crash dump output.

CKAN error codes (if applicable): Not sure. Dump output ends with "Abort trap: 6".

HebaruSan commented 5 years ago

Homebrew's mono doesn't work. Install the package from mono-project.com:

https://github.com/KSP-CKAN/CKAN/wiki/Installing-CKAN-on-OSX

HebaruSan commented 5 years ago

Also the workaround that you referenced specifically stated "ckan is functional with ckan consoleui and other text-only commands". You tried to run the GUI.

cpcallen commented 5 years ago

Also the workaround that you referenced specifically stated "ckan is functional with ckan consoleui and other text-only commands". You tried to run the GUI.

That is useful and non-obvious information—thanks!

cpcallen commented 5 years ago

Please reopen.

I have removed the mono and mono-mdk homebrew packages, and installed the official package from mono-project.com, and more or less exactly the same crash occurs, so the problem does not relate to homebrew.

HebaruSan commented 5 years ago

Oh right, just running "ckan" from the command line will run into #2272, the GUI can only run in 32-bit mode. Try:

mono --arch=32 ckan.exe

The .dmg download does that automatically.

cpcallen commented 5 years ago

mono --arch=32 ckan.exe

That does indeed solve the problem. I wonder if it would be worth updating the script created by the ckan.rb Homebrew formula to more closely resemble the one provided in the .app bundle (and also remove the misleading reference to the non-existent ckan-app cask).

DasSkelett commented 5 years ago

That does indeed solve the problem. I wonder if it would be worth updating the script created by the ckan.rb Homebrew formula to more closely resemble the one provided in the .app bundle (and also remove the misleading reference to the non-existent ckan-app cask).

I don't know the package update policy of Homebrew, but if you are going to create a PR, you could try to update the version of CKAN they distribute, especially because there were some bugs leading to crashes on macOS fixed since v1.25.4.

https://github.com/Homebrew/homebrew-core/blob/fd1ef471a25cb83041e710018f9ad9686fc50d97/Formula/ckan.rb#L4

CKAN v1.26.2 is the most recent version.

But again, I don't know how Homebrew works, so that might be nonsense.

HebaruSan commented 5 years ago

As I understand it, the homebrew team welcomes (in fact depends on) changes from its users, so you might as well try. The CKAN team has no involvement with that cask.