Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

System.ArgumentOutOfRange exception

Here you can find all solved gameplay problems and bugs (beginning from Pre-Alpha 1.8.8).
Forum rules
By using the forum you agree to the following rules. For this forum you also need to follow these additional rules.
Locked
NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

System.ArgumentOutOfRange exception

Post by NearHuscarl » Fri Mar 27, 2020 6:21 pm

Image

The exception name is misleading, the real exception that triggers this exception is the null reference exception. Here is the log

Image

Here is the relevant code

Code: Select all

        public void OnStartup()
        {
            ScriptHelper.LogDebug("OnStartup()");
            BotManager.Initialize(); // code inside this method will throw exception
        }

Code: Select all

        // somewhere in Initialize()
        private Bot(IPlayer player)
        {
            ScriptHelper.LogDebug("Before crash", player == null);
            InfectTeam = player.GetTeam();
            ScriptHelper.LogDebug("After crash", player == null);
        }
As you can see, the exception in the first image is triggered by the null reference exception, which also reruns the OnStartup() method for some reasons only god knows. LogDebug() is just a simple wrapper around WriteToConsole() method.
1 x
Image

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Post by Gurt » Fri Mar 27, 2020 7:01 pm

Fixed after v.1.3.5.
0 x
Gurt

Locked