Every now and then when I build a specific solution, I\'ll get a random amount of \"An expression is too long or complex to compile\" in the Error List window. However, the
I got this error in one project when I switched from Visual Studio 2012 to Visual Studio Community 2013.
In my case it was giant file (25k lines, not written by me) with had List initialized by collection initializer.
Something like this:
public class Class
{
public List BigList
{
get
{
return new List()
{
new string[]{"foo","bar"},
new string[]{"foo","bar"},
new string[]{"foo","bar"},
new string[]{"foo","bar"},
.
.
.
.
.
new string[]{"foo","bar"},
new string[]{"foo","bar"},
new string[]{"foo","bar"},
new string[]{"foo","bar"}
}
}
}
}
I changed it to string[][] and the project started to compile
public class Class
{
public string[][] BigList
{
get
{
return new string[][]
{
new string[]{"foo","bar"},
new string[]{"foo","bar"},
new string[]{"foo","bar"},
new string[]{"foo","bar"},
.
.
.
.
.
new string[]{"foo","bar"},
new string[]{"foo","bar"},
new string[]{"foo","bar"},
new string[]{"foo","bar"}
}
}
}
}