1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

Two compile/run-from-source issues

Discussion in 'Source Code' started by Xanhou, Aug 17, 2016.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Xanhou

    Xanhou Trainee Engineer

    Messages:
    6
    Hello Keen forum members and developers,

    I'm trying to get the game to run from source.
    I created the user.props, copied the binaries from the steam folder to the right place, and commented out some code for the networking, which solved most of the issues. Two issues remain.

    1. VRage.Scripting is giving 140 errors. They all seem to be related to missing the Microsoft.CodeAnalysis package.

    See below for logs of the build.

    I managed to find a simple work around for this: copy the binaries of the game from my steam folder to the location where the other project expect the compiled binaries to be. This didn't solve the errors, but at least you can tell VS to shut up and run that shit anyway with some success.

    2. I said run with "some" success because here the next issue arises. The game launches and I see the menu screen. However, it also shows a popup, indicating that I need an update for .Net . When clicking on 'Ok' (the only button you can click on), it closes the game and open this webpage where you can download the update. So I install that update, but that doesn't help. The game keep coming with the popup that I need that update. I also restarted my PC and tried again, without success.

    Interesting side notes:
    - When cleaning the project, the scripting project seems to be skipped, hence I can clean the solution without the fear that my copied binaries are deleted.
    - I use VS2013 update 5. I tried to download update 4, but MS redirects every single link to update 4 immediately to update 5. The installer for update 4 seems to be gone from the first page of google.

    Build output:
    Link to Google Drive file
    Line that I assume indicates the main cause:
    14>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.CodeAnalysis". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
     
  2. Head5hot

    Head5hot Trainee Engineer

    Messages:
    2
    I got rid of the errors by installing the CodeAnalysis.CSharp package via NuGet manager, but I'm getting the same pop-up in-game as you. I tried to install that update but it says my .net is already up to date. I'm using VS2015 update 3.
     
  3. Xanhou

    Xanhou Trainee Engineer

    Messages:
    6
    Ok, so I figured out how to get the scripting project to compile, fixing the first issue, but the second issue persists.
    The fix to the first issue is to put the Microsoft.CodeAnalysis.dll file and Microsoft.CodeAnalysis.CSharp from your steam folder into the 3d/Microsoft.CodeAnalysis/ folder. Similar to the other missing binaries.

    I traced the issue with the .Net version to a log message containing the follow message:
    2016-08-21 18:03:56.881 - Thread: 9 -> Error: Error during ModAPI initialization: The type initializer for 'VRage.Scripting.MyScriptCompiler' threw an exception.

    Edit: Further tracing leads to:
    "Could not load file or assembly 'System.Reflection.Metadata"
    It seems we will need to copy over even more .dll files

    Edit: Further tracing lead me to disable the new scripting stuff.
    Settings "MyFakes.ENABLE_ROSLYN_SCRIPTS" to false stops the initial error.
    HOWEVER, this just brings forth the next error. This time it seems related to the networking code, even if I start a single player world.

    Edit: Found the issue: I did not comment out the asserts. Commenting out line 57 of MyReplicationLayerBase.cs fixed the issue.
     
    Last edited: Aug 21, 2016
  4. Head5hot

    Head5hot Trainee Engineer

    Messages:
    2
    Well I tried doing all that you listed, but I'm still getting a scripting exception during loading anyway (not sure if you encountered that one too).
    Code:
    An unhandled exception of type 'System.TypeInitializationException' occurred in Sandbox.Game.dll
    Additional information: The type initializer for 'VRage.Scripting.MyIngameScripting' threw an exception.
    I'm gonna try fiddling around with stuff to fix it when I have some time.
     
  5. Xanhou

    Xanhou Trainee Engineer

    Messages:
    6
    I think that was the issue I resolved by disabling the ROSLYN scripting.
    In the file:
    Sources/Sandbox.Game/Engine/Utils/MyFakes
    On line 714, set the ENABLE_ROSLYN_SCRIPTS constant to false.

    You can check where the exception is coming from, which is code that is only ran when this constant is set to true. I guess the constant enables the new scripting stuff, so if you want to mod the scripting part of the game, you should look further into this.
     
  6. Joshua Jurgensmeier

    Joshua Jurgensmeier Trainee Engineer

    Messages:
    1
    Hello,
    Sorry to butt into your conversation here, but I wanted to say a couple things. First of all, I just got my own source build working, and this was one of the more helpful threads that I pulled information from. So, thanks for having, and fixing, the problems you had. Second, I also had the System.TypeInitializationException. It is not fixed by setting the ENABLE_ROSLYN_SCRIPTS constant to false (that fixed the .Net issue for me tho). Before you spend the time on it Head5hot, let me tell you what fixed it for me. Essentially, I located the file that was causing the error and commented it out. I then proceeded to remove all references to it from the code.

    1. Locate the file IMyIngameScripting.cs (In Visual Studio). It should be under Sandbox.Common Either delete this, or comment out the contents (If you do not enjoy living on the edge)
    2. Attempt to compile the game, then you should get an error in the file MyIngameScripting.cs (note this one lacks the 'I' at the beginning). Delete/comment out this file as well. It should be located under Sandbox.Game.
    3. After compiling again, multiple errors should appear in multiple files. Each of these just requires a one-line comment out. Go into each file and comment out the lines with the errors.
    4. Compile and it should work.

    Hope this helps,
    Josh
     
Thread Status:
This last post in this thread was made more than 31 days old.