Main Site Documentation

CLR_E_OUT_OF_RANGE compile-time error: code too big?


#1

Wtf?.. I add a few extra lines (totally normal lines, not some magic spells) and I can’t compile my code anymore! Am I hitting some hardcoded limits?..

(if I remove the lines, code compiles).


#2

Oh, and it works under Release configuration. If there are any code size limits, I’d like to know!..


#3

The max heap single allocation about 700k. Which also means your assemblies must be less than 700k each.

I think this is what you are seeing.


#4

Ummmm… This is a compile-time error, does heap come into play already?..

Also, the largest .pe file is ~140kB is size (all of them summing to something ~280k).


#5

That is an old error that pops up here and there from time to time in different situations.

https://www.ghielectronics.com/community/forum/topic?id=4483&page=1


#6

Unfortunately, all the underlying links are broken :frowning: I can only [em]assume [/em]splitting assemblies will help. So annoying :frowning:


#7

I worked around this one by breaking up my main into different projects.


#8

Splitting a project that is not supposed to split is such a awkward idea :frowning: I wonder if those hard limitations are still relevant these days…


#9

Basically, there are different limits that you can run into that will report that same error.

Found the info for one of the broken links:

http://www.aspnet-answers.com/microsoft/NET-Microframework/30965316/mirco-framework-error-clreoutofrange.aspx


#10

Nice explained indeed…

[quote]…This tells a bit more about the specific limit that has been reached. In
this case, a single assembly is limited to 65Kb of MSIL. …[/quote]

And this make sense after reading this…

[quote]Unfortunately, this is currently a hard limit within the MicroFramework.
Fortunately, there is a workaround for this. It is necessary simply to
break up the application into separate assemblies…
[/quote]


#11

[/quote]

Makes sense, yes, until my app come into scene :slight_smile: Which is simply not suitable for artificial splitting :wall: It is just as big as a mountain…