Page MenuHomeFeedback Tracker

Compiler gives up after an additional '26986' classes and '26986' global functions.
New, UrgentPublic

Description

Above 50,000 additional classes but below 60,000 also causes the compiler to stop functioning.

I will do some more tests on Friday as it could very well instead be a maximum number of instructions in a single script module that causes the error. Either way, increase the accidental (I hope) limit for something, anything, please.

Notify the Enfusion team that the compiler may be deciding to not exist if it is dealt with more than it can handle

Details

Severity
Block
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General
Steps To Reproduce

The program below generates a bunch of classes or functions, just uncomment and comment as needed for testing. I made it in less than a minute, please no critique.

You also have the script class that was used, modded DayZGame

Additional Information
using System;
using System.IO;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Steve Aka Salutesh");

            int count = 0;
            int.TryParse(args[0], out count);

            try
            {
                StreamWriter sw = new StreamWriter("test.c");

                sw.WriteLine("class TestBase {");
                sw.WriteLine("  void TestPrint() {");
                sw.WriteLine("  }");
                sw.WriteLine("};");

                for (int i = 0; i < count; i++)
                {
                    string className = "Test" + i;
                    sw.WriteLine("class " + className + ": TestBase {");
                    sw.WriteLine("  override void TestPrint() {");
                    sw.WriteLine("      Print(\"" + className + " :: TESTING\");");
                    sw.WriteLine("  }");
                    sw.WriteLine("};");

                    //sw.WriteLine("static void Create" + className + "() {");
                    //sw.WriteLine("  " + className + " test = new " + className + "();");
                    //sw.WriteLine("}");
                }

                sw.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("InclementDab: " + e.Message);
            }
            finally
            {
                Console.WriteLine("Arkensor");
            }

        }
    }
}

Code used to test the classes, this will spam print

modded class DayZGame
{
	void DayZGame()
	{
		GetCallQueue(CALL_CATEGORY_SYSTEM).Call(ServerDeferredInit);
	}

	void ServerDeferredInit()
	{
		//514 // number of classes in vanilla 3_Game
		//16384‬ // signed integer maximum 15 bit
		//32767 // signed integer maximum 16 bit
		for (int i = 0; i < 65535; i++) // unsigned integer maximum 16 bit
		{
			string cls = "Test" + i + "";
			typename tp = cls.ToType();
			TestBase functionToCall = TestBase.Cast( tp.Spawn() ); // functionToCall was a string named f the static method before
			if ( functionToCall == null )
			{
				Print( "Exiting at " + cls );
				return;
			}
			functionToCall.TestPrint();
			//GetGame().GameScript.Call( NULL, functionToCall, NULL );
		}
	}
};

Event Timeline

I disagree. This needs no "fix" and the limit is way above anything reasonable all modders combined could ever create.

@Arkensor each template is a new class.

The compiler probably creates a new class for each template so if you have 5000 classes and 3 of them use templates then there are 15000 classes.

That is what I believe may happen but I can be wrong, again, I'll do tests tomorrow when I am available, would be great if someone on the Enfusion team does some now though.

Xairo added a subscriber: Xairo.Oct 9 2020, 10:41 PM