Upgrade From Silverlight 4 to Silverlight 5 causing AccessViolationException?

I have found one source of the issue (I am not sure that it solved all these AccessViolationException issues), but my system is much more stable now.

Up vote 5 down vote favorite 5 share g+ share fb share tw.

We have upgraded our project from Silverlight 4 to Silverlight 5 and now we are experiencing AccessViolationException from time to time in different places in the code, this exception is also causing the browser to crash. Is there any guideline how to prevent this from happening? I am adding the stack trace where the AccessViolationException was popped: Managed to Native Transition System.Windows.

Dll!MS.Internal.XcpImports. SetValue(MS.Internal. IManagedPeerBase obj, System.Windows.

DependencyProperty property, string s) + 0x6f bytes System.Windows. Dll!MS.Internal.XcpImports. SetValue(MS.Internal.

IManagedPeerBase doh, System.Windows. DependencyProperty property, object obj) + 0x2ce bytes System.Windows. Dll!System.Windows.

DependencyObject. SetObjectValueToCore(System.Windows. DependencyProperty dp, object value) + 0xd6 bytes System.Windows.

Dll!System.Windows. DependencyObject. SetEffectiveValue(System.Windows.

DependencyProperty property, ref System.Windows. EffectiveValueEntry newEntry, object newValue) + 0x35 bytes System.Windows. Dll!System.Windows.

DependencyObject. UpdateEffectiveValue(System.Windows. DependencyProperty property, System.Windows.

EffectiveValueEntry oldEntry, ref System.Windows. EffectiveValueEntry newEntry, System.Windows. DependencyObject.

ValueOperation operation) + 0xe6 bytes System.Windows. Dll!System.Windows. DependencyObject.

RefreshExpression(System.Windows. DependencyProperty dp) + 0x47 bytes System.Windows. Dll!System.Windows.Data.

BindingExpression. SendDataToTarget() + 0xff bytes System.Windows. Dll!System.Windows.Data.

BindingExpression.SourceAcquired() + 0x5f bytes System.Windows. Dll!System.Windows.Data.Debugging. BindingBreakPoint.

BreakOnSharedType. AnonymousMethod__3() + 0x14 bytes Native to Managed Transition Managed to Native Transition mscorlib. Dll!System.Delegate.

DynamicInvokeImpl(object args) + 0x6b bytes mscorlib. Dll!System.Delegate. DynamicInvoke(object args) + 0xb bytes BindingDebugging!

TextPropertyPanelxaml_5. BindingOperation(object BindingState) + 0x30 bytes Native to Managed Transition Managed to Native Transition System.Windows. Dll!System.Windows.Data.Debugging.

BindingBreakPoint. BreakOnSharedType(System. Type emittedType, System.Windows.Data.Debugging.

BindingDebugState debugState, int bindingNumber, int line, int column, System. Action callback) + 0xd5 bytes System.Windows. Dll!System.Windows.Data.Binding.

EnsureBreakPoint(System.Windows.Data.Debugging. BindingDebugState debugState, System. Action callback, bool canDelay) + 0x1ff bytes System.Windows.

Dll!System.Windows.Data. BindingExpression.System.Windows. IDataContextChangedListener.

OnDataContextChanged(object sender, System.Windows. DataContextChangedEventArgs e) + 0xa4 bytes System.Windows. Dll!System.Windows.Data.

BindingExpression. DataContextChanged(object sender, System.Windows. DataContextChangedEventArgs e) + 0xc bytes System.Windows.

Dll!System.Windows. FrameworkElement. OnDataContextChanged(System.Windows.

DataContextChangedEventArgs e) + 0x1e bytes System.Windows. Dll!System.Windows. FrameworkElement.

OnAncestorDataContextChanged(System.Windows. DataContextChangedEventArgs e) + 0x26 bytes System.Windows. Dll!System.Windows.

FrameworkElement. NotifyDataContextChanged(System.Windows. DataContextChangedEventArgs e) + 0xcb bytes System.Windows.

Dll!System.Windows. FrameworkElement. OnAncestorDataContextChanged(System.Windows.

DataContextChangedEventArgs e) + 0x32 bytes System.Windows. Dll!System.Windows. FrameworkElement.

NotifyDataContextChanged(System.Windows. DataContextChangedEventArgs e) + 0xcb bytes System.Windows. Dll!System.Windows.

FrameworkElement. OnPropertyChanged(System.Windows. DependencyProperty dp) + 0x47 bytes System.Windows.

Dll!System.Windows. DependencyObject. RaisePropertyChangeNotifications(System.Windows.

DependencyProperty dp, object oldValue, object newValue) + 0x5e bytes System.Windows. Dll!System.Windows. DependencyObject.

UpdateEffectiveValue(System.Windows. DependencyProperty property, System.Windows. EffectiveValueEntry oldEntry, ref System.Windows.

EffectiveValueEntry newEntry, System.Windows. DependencyObject. ValueOperation operation) + 0xf3 bytes System.Windows.

