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

Posted on 2016-11-14
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 52

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 52

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

734 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