6

我們已將項目從Silverlight 4升級到Silverlight 5,現在我們不時在代碼中的不同位置遇到 AccessViolationException,此異常還會導致瀏覽器崩潰。從Silverlight 4升級到導致AccessViolationException的Silverlight 5

有沒有任何指導方針如何防止這種情況發生?

我加入其中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] 
+1

不是一個真正的答案,所以我把它放在評論中。但似乎你並不孤單:http://stackoverflow.com/questions/8495242/silverlight-5-accessviolationexception,http://forums.silverlight.net/t/245247.aspx/1,... – Peter 2012-01-05 14:48:40

+0

我我仍然在爲這個而戰。你能重現嗎?我無法在我的項目之外做到這一點。 – Aligned 2012-01-05 19:13:54

+0

你在使用Telerik的控件嗎?他們已經修復了這種情況(我一直在關注一些鏈接,在這裏複製這些信息)。 – jv42 2012-01-06 14:40:28

回答

0

我的猜測是它要麼是一個錯誤的運行時安裝,或瀏覽器插件或殺毒軟件。

疑難解答這樣說:

  1. 是什麼DrWatson日誌顯示?苔絲費蘭德斯有很多關於如何閱讀崩潰日誌的信息。或者在這裏發佈你的崩潰日誌。
  2. 這是否發生在不同的瀏覽器?
  3. 你可以關閉任何插件嗎?
  4. 這是否發生在所有計算機上?
  5. 您的應用程序是否使用任何COM自動化或PInvoke?
+2

此錯誤在不同的計算機(超過2個) 和不同的瀏覽器上重複使用。 – 2012-01-11 11:23:00

+0

請發佈您的崩潰日誌。 – 2012-01-11 20:22:18

+0

我也附加了屏幕截圖,但這是我作爲例外。 System.AccessViolationException未處理 消息=試圖讀取或寫入受保護的內存。這通常表明其他內存已損壞。 InnerException: – 2012-01-15 15:43:02

3

我發現問題的一個來源(我不確定它解決了所有這些AccessViolationException問題),但我的系統現在更加穩定。

顯然使用局黑色主題,從最新的工具包,與文本框的組合,導致出現此問題。

我做了什麼來解決這個問題是重新編譯這個主題沒有文本框和AccessViolation問題的方式已經消失,在這個階段,我們沒有做對整個系統的測試深,但是這是解決了我可以快速複製的問題,所以我認爲這可能會解決更多問題。

希望它幫助了某人。

問候,

利奧爾

2

好吧,我已經找到了解決辦法。之前,我在Mainpage.xaml文件中設置了整體應用程序樣式/主題,並且主題在運行時反映到所有子導航頁面。這是以某種方式造成問題的原因。

如果我在頁面上明確設置樣式 - 一切正常!

因此:(使用BureauBlue工具箱主題)

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

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

。 。 。

1

使用Bureau Blue在更新綁定到文本框的屬性時也會導致相同的System.AccessViolationException異常。

對我而言,解決方法是將TextBox樣式從Theme dll複製到合併到App.xaml資源字典中的ResourceDictionary中。這樣做避免了必須在每個視圖上指定主題。

我使用的主題來自2010年4月的工具包。我不知道以後的工具包版本是否可以解決問題。