I Keep Getting "Operation could destabilize the runtime"

178 views
Skip to first unread message

Johnnys

unread,
Jan 24, 2011, 9:23:25 AM1/24/11
to ravendb
Hi,

I just got the latest stable release and I'm running Raven in Embedded
mode inside an MVC 3.0 app.
All was working with build 240, I'm pretty sure it was 240.
And I keep getting the "Operation could destabilize the runtime"
exception.

the code I'm trying to execute is

using (IDocumentSession documentSession =
_documentStore.OpenSession())
{
documentSession.Store(token);
documentSession.SaveChanges();
}

the token class looks like

public class Token
{
public string Id { get; set; }
public string TokenString { get; set; }
public int UserId { get; set; }
}

its failing on the Store Method and i'm getting the stack trace below.
So I don't think I'm doing anything weird.

Cheers

Johnny


at
Newtonsoft.Json.Serialization.DefaultContractResolver.CreateMemberValueProvider(MemberInfo
member) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json
\Serialization\DefaultContractResolver.cs:line 635
at
Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperty(MemberInfo
member, MemberSerialization memberSerialization) in d:\Development
\Releases\Json\Working\Src\Newtonsoft.Json\Serialization
\DefaultContractResolver.cs:line 648
at
Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperties(Type
type, MemberSerialization memberSerialization) in d:\Development
\Releases\Json\Working\Src\Newtonsoft.Json\Serialization
\DefaultContractResolver.cs:line 614
at
Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type
objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json
\Serialization\DefaultContractResolver.cs:line 279
at
Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type
objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json
\Serialization\DefaultContractResolver.cs:line 525
at
Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type
type) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json
\Serialization\DefaultContractResolver.cs:line 185
at
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.GetContractSafe(Type
type) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json
\Serialization\JsonSerializerInternalReader.cs:line 101
at
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader
reader, Type t, JsonConverter propertyConverter) in d:\Development
\Releases\Json\Working\Src\Newtonsoft.Json\Serialization
\JsonSerializerInternalReader.cs:line 933
at
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader
reader, Type objectType) in d:\Development\Releases\Json\Working\Src
\Newtonsoft.Json\Serialization\JsonSerializerInternalReader.cs:line
117
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader
reader, Type objectType) in d:\Development\Releases\Json\Working\Src
\Newtonsoft.Json\JsonSerializer.cs:line 421
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader,
Type objectType) in d:\Development\Releases\Json\Working\Src
\Newtonsoft.Json\JsonSerializer.cs:line 413
at Raven.Database.Json.JsonExtensions.JsonDeserialization[T]
(JObject self) in c:\Builds\raven\Raven.Abstractions\Extensions
\JsonExtensions.cs:line 105
at Raven.Client.Document.HiLoKeyGenerator.GetNextHi() in c:\Builds
\raven\Raven.Client.Lightweight\Document\HiLoKeyGenerator.cs:line 108
at Raven.Client.Document.HiLoKeyGenerator.NextId() in c:\Builds
\raven\Raven.Client.Lightweight\Document\HiLoKeyGenerator.cs:line 76
at
Raven.Client.Document.HiLoKeyGenerator.GenerateDocumentKey(DocumentConvention
convention, Object entity) in c:\Builds\raven\Raven.Client.Lightweight
\Document\HiLoKeyGenerator.cs:line 57
at
Raven.Client.Document.MultiTypeHiLoKeyGenerator.GenerateDocumentKey(DocumentConvention
conventions, Object entity) in c:\Builds\raven\Raven.Client.Lightweight
\Document\MultiTypeHiLoKeyGenerator.cs:line 60
at
Raven.Client.Document.DocumentStore.<>c__DisplayClass2.<Initialize>b__1(Object
entity) in c:\Builds\raven\Raven.Client.Lightweight\Document
\DocumentStore.cs:line 368
at
Raven.Client.Document.DocumentConvention.GenerateDocumentKey(Object
entity) in c:\Builds\raven\Raven.Client.Lightweight\Document
\DocumentConvention.cs:line 130
at
Raven.Client.Document.InMemoryDocumentSessionOperations.GetOrGenerateDocumentKey(Object
entity) in c:\Builds\raven\Raven.Client.Lightweight\Document
\InMemoryDocumentSessionOperations.cs:line 524
at
Raven.Client.Document.InMemoryDocumentSessionOperations.Store(Object
entity) in c:\Builds\raven\Raven.Client.Lightweight\Document
\InMemoryDocumentSessionOperations.cs:line 478
at FishIce.Repository.EmbeddedRavenDb.TokenRepository.New(Token
token) in C:\Users\johnny\My Dropbox\Notes\Src
\FishIce.Repository.EmbeddedRavenDb\TokenRepository.cs:line 21
at FishIce.Controllers.HomeController.Index() in C:\Users\johnny\My
Dropbox\Notes\Src\FishIce\Controllers\HomeController.cs:line 28
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase
controller, Object[] parameters)
at
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary`2 parameters)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary`2
parameters)
at
System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter, ActionExecutingContext preContext, Func`1 continuation)

Ayende Rahien

unread,
Jan 24, 2011, 9:25:06 AM1/24/11
to ravendb
This looks like a problem in de-serializing values.
What runtime are you running under?
Can you give me a small repro?

Johnnys

unread,
Jan 24, 2011, 12:00:16 PM1/24/11
to ravendb
ok, i just put together the repro and send it to your email.

cheers

johnny

BTW running under 4.0
> > Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract( Type
> > objectType) in d:\Development\Releases\Json\Working\Src\Newtonsoft.Json

Ayende Rahien

unread,
Jan 25, 2011, 8:17:19 AM1/25/11
to rav...@googlegroups.com
Got your repro... and it is working on my machine.
Are you running some hotfix for the runtime?  Maybe SP beta or something like that?
I have .NET 4.0 & MVC 3.0 installed on this machine.

jalchr

unread,
Jan 25, 2011, 9:40:54 AM1/25/11
to ravendb
I don't think the serializer has an exception like this

"Operation could destabilize the runtime"

What do you have installed on your machine ?

Anti-virus ... scanners ... File or Disk utilities ?


On Jan 25, 3:17 pm, Ayende Rahien <aye...@ayende.com> wrote:
> Got your repro... and it is working on my machine.
> Are you running some hotfix for the runtime?  Maybe SP beta or something
> like that?
> I have .NET 4.0 & MVC 3.0 installed on this machine.
>

Ayende Rahien

unread,
Jan 25, 2011, 9:43:45 AM1/25/11
to rav...@googlegroups.com
This is an indication of badly emitted IL, most frequently.
You see this when you are dealing with Reflection Emit, unsafe code, etc.
We don't have that on our end, but I think JSON.Net is using this.
That said, it doesn't happen on my machine which leads me to think that this is something that is likely to be related to some hotfix.

Johnnys

unread,
Jan 26, 2011, 5:33:06 AM1/26/11
to ravendb
the only thing i knowingly installed was ITune's!. I haven't installed
VS 2010 sp1 beta or anything like that , just because of things like
this, but over the past couple of days VS and blend have been very
flaky.

i took a copy of the repro to work and its fine on my work machine.
Sounds like its time for a reinstall.

cheers

Johnny

Alexander Nyquist

unread,
Jul 13, 2011, 1:23:29 PM7/13/11
to rav...@googlegroups.com
Thought i answer this as the problem came up for me, even when using the latest Nuget package.

The problem has to do with IntelliTrace (in Visual Studio 2010 Ultimate). A solution is to ignore JSON.NET in IntelliTrace. This is done by:

Debug -> Options and Settings -> IntelliTrace -> Modules -> Add *Newtonsoft*

Hope this helps, it did for me.
Reply all
Reply to author
Forward
0 new messages