Hi,
I have an SL app that displays dashboards using the XamTileView in combination with the XamDataChart and XamGrid. Since upgrading to Silverlight 5 the following issue now occurs:
System.AccessViolationException was unhandled Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. InnerException:
Click here for the call stack from VS - https://skydrive.live.com/?cid=09f71a6daa654209#cid=09F71A6DAA654209&id=9F71A6DAA654209%21259
The ImageColumn is set up as follows:
column = new ImageColumn { Key = string.Format("Column{0}", j), HeaderText = label, Width = new ColumnWidth(columnWidth, false), ImageWidth = 16, ImageHeight = 16, ImageStyle = Application.Current.Resources["KpiStatusIconStyle"] as Style, ValueConverter = Application.Current.Resources["StatusIconConverter"] as IValueConverter, MinimumWidth = 30 };
I am running the latest version of the SL client - 5.1.10411.0
Can you please advice of potential solutions.
Regards,
Chris
Hello Chris,
Thank you for your post. I have been looking into it but it seems like that I am missing something in your scenario, so could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
Hi Stefan,
This issue is emerging from an Enterprise application and I do not currently have the time/resources to try and recreate the issue on a small scale.
To give you some more information, we are using PRISM and MVVM to build the application. Once a piece of analysis has been visualised on a dashboard i.e. data retrieved and rendered as a chart/grid etc., the visualisation itself is stored in a ViewModel and not recreated when re-accessed by navigating away and then back. When the control is re-bound to display itself again the following code is run to ensure the visual tree can add the control again:
public static void ClearParent(object obj) { if (obj == null) return;
var control = obj as FrameworkElement;
if (control == null) return;
var contentPresenter = control.Parent as ContentPresenter; if (contentPresenter != null) { contentPresenter.Content = null; }
var contentControl = control.Parent as ContentControl; if (contentControl != null) { contentControl.Content = null; } }
Below is a link containing all the relevant XAML from the dependent components. This includes:
http://sdrv.ms/S0bLne
In the example visualisation control the first column in the grid is an ImageColumn. With the column included the browser crashes as explained in the original post. If the column is removed or the workaround I have come up with applied, all works as expected.
If you need any further information please let me know.
I have been looking into your post and the provided XAML, but without a sample, where the issue is reproduced I am not able to investigae this further for you, since it is not a known issue, so whenever you have time to create a small isolated project, we will be happy to assist you further.
Attached:
Solution with problem!
It could be useful to describe a scenario that throws the exception... :)
Press button 1 (Home) -> Homepage will be loaded (Yellow)
Press button 2 (Page 1) -> Page 1 will be loaded (Blue containing the grid)
Press button 3 (Page 2) -> Page 2 will be loaded (Green)
NOW press button 2 again...
Best regards,
Ingo