Dll!System.Windows. DependencyObject. SetValueInternal(System.Windows.

DependencyProperty dp, object value, bool allowReadOnlySet, bool isBindingInStyleSetter) + 0x248 bytes System.Windows. Dll!System.Windows. FrameworkElement.DataContext.

Set(object value) + 0x28 bytes ContentManagerSilverlight! ContentManagerSilverlight. TextPropertyPanel.

Set_ItemDetails(ContentManagerClientTypes.ServiceLibrary. ItemDetails value) Line 132 + 0xd bytes ContentManagerSilverlight! ContentManagerSilverlight.

PropertiesPanelControl. SetPanelsVisability(ContentManagerClientTypes.ServiceLibrary. ItemDetails p_item) Line 78 + 0x1f bytes ContentManagerSilverlight!

ContentManagerSilverlight. PropertiesPanelControl. HandleEvents(Object p_sender, String p_propertyName, Object p_propertyValue) Line 130 + 0x35 bytes ContentManagerClientTypes!

ContentManagerClientTypes.Messenger. Send(Object p_sender, String p_propertyName, Object p_propertyValue) Line 34 + 0x55 bytes ContentManagerSilverlight! ContentManagerSilverlight.

LibraryViewModel. Set_SelectedItemDetails(ContentManagerClientTypes.ServiceLibrary. ItemDetails value) Line 181 + 0x25 bytes Native to Managed Transition Managed to Native Transition System.Windows.

Dll!System.Windows. CLRPropertyListener.Value. Set(object value) + 0x23 bytes System.Windows.

Dll!System.Windows. PropertyAccessPathStep.Value. Set(object value) + 0xe bytes System.Windows.

Dll!System.Windows.Data. BindingExpression.UpdateValue() + 0x692 bytes System.Windows. Dll!System.Windows.Data.Debugging.

BindingBreakPoint. BreakOnSharedType. AnonymousMethod__3() + 0x14 bytes Native to Managed Transition Managed to Native Transition mscorlib.

Dll!System.Delegate. DynamicInvokeImpl(object args) + 0x6b bytes mscorlib. Dll!System.Delegate.

DynamicInvoke(object args) + 0xb bytes BindingDebugging! LibraryThumbViewxaml. BindingOperation(object BindingState) + 0x30 bytes Native to Managed Transition Managed to Native Transition System.Windows.

Dll!System.Windows.Data.Debugging. BindingBreakPoint. BreakOnSharedType(System.

Type emittedType, System.Windows.Data.Debugging. BindingDebugState debugState, int bindingNumber, int line, int column, System. Action callback) + 0xd5 bytes System.Windows.

Dll!System.Windows.Data.Binding. EnsureBreakPoint(System.Windows.Data.Debugging. BindingDebugState debugState, System.

Action callback, bool canDelay) + 0x1ff bytes System.Windows. Dll!System.Windows.Data. BindingExpression.

UpdateValueEnsureBreak() + 0x53 bytes System.Windows. Dll!System.Windows.Data. BindingExpression.

UpdateValueIfNecessary() + 0x68 bytes System.Windows. Dll!System.Windows.Data. BindingExpression.

TargetPropertyChanged(System.Windows. DependencyObject sender, System.Windows. DependencyProperty dp) + 0x2b bytes System.Windows.

Dll!System.Windows. DependencyObject. OnPropertyChanged(System.Windows.

DependencyProperty dp) + 0x16 bytes System.Windows. Dll!System.Windows. FrameworkElement.

OnPropertyChanged(System.Windows. DependencyProperty dp) + 0x54 bytes System.Windows. Dll!System.Windows.Controls.Primitives.Selector.

OnPropertyChanged(System.Windows. DependencyProperty dp) + 0x13 bytes System.Windows. Dll!System.Windows.

DependencyObject. RaisePropertyChangeNotifications(System.Windows. DependencyProperty dp, object oldValue, object newValue) + 0x5e bytes System.Windows.

Dll!System.Windows. DependencyObject. UpdateEffectiveValue(System.Windows.

DependencyProperty property, System.Windows. EffectiveValueEntry oldEntry, ref System.Windows. EffectiveValueEntry newEntry, System.Windows.

DependencyObject. ValueOperation operation) + 0xf3 bytes System.Windows. Dll!System.Windows.

DependencyObject. SetValueInternal(System.Windows. DependencyProperty dp, object value, bool allowReadOnlySet, bool isBindingInStyleSetter) + 0x1c9 bytes System.Windows.

Dll!System.Windows.Controls.Primitives.Selector. UpdatePublicSelectionProperties(int oldSelectedIndex, int newSelectedIndex, object oldSelectedItem, object newSelectedItem) + 0xca bytes System.Windows. Dll!System.Windows.Controls.Primitives.Selector.

