Error CLR_E_OUT_OF_RANGE

I just ran into this damn message again but after changing the compiler output to show more information I found this in the list.


Exceeded maximum number (255) of static methods: 255

This is certainly more helpful and I can try and break up the code to alleviate this issue.

Hopefully this will help others who have ran into this error.

Under tools and options, locate Projects and Solutions and then the Build and Run section. Change the MSBuild project build output verbosity to detailed. Don’t use DIAGNOSTIC as it generates a hell of a lot of stuff that means little. Now when you get this error you will see something like this (this is from my build)


3>  Exceeded maximum number (255) of static methods: 255
3>  Failed compiling type 'MNTEnergy7.Program'
3>MMP : error MMP0000: CLR_E_OUT_OF_RANGE

2 Likes

Interesting! That’s a limit I was not aware of. Thanks for sharing.

Well, that’s different. Do you suppose there is a list of these errors somewhere?

I simply removed 1 static function and rebuilt it and it compiled.

My main app is always static as I use pure NETMF but I wonder if I could get around this by creating a wrapper similar to what Gadgeteer does and make main a class I instantiate instead?

I again received this message after adding two extra static methods but in detailed output list there is:

1> Exceeded maximum size of stream ‘ByteCode’: 65578
1>MMP : error MMP0000: CLR_E_OUT_OF_RANGE

So I am wondering if it is somehow connected with “Exceeded maximum number (255) of static methods: 255” issue or this is something else.

More likely too much code in the assembly. Break it up into pieces (DLLs).