Interesting question but no clue why you would ever hit the limit in reality so the answer might not be that useful because it is a high number.
I found this thread where someone wrote the following test to actually create a class with increasing amounts of functions to see where the breaking point was:
namespace MethodCountLimitFinder
{
class Program
{
[System.STAThreadAttribute]
static void Main ( string [] args )
{
Microsoft.CSharp.CSharpCodeProvider provider =
new Microsoft.CSharp.CSharpCodeProvider() ;
System.CodeDom.Compiler.CompilerParameters cp =
new System.CodeDom.Compiler.CompilerParameters() ;
cp.GenerateExecutable = false ;
cp.GenerateInMemory = true ;
System.CodeDom.Compiler.CompilerResults cr = null ;
System.Text.StringBuilder inner =
new System.Text.StringBuilder ( "namespace Tester { class Test {" ) ;
int methodCount = 1000000 ;
while ( true )
{
System.Console.WriteLine ( methodCount ) ;
for ( int i = methodCount ; i > 0 ; i-- )
{
inner.AppendFormat ( "void M{0}(){{}}\n" , methodCount++ ) ;
}
inner.Append ( "}}" ) ;
cr = provider.CompileAssemblyFromSource ( cp , inner.ToString() ) ;
if ( cr.Errors.Count > 0 )
{
break;
}
inner.Remove ( inner.Length - 2 , 2 ) ;
}
foreach ( System.CodeDom.Compiler.CompilerError ce in cr.Errors )
{
System.Console.WriteLine ( ce.ToString() ) ;
}
}
}
}
Based on the results it looks like it is resource dependent, not the spec which is most likely not hard defined unless you tie it to a 32/64-bit index reference or something which I don't think is realistic since you will hit a resource limit probably first anyways.
The test got over 200k+ before failing due to lack of resources.
Again, interesting but not all that useful of information IMO.