Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Json.NET + VerificationException Operation could destabilize the runtime

Tags:

c#

json.net

I am getting the "Operation could destablize the runtime exception". I goggled quite a bit, looks like exception has to do with conflicting assemblies being loaded at runtime. So, here are couple of things

  1. the same source code works in my colleagues machine.
  2. I looked and searched for each reference to NewtonSoft.Json.dll and it seems like its coming from a same assembly. (I think this would not be a problem as it is working in other people machine).
  3. I am using Raven which references NewtonSoft, but its not being used on the server side only on the client / silverlight side. Also to be compatible I am referencing to the same version of Newtonsoft that raven is referencing to.

Now, the problem might be something I installed in the machine that's affecting this. some runtime / SP install etc. Is there a way to debug / figure out what's happening here. I looked and searched for NewtonSoft.dll when the app runs and it gets right version in the temporary asp.net files. ?

Any help could be greatly appreciated. I don't want to go through installing my runtime.

like image 430
bkhanal Avatar asked May 11 '11 17:05

bkhanal


3 Answers

This exception can occur when you have Visual Studio Ultimate and IntelliTrace activated.

Try to add Newtonsoft.dll on IntelliTrace ignore list:

  • Tools -> Options -> IntelliTrace -> Modules
  • Add -> Newtonsoft.
like image 128
Stéphane Bebrone Avatar answered Nov 12 '22 07:11

Stéphane Bebrone


This bug is fixed in the latest version of Json.NET - http://james.newtonking.com/archive/2012/01/23/json-net-4-0-release-6-serialization-performance.aspx

like image 3
James Newton-King Avatar answered Nov 12 '22 08:11

James Newton-King


This is a known issue.

You should be able to fix this by removing all references to the JSON .NET library and adding them again to the projects.

See also:

http://json.codeplex.com/workitem/20624

JSON.Net throwing System.Security.VerificationException: Operation could destabilize the runtime

like image 2
aKzenT Avatar answered Nov 12 '22 06:11

aKzenT