JimmyCushnie / JECS

Jimmy's Epic Config System
Do What The F*ck You Want To Public License
156 stars 16 forks source link

DefaultFileText doesn't work when the DataFile is created via field initializer #8

Closed JimmyCushnie closed 5 years ago

JimmyCushnie commented 5 years ago

I am pretty sure this is a compiler bug. It happens in the standalone c# version, but it does not happen with the Unity version.

static class Test
{
    // this creates an empty file
    static DataFile file = new DataFile("test"), defaultFileText: "# this is a test");

    static void Main()
    {
        // this creates a file with the text "# this is a test"
        var file = new DataFile("test2", defaultFileText: "# this is a test");
    }
}

I have found through testing that the defaultFileText variable is being set to null before it reaches the constructor method.

JimmyCushnie commented 5 years ago

Okay, never mind, this is only happening within the SUCC.Tests project. What the hell