Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight 5 AccessViolationException

I installed the Silverlight 5 VS 2010 tools and the 64-bit Developer runtime and now I get a System.AccessViolationException when I do a specific action. The projects are still Silverlight 4, I haven't upgraded them. I verified on another developer's computer (who doesn't have SL5 installed yet) that the same code still works in SL4. The message is:{System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.} and it kills IE. It's happening after a delete confirmation ChildWindow's ok button is clicked and my breakpoint in the ok action event is not hit (the other delete confirmations I have, using the similar code do not have this problem). The stack trace points to

System.Windows.dll!MS.Internal.XcpImports.SetValue(MS.Internal.IManagedPeerBase obj = {Telerik.Windows.Controls.RadWatermarkTextBox}, System.Windows.DependencyProperty property, string s) + 0x6f bytes    

VS is pointing to my RadDateTimePicker custom style: "BindingDebugging!RadDateTimePickerxaml_2.BindingOperation_1100_562(object BindingState = {System.Windows.Data.Debugging.BindingDebugState}) Line 1 + 0x11 bytes Unknown"

I removed the style from the controls and the App.xaml and still get an exception... This time it points to a Telerik theme "The debugger will ask the user to find the file: Telerik.Windows.Controls.Input;Component\Themes\Office\Black\DateTimePicker.xaml"

My coworker mentioned that he saw the same exception in Silverlight when he sent in some malformed XAML to an XMLWriter.

I'll add more information as I find it.

Anybody know what to look for specifically in that style file?

EDIT: I've seen this in a few places now, not just connected to the DateTimePicker. I cross posted this at http://forums.silverlight.net/p/245247/613094.aspx/1?p=True&t=634600762692144367.

I also get this exception with this stack trace. It doesn't happen every time, but it is when I'm changing the width of a rectangle using a RadNumericUpDown and the RaisePropertyChanged("Width") is called: >

System.Windows.dll!MS.Internal.XcpImports.SetValue(MS.Internal.IManagedPeerBase obj = {Telerik.Windows.Controls.PickerTextBox}, 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 = {System.Windows.CoreDependencyProperty}, ref System.Windows.EffectiveValueEntry newEntry = {System.Windows.EffectiveValueEntry}, object newValue = "103") + 0x35 bytes    
    System.Windows.dll!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.DependencyProperty property = {System.Windows.CoreDependencyProperty}, System.Windows.EffectiveValueEntry oldEntry, ref System.Windows.EffectiveValueEntry newEntry, System.Windows.DependencyObject.ValueOperation operation) + 0xe6 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.Controls.TextBox.Text.set(string value) + 0x33 bytes  
    Telerik.Windows.Controls.Input!Telerik.Windows.Controls.RadNumericUpDown.UpdateText() + 0x50 bytes  
    Telerik.Windows.Controls.Input!Telerik.Windows.Controls.RadNumericUpDown.OnValueChanged(Telerik.Windows.Controls.RadRangeBaseValueChangedEventArgs e = {Telerik.Windows.Controls.RadRangeBaseValueChangedEventArgs}) + 0xd6 bytes   

EDIT #2: this seems related: http://forums.silverlight.net/p/178858/402638.aspx

EDIT #3: I have not been able to reproduce this outside of my project. I also haven't stopped this from happening by commenting out UserControls and sections of code. I've even removed the binding from the XAML and the RadNumericUpDown that it seems to be connected to. I haven't removed our custom styles yet, maybe that's something to try next... Does anyone know how I can reproduce this and work from there?

EDIT #4: They fixed it with the latest version according to: http://10rem.net/blog/2012/05/09/silverlight-51104110-released-today

like image 730
AlignedDev Avatar asked May 05 '26 23:05

AlignedDev


1 Answers

I'm seeing this exception when databinding to a hidden element. We have some fields that are visible or not based on some databinding, but both of those fields are updated with another databinding. When the RaisePropertyChanged is fired on the hidden field we get the AccessViolationException. I had to add some checks to my code to suppress the RaisePropertyChanged when the control isn't visible.

like image 69
mikecousins Avatar answered May 10 '26 08:05

mikecousins



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!