6

Chúng tôi đã nâng cấp dự án từ Silverlight 4 lên Silverlight 5 và hiện tại chúng tôi đang trải qua AccessViolationException theo thời gian ở các vị trí khác nhau trong mã, ngoại lệ này cũng khiến trình duyệt bị lỗi .Nâng cấp Từ Silverlight 4 lên Silverlight 5 khiến AccessViolationException

Có hướng dẫn nào để ngăn điều này xảy ra không?

Tôi thêm stack trace nơi AccessViolationException được 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] 
+1

Không phải là câu trả lời thực sự, vì vậy tôi sẽ đưa điều này vào phần bình luận. Nhưng có vẻ như bạn không đơn độc: http://stackoverflow.com/questions/8495242/silverlight-5-accessviolationexception, http://forums.silverlight.net/t/245247.aspx/1, ... – Peter

+0

I vẫn đang chiến đấu với cái này. Bạn có thể tái tạo điều này không? Tôi không thể làm điều này xảy ra bên ngoài dự án của tôi. – Aligned

+0

Bạn đang sử dụng các điều khiển của Telerik? Họ đã khắc phục một sự cố này (tôi đã theo một số liên kết, sao chép thông tin này tại đây). – jv42

Trả lời

0

tôi đoán là nó là một trong hai cài đặt thời gian chạy bị lỗi, hoặc trình duyệt add-on hoặc chống virus.

Khắc phục sự cố theo cách này:

  1. không DrWatson bản ghi hiển thị gì? Tess Ferrandez có rất nhiều thông tin về cách đọc nhật ký sự cố. Hoặc đăng nhật ký sự cố của bạn tại đây.
  2. Điều đó có xảy ra với các trình duyệt khác không?
  3. Bạn có thể tắt bất kỳ Tiện ích bổ sung nào không?
  4. Điều đó có xảy ra trên tất cả các máy tính không?
  5. Ứng dụng của bạn có sử dụng bất kỳ tự động hóa COM hoặc PInvoke nào không?
+2

Lỗi này phản ứng trên các máy tính khác nhau (hơn 2) và trên các trình duyệt khác nhau. –

+0

Vui lòng đăng nhật ký sự cố của bạn. –

+0

Tôi cũng đã đính kèm ảnh chụp màn hình vào qustion, nhưng đây là những gì tôi nhận được như là ngoại lệ. System.AccessViolationException được unhandled Message = Đã cố gắng đọc hoặc ghi bộ nhớ được bảo vệ. Đây thường là dấu hiệu cho thấy rằng bộ nhớ khác bị hỏng. InnerException: –

3

Tôi đã tìm thấy một nguồn gốc của vấn đề (Tôi không chắc chắn rằng nó giải quyết tất cả các vấn đề AccessViolationException), nhưng hệ thống của tôi bây giờ ổn định hơn nhiều.

Dường như việc sử dụng Chủ đề đen của Cục từ bộ công cụ mới nhất, với sự kết hợp của TextBox, gây ra sự cố này.

Những gì tôi đã làm để giải quyết nó là để biên dịch lại chủ đề này mà không có Phong cách của TextBox và vấn đề AccessViolation đã biến mất, ở giai đoạn này, chúng tôi đã không làm xét nghiệm sâu trên toàn bộ hệ thống, nhưng điều này là giải quyết một vấn đề mà tôi có thể repro nhanh chóng vì vậy tôi cho rằng điều này có thể đã cố định nhiều vấn đề hơn như thế.

Hy vọng nó đã giúp ai đó.

Kính trọng,

Lior

2

Ok, tôi đã tìm ra một giải pháp. Trước đây tôi đã có phong cách ứng dụng tổng thể/chủ đề được đặt trong tệp Mainpage.xaml - và chủ đề được gợn sóng xuống tất cả các trang điều hướng con khi chạy. điều này đã gây ra vấn đề bằng cách nào đó.

Nếu tôi thiết lập kiểu dáng theo từng trang - mọi thứ đều hoạt động !!

Như vậy: (sử dụng chủ đề toolkit BureauBlue)

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

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

. . .

1

Việc sử dụng Office Blue cũng gây ra cùng một System.AccessViolationException khi cập nhật thuộc tính được liên kết với hộp văn bản.

Công việc xung quanh đã hiệu quả đối với tôi là sao chép kiểu TextBox từ dll Chủ đề vào một ResourceDictionary được hợp nhất vào từ điển tài nguyên App.xaml. Làm điều này tránh phải chỉ định chủ đề trên mỗi chế độ xem.

Chủ đề tôi đang sử dụng là từ bộ công cụ tháng 4 năm 2010. Tôi không biết liệu bản phát hành bộ công cụ sau có thể khắc phục được sự cố không.

Các vấn đề liên quan