Common Language Runtime detected an invalid program

Common Language Runtime detected an invalid program


Does anyone out there ever encountered this error while using Outsystems?
"Common Language Runtime detected an invalid program"

After a little search on the Web i found out that this was a limitation of .NET 2.0 Framework and it's JIT compiler, that limited the maximum size of a method, to about 32000 lines of code. This error could be resolved with an update to .NET 2.0 Framework Service Pack 1, however, since the application is still in testing fase, changes were made to that same function and now it doesn't work again.

The error is different do. On the first time, there appeared an error page with the error message mentioned above. Now, when the problematic function is invoked, the browser just hangs, and you can see the progress bar in the statusbar increasingly really slowly. After a while (a couple of minutes), either an error page appears mentioning that "You are not authorized to view this page." or Windows requests your username and password, but no user seems to work.

Similar to both errors is that the debugger doesn't enter the action code, and substituting this action for a smaller one, or erasing some of it's code (quite a bit, do), the problem is resolved. The latest is, however, not a viable option as all the code is needed.

This only happens in the production machine and not in the development one. The main software differences I see that can influence this issue is, one has Visual Studio and it's hotfixes installed and
the other doesn't. Other differences are: one has outsystems express edition and the other has a licensed version; the sql server versions are different; and one has win xp installed and the other, if i'm not mistaken, has windows server 2003 (could be win xp also, i'm not sure)

I'd apprecciate if someone could help me solve this problem quickly or give me any ideias of what could be the cause of it.


Nuno Freire
Hi Nuno,

For problems in production machines you'll get quicker support if you contact OutSystems Technical Support directly ( I've forwarded them your case and you should be contacted very soon.

Tiago Simões
Hi Nuno,
I also had that same error. And as you, I searched the web for information on that generic error and concluded that the action was generating too many lines of code.
The action I had was actually very large and I wasn't able to debug it and some times not even to enter the action (Service Studio was always crashing or hanging).
The solution for me was to divide the code of that action in sub-actions. Is this impossible for you? You don't have to eliminate code, just to break it in smaller pieces.
Hello Ana

The other solution for this problem, as Nuno pointed, is installing the Service Pack 1 for the .NET Framework 2.0, which solves that issue and allows you to keep your actions as big as you want. That download is available from Microsoft at

With best regards,
Hi Acácio,

Thanks for the link!
The problem for me is that the client I am at, still has .Net Framework 1.1.
I didn't find any update/service pack to solve this problem in .Net Framework 1.1. If you know some solution for this case, please post it here!
Anyway, dividing the action solved the problem and made the code more "readable", but it would be nice not to have this limitation.

Hello Ana,

Thanks for your help.

Splitting the code in smaller actions would be possible but it required a lot of effort to do so, as the global actions don't have access do page variables, and I would have to pass them along one by one.

Also, the client didn't like that solution as they mentioned that if in the future the action needed to grow more, they didn't want to have the same error occuring.

In the end, the Outsystems technical support were really helpfull and they solutioned the problem.

if you like i can send you the mail they sent me, with necessary steps to do so in my case...

Nuno Freire
i have this same problem. can someone help me out.

Nuno Freire can you help me with this. Can you send me the email that the tech support send you?

I'm reaching my deadline and need this project done asap, please help. You can reach me at my email:

Your help would be a pleasure of mine. Thanks in advance.