Limit in number of line for a function?

  • Thread starter Thread starter Antonio C
  • Start date Start date
A

Antonio C

Hi all,
I've wrote a function with 967 line of code, when I try
to call it i receive a "NotSupportedException".
The strange thing is that if I try to comment about 185
line of code, in different location of the function, This
one work fine... so the question is:
In .NET CF exist a limit in number of line/amount of
memory for a function?

Thank you
Antonio.
 
One of the lines that you've commented out in all cases is responsible for
the problem. Run the program in the debugger and use the tools that are
available. If you can't figure out why a given line is giving the error,
*show us the line*.

Paul T.
 
There is no limit in the amount of source lines AFAIK.
However, in the Compact Framework, there is a 64K limit to
the amount of jitted code. It looks like you are reaching
that limit.

Regards,
Maarten Struys, eMVP
PTS Software bv
 
Each method can only contain 64kb of jitted code. A workaround is to break
your method up into several smaller blocks.

Peter
 
Thank you all for the support :)
I've splitted my function in 2 so now all work fine.

Next time i'll read the FAQ first :))
 
There is a limit for the length of a single line of code.
No line of code can exceed 2046 characters or you get
compiler errors in C#
 
True in most cases but I am working on an application
where I ran into that limit. The code in question is not
hand coded though its generated. I'm building an exam
engine (it doesn't have any long code) but each exam
product is a simple class with properties that are very
long text, the questions, the answers, and explanations
etc.
I generate the class files from a text file that has the
exam content.
Does that mean I need more medication? :)
 
Back
Top