Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


System.InvalidProgramException: Common Language Runtime detected an invalid program.

Posted on 2016-11-14
Medium Priority
Last Modified: 2016-11-28
Any ideas on where to start to figure out why we are getting this error?

System.InvalidProgramException: Common Language Runtime detected an invalid program.
   at DataManager.Select(String cs, String tsql, Dictionary`2 result)
   at AAIO.Models.AuthenticationMgr.ValidateSession()
Question by:wfcrr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 53

Expert Comment

by:Ryan Chong
ID: 41887256
check your method DataManager.Select , in which the program should tell in which line it hit the error.

DataManager.Select(String cs, String tsql, Dictionary`2 result)
I'm not too sure why there is a `2 there...

Author Comment

ID: 41891788
That didn't do anything. Are there any other suggestions?
LVL 53

Expert Comment

by:Ryan Chong
ID: 41892375
are you able to put the break points and Watch in your visual studio for debugging?

Using Breakpoints

Watch and QuickWatch Windows

Accepted Solution

wfcrr earned 0 total points
ID: 41892702
Found this on Stack Overflow, seems to have fixed us:
For VB .NET projects go to the project properties and under the Compile tab click Advanced Compile Options and un-check "Enable Optimizations".
For C# projects go to the project properties and under the Build tab un-check "Optimize Code".
If you are getting this error during a Release build make sure to change the Configuration under the project properties to "Release" then un-check "Enable Optimizations" or "Optimize Code" depending on the whether you are using C# or VB .NET.
Enable optimizations
By default, this check box is cleared to disable compiler optimizations. Select this check box to enable compiler optimizations. Compiler optimizations make your output file smaller, faster, and more efficient. However, because optimizations cause code rearrangement in the output file, compiler optimizations can make debugging difficult.
-Excerpt taken from Advanced Compiler Settings Dialog Box, MSDN

Author Closing Comment

ID: 41903936
this solved the problem

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question