Common Language Runtime detected an invalid program.
dbright
Posts: 4
Hello,
This issue was addressed in a previous (locked) thread, but the solution given does not work for me. I downloaded the trial today and got a few good runs in, but after making a few changes to the code, I now receive the "System.InvalidProgramException: Common Language Runtime detected an invalid program." error when running.
Here are the pertinent details:
- Running with ANTS Profiler Version 2.5.0, Build 492
- This error only occurs when running with a Debug build. I have ensured that the Release and Debug builds are synced.
- Both Debug and Release versions run fine when the profiler is not running.
- I was able to run the profiler on a Debug build after first downloading the trial. I identified a bottleneck and made a few small changes to the code. It was only after running my next test that the error appears. The changes I made were pretty small so I can't see how the code changes themselves would be causing this problem.
- The C# executable relies on two DLLs, one written in Managed C++ and the other unmanaged C++
- The failure always occurs in the same function in the Managed C++ DLL. Nothing stands out in this function as something that would cause this sort of exception to be thrown. This function exists about 8 functions deep on the call stack and is called as part of a button click event handler.
- Rebuilding the solution does not seem to help. Neither does rebooting.
- .NET CF Version: 1.1.4322.2032, Visual Studio.NET 2003
Please let me know if you have any suggestions as to how I can narrow the problem down. Thanks.
Doug
This issue was addressed in a previous (locked) thread, but the solution given does not work for me. I downloaded the trial today and got a few good runs in, but after making a few changes to the code, I now receive the "System.InvalidProgramException: Common Language Runtime detected an invalid program." error when running.
Here are the pertinent details:
- Running with ANTS Profiler Version 2.5.0, Build 492
- This error only occurs when running with a Debug build. I have ensured that the Release and Debug builds are synced.
- Both Debug and Release versions run fine when the profiler is not running.
- I was able to run the profiler on a Debug build after first downloading the trial. I identified a bottleneck and made a few small changes to the code. It was only after running my next test that the error appears. The changes I made were pretty small so I can't see how the code changes themselves would be causing this problem.
- The C# executable relies on two DLLs, one written in Managed C++ and the other unmanaged C++
- The failure always occurs in the same function in the Managed C++ DLL. Nothing stands out in this function as something that would cause this sort of exception to be thrown. This function exists about 8 functions deep on the call stack and is called as part of a button click event handler.
- Rebuilding the solution does not seem to help. Neither does rebooting.
- .NET CF Version: 1.1.4322.2032, Visual Studio.NET 2003
Please let me know if you have any suggestions as to how I can narrow the problem down. Thanks.
Doug
This discussion has been closed.
Comments
The assumption that we currently have is that the IL is somehow getting 'scrambled' by the Profiler. We'd found this to happen in some specific applications before and applied a fix for it, which is why the thread had been closed out.
It would be fantastic if we could get a small code sample, or a snippet of code that causes this exception to be thrown. Do you have any code you can send? If you'd like, you can send it to our support email address.
Unfortunately, the system is amazingly complex so I don't think I'll be able to distill it down to a snippet that can reliably reproduce the problem. I will, however, be happy to send you the functions in the call stack, though it may be a bit verbose.
Thanks for your help.
Thanks for sending us the code. We can, in fact, reproduce the problem reliably here. I suspect it's the custom COM wrappers that you've got which are causing the problem.
We have an updated CORE component that we are testing that will solve the problem. I'll send the component to you when we're sure that it's 100% functional.
Fantastic. I suspected that that was at least a contributing cause of the problem. I'm looking forward to getting the updated component.
Thanks,
Doug
I am also getting this problem. It started happening only recently after I had modified my code. After my modifications, this error consistently occurs whenever I run it under the profiler.
I'm running Red Gate Profiler 2.5.0000, .NET runtime 2.0 beta 2, running on an XP Pro machine with SP2, under a Windows Limited User Account. Hardware setup is a P4 CPU 3.00GHz, 1.00GB RAM.
If necessary, I could track down the bits of code causing this, as I believe I have already scoped it down to a single method that causes the Profiler error. Let me know if you need this information.
I will mail you our latest core component to see if it works for you.
Thanks,
Tom