anegostudios / vsmodexamples

Vintage Story Servermod Examples
http://www.vintagestory.at/
GNU General Public License v3.0
28 stars 15 forks source link

VS ran under wine when using Rider instead of VSC + Workaround #11

Closed 5HT2 closed 2 years ago

5HT2 commented 2 years ago

Documenting the issue that causes anegostudios/VintageStory-Issues#1749. This is currently tracked as RIDER-75160.

Rider supports .NET and Mono natively, but fails to select Mono for the default SLN templates. Instead, it tries to run the specified exe directly, using the current program set for the exe MIME type.

This means VintageStory, when run from the IDE, will have several bugs, the most noticable ones being broken keyboard / mouse input (a symptom of unity being run under wine, unfortunately).

The workaround to this is to edit your mod's launchSettings.json to run Mono with vintagestory's exe being the arguments, for example:

{
  "profiles": {
    "start-all-mods-in-sln": {
      "commandName": "Executable",
      "executablePath": "/usr/bin/mono",
      "commandLineArgs": "/usr/share/vintagestory/Vintagestory.exe --addModPath=\"$VINTAGE_STORY\" --dataPath=\"$SOLUTION_DIR\"",
      "environmentVariables": {
        "VINTAGE_STORY": "/usr/share/vintagestory/",
        "SOLUTION_DIR": "/home/f/projects/vsmodexamples/Mods/AnnoyingTextSystem/bin"
      }
    }
  }
}

This issue is to request this being documented somewhere (if I knew where the proper place for this kind of documentation was, I'd make my own PR).

radfast commented 2 years ago

Thank you for tracking down this issue to the true cause, and for finding a workaround.

I cannot quickly see any way to have this handled automatically (for example re-write launchSettings.json for Linux users). Possible solutions:

I suggest best we defer to your and @copygirl opinions on which is better. Please bear in mind that neither Tyron nor me habitually use Linux, I don't know about other team members. (Within Windows10 I use Ubuntu to run git from the command line and other filesystem maintenance, but that hardly counts)

copygirl commented 2 years ago

I'm not experienced enough on this to have a valuable opinion. I'd only like to see that the solution implemented allows Rider users to properly use the debugging tools (break on exception, breakpoints, maybe edit & continue, ...). Ideally we'd get some input from a person experienced with Rider.

5HT2 commented 2 years ago

I cannot quickly see any way to have this handled automatically

This is why I opened a bug with Rider, because the natural assumption is that it would use Mono, given it asks the user to download / configure mono.

5HT2 commented 2 years ago

cover it somewhere on the Vintagestory Wiki

I'm already in the process of doing this on the dev environment page, as mentioned on #12. I do think distributing a second JSON file for Linux users would be ideal.

5HT2 commented 2 years ago

Apologies for the triple post, should've read through the comments before replying.

In regards to your question @copygirl, this solution does not fix debugging support for Rider.

Attempting to run with debugging gives

Cannot open assembly '/usr/bin/mono': File does not contain a valid CIL image.

This is likely something that has to be fixed on their end, with Rider launching and managing mono instead of using this workaround to launch it.