Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

[Solved] Need Help with Visual Studio

Discussion in 'Programming Questions and Suggestions' started by Jaron Swofford, Jul 22, 2020.

  1. Jaron Swofford Trainee Engineer

    Messages:
    2
    I have Visual Studio 2019 Installed, and the MDK Installed.

    If I do anything with the GridTerminalSystem object it always returns null, and causes an exception.

    Even Simply adding this line to my Main method will throw the exception.
    Echo(GridTerminalSystem.GetType().ToString());

    I can't find an answer anywhere, my google fuu is failing and I tried searching for a forum post mentioning something like this, but I am coming up short.

    Do I not have my IDE setup correctly?


    Code:
    System.NullReferenceException
      HResult=0x80004003
      Message=Object reference not set to an instance of an object.
      Source=Light-Finder
      StackTrace:
      at IngameScript.Program.Main(String argument, UpdateType updateSource) in C:\Users\<User>\source\repos\Light-Finder\Program.cs:line 34
    

    My code is simply as follows.
    Code:
    using Sandbox.Game.EntityComponents;
    using Sandbox.ModAPI.Ingame;
    using Sandbox.ModAPI.Interfaces;
    using SpaceEngineers.Game.ModAPI.Ingame;
    using System.Collections.Generic;
    using System.Collections;
    using System.Linq;
    using System.Text;
    using System;
    using VRage.Collections;
    using VRage.Game.Components;
    using VRage.Game.GUI.TextPanel;
    using VRage.Game.ModAPI.Ingame.Utilities;
    using VRage.Game.ModAPI.Ingame;
    using VRage.Game.ObjectBuilders.Definitions;
    using VRage.Game;
    using VRage;
    using VRageMath;
    
    namespace IngameScript
    {
    	partial class Program : MyGridProgram
    	{
    		public Program()
    		{
    		}
    
    		public void Save()
    		{
    		}
    
    		public void Main(string argument, UpdateType updateSource)
    		{
    			Echo(GridTerminalSystem.GetType().ToString());
    		}
    	}
    }
    
    --- Automerge ---
    I found my Answer. The GridTerminalSystem needs to be prepoluated, with a mockup.
    https://github.com/malware-dev/MDK-Mockups
     
    Last edited: Jul 29, 2020