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.
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.
I have found through testing that the
defaultFileText
variable is being set tonull
before it reaches the constructor method.