[Mono-list] Better feedback from InvalidProgramException

Miguel de Icaza miguel at novell.com
Tue Mar 20 11:35:53 EDT 2007


Hello,

> I'm using reflection.emit and dynamic method to emit code at runtime.  
> Sometimes I have errors in the code I emit, but the only feedback I  
> get is InvalidProgramException with an IL offset. Is there any way to  
> find out what is wrong when I get these errors? If I get something like
> 
> IL_0585: call      0x000000ed
> 
> Mono must know what was wrong to throw the exception. Not enough on  
> the stack for example? Is there any way to get it to give me more  
> information? Is there any way to easily work out where in my code  
> IL_0585 was emitted?

Yes, run Mono on gdb (you will need a mono that you built with debugging
symbols) and then run:

	export MONO_DEBUG=break-on-unverified
	gdb mono
	(gdb) run program.exe

It will break at the place where it fails verification, look at the code
around it.



More information about the Mono-list mailing list