views:

173

answers:

2

Hello, If anyone can provide some help for this one, I'd be very grateful!

We are using: Silverlight 3 / MVVM / Blacklight DragDock Control / ComponentOne Silverlight Controls

I have a Silverlight application that relies heavily on the MVVM pattern. The application has seemingly been running fine, until recently. I have started to notice semi-random (semi-random = over a long enough period of time ~2 - 5 mins) I can reproduce a System.ExecutionEngineException coming from the PropertyChanged event being raised. The property name which the notification is being raised for is not always the same property name (the firing of the property change event happens in a base ViewModel class).

The code basically looks like this:

if (PropertyChanged != null) Application.Current.RootVisual.Dispatcher.BeginInvoke( () => PropertyChanged(this, new PropertyChangedEventArgs(propertyName)));

The code works for everything else in the application. Basically everything that throws off a property changed event goes through this. I'm not sure why this is failing all of a sudden. Please throw some thoughts my way.

I've been knee deep in windbg trying to get some grasp on what is going on, and still have very little. I'd by happy provide a dump or any other information that might be helpful. Obviously, there is very little information given from this particular error...

Thank you ahead of time, David Justice

A: 

A question you might ask yourself: is this ExecutionEngineException happening in IE only and, for instance, not in FireFox?

I know Silverlight is supposed to be browser-independent, but I already encountered a similar known Silverlight-issue that occured randomly in IE only.

The fact that you get an ExecutionEngineException is pointing out that the SL runtime blows up for some reason.

Xavier Decoster
Thank you for the idea. I was testing in firefox only, and I had really thought about testing it in ie b/c i assumed runtime independence. Unfortunately, I didn't see any change. I still see the runtime collapse after a handful of UI interaction cycles.I feel like i should be looking for a possible memory leak, or a UI control that is still listing to VM changes. I've been watching the memory and it seems to be cleaning up after itself as view remove them selves as they transition out of context.
Justice
A: 

This exception is quite the exotic one. If one gets thrown, it's Game Over, 0 Continues for the CLR. No managed code can catch that exception.

When I ran into it, it was the result of a driver writing into a buffer that wasn't marshaled properly and so was not pinned, and the CLR moved the buffer while the driver was writing into it. It wouldn't crash instantly, but usually happened after the mouse ran over the form's menu bar (which probably resulted in creating and destroying lots of small objects, which then lead to the CLR running the GC and compacting the managed heap). Even though one of my worker threads was communicating with the driver, it was the main thread that threw the exception, which made things way more confusing.

Make sure things are being marshaled properly. If ANYTHING is being passed back and forth to unmanaged code, make sure you use GCHandle to pin the objects.

ajs410