Common Language Runtime detected an invalid program in Visual Studio
Only you have to delete temparory asp.net files from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
and then run your solution in asp.net.Now it will run properly.
I faced this issue by trying to invoke System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace() For this case the solution was to edit the project file and make sure the reference to related asembly looks exactly so:
<Reference Include="System.Management.Automation" />
Other ways to reference this assembly, via the VS 2012 asseblies picker and by picking the assembly into the physical location of reference assembly.
Can you reproduce the problem in a new solution without referencing any extra assemblies? If so, I think reinstalling would be your best bet. Sorry!
I never did find a solution for this issue online. But what fixed it for me, was to use the 'Clean Solution' option in Visual Studio.
Seems VS had gotten a little 'dirty', somehow.