从Silverlight 4升级到Silverlight 5导致AccessViolationException

时间:2012-01-05 14:14:52

标签: silverlight silverlight-4.0 access-violation silverlight-5.0

我们已将项目从Silverlight 4升级到Silverlight 5,现在我们正在体验 AccessViolationException不时在代码中的不同位置,此异常也会导致浏览器崩溃。

有没有指导如何防止这种情况发生?

我正在添加弹出AccessViolationException的堆栈跟踪:

[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]

4 个答案:

答案 0 :(得分:3)

我找到了问题的一个来源(我不确定它是否解决了所有这些AccessViolationException问题),但我的系统现在更加稳定。

显然,使用 TextBox 中的 Bureau Black Theme,导致了这个问题。

我所做的就是重新编译这个主题而不使用TextBox的样式,并且AccessViolation的问题已经消失,在这个阶段我们没有对整个系统进行深入测试,但这解决了一个我可以快速重现的问题,所以我认为这可能会解决更多这样的问题。

希望它有所帮助。

此致

利奥尔

答案 1 :(得分:2)

好的,我找到了解决方案。以前我在Mainpage.xaml文件中设置了整体应用样式/主题 - 主题在运行时波及到所有子导航页面。这导致了问题。

如果我明确地逐页设置样式 - 一切正常!!

因此:(使用BureauBlue工具包主题)

xmlns:SystemColors="clr-namespace:System.Windows.Controls.Theming;     assembly=System.Windows.Controls.Theming.BureauBlue" 

<SystemColors:BureauBlueTheme>
    <Grid x:Name="LayoutRoot">

。  。  。              

答案 2 :(得分:1)

更新绑定到文本框的属性时,使用Bureau Blue也会导致相同的System.AccessViolationException。

对我有用的解决方法是将TextBox样式从Theme dll复制到合并到App.xaml资源字典中的ResourceDictionary中。这样做可以避免在每个视图上指定主题。

我使用的主题来自2010年4月的工具包。我不知道后来的工具包版本是否可以解决这个问题。

答案 3 :(得分:0)

我的猜测是它是运行时安装错误,还是浏览器加载项或防病毒软件。

以这种方式排除故障:

  1. DrWatson日志显示什么? Tess Ferrandez有很多关于如何读取崩溃日志的信息。或者在此发布您的崩溃日志。
  2. 是否会在不同的浏览器中发生?
  3. 你可以关闭任何附加组件吗?
  4. 是否会在所有计算机上发生?
  5. 您的应用是否使用任何COM自动化或PInvoke?