SelectionChanger.End() + 0x172 bytes System.Windows. Dll!System.Windows.Controls.Primitives.Selector. SelectionChanger.

SelectJustThisItem(int oldIndex, int newIndex) + 0x170 bytes System.Windows. Dll!System.Windows.Controls.ListBox. MakeSingleSelection(int index) + 0x3e bytes System.Windows.

Dll!System.Windows.Controls.ListBox. HandleItemSelection(System.Windows.Controls. ListBoxItem item, bool isMouseSelection) + 0x7a bytes System.Windows.

Dll!System.Windows.Controls.ListBox. OnListBoxItemClicked(System.Windows.Controls. ListBoxItem item) + 0x7 bytes System.Windows.

Dll!System.Windows.Controls.ListBoxItem. OnMouseLeftButtonDown(System.Windows.Input. MouseButtonEventArgs e) + 0x54 bytes System.Windows.

Dll!System.Windows.Controls.Control. OnMouseLeftButtonDown(System.Windows.Controls. Control ctrl, System.

EventArgs e) + 0x38 bytes System.Windows. Dll!MS.Internal.JoltHelper. FireEvent(System.

IntPtr unmanagedObj, System. IntPtr unmanagedObjArgs, int argsTypeIndex, int actualArgsTypeIndex, string eventName, uint flags) + 0x28f bytes Appdomain Transition silverlight silverlight-4.0 access-violation silverlight-5.0 link|improve this question edited Jan 15 at 15:53 asked Jan 5 at 14:14liorklain914.

1 Not a real answer, so I'm putting this in the comments. But it seems you're not alone: stackoverflow.com/questions/8495242/…, forums.silverlight.net/t/245247.aspx/1, ... – Peter Jan 5 at 14:48 I'm still fighting with this one. Are you able reproduce this?

I'm not able to make this happen outside of my project. – Aligned Jan 5 at 19:13 Are you using Telerik's controls? They have fixed one occurrence of this (I've been following some links, copying this info here).

– jv42 Jan 6 at 14:40 I am not using telerik controls, didn't tried to create a test project, – liorklain Jan 8 at 7:35 @jv42: Have Telerik provided any info about the fix, what it required, or even the cause of this behavior? – MichaelS Jan 8 at 20:02.

I have found one source of the issue (I am not sure that it solved all these AccessViolationException issues), but my system is much more stable now. Apparently the use of Bureau Black Theme from the latest toolkit, with combination of TextBox, caused this issue. What I have done to solve it is to recompile this theme without the Style of the TextBox and the issue of AccessViolation has disappeared, at this stage we didn't do deep testing on the entire system, but this is solving an issue that I could repro rapidly so I assume that this might have fixed more issues like that.

Hope it helped someone. Regards, Lior.

Ok, I've found a solution. Previously I had the overall app styles/theme set in the Mainpage. Xaml file - and the theme rippled down to all child navigation pages at runtime.

This was causing the problem somehow. If I explictly set the style on a page by page basis - everything works! Thus: (using the BureauBlue toolkit theme) xmlns:SystemColors="clr-namespace:System.Windows.Controls.

Theming; assembly=System.Windows.Controls.Theming. BureauBlue" .

My guess is it is either a faulty runtime installation, or browser add-on or antivirus. Troubleshoot it this way: What does DrWatson logs show? Tess Ferrandez has a lot of information on how to read crash logs.

Or post your crash log here. Does it happen with different browsers? Can you turn off any Add-Ons?

Does it happen on all computers? Does your app use any COM automation or PInvoke?

2 This error reaccour on different computers (more than 2) and on different browsers. – liorklain Jan 11 at 11:23 Please post your crash log. – Chui Tey Jan 11 at 20:22 I have also attached screen shot to the qustion, but this is what I get as exception.

System. AccessViolationException was unhandled Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

InnerException: – liorklain Jan 15 at 15:43 Have a look at this ContentManagerSilverlight! ContentManagerSilverlight. TextPropertyPanel.

Set_ItemDe? Tails Perhaps it is cross-thread access. – Chui Tey Jan 15 at 22:43 No, it is happenning from the Main thread of the application (i have doubled checked it from my Visual Studio) – liorklain Jan 16 at 10:07.

We have the same thing happening on a TextBox_GotFocus() event, where I perform a ((TextBox)sender).SelectAll(); call. The code is fine in the Silverlight 4 runtime, but executing it on a PC with Silverlight 5 installed crashes out the browser. We have tried this on several different machines with the same result - getting users to downgrade back to the 4.

X runtime fixes it everytime. This is obviously a bug on Microsofts side - no matter what, it should never result in the browser crashing!. However we need this code to run in Silverlight 4 first and foremost - so any fix has to work in that version too.

We are using the Bureau Blue style in this app. Will try it without the styles, but it still doesn't explain why its failing?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions