3

我安装了 Silverlight 5 VS 2010 工具和 64 位开发人员运行时,现在我在执行特定操作时收到 System.AccessViolationException。这些项目仍然是 Silverlight 4,我还没有升级它们。我在另一位开发人员的计算机(尚未安装 SL5)上验证了相同的代码在 SL4 中仍然有效。消息是:{System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.}它会杀死 IE。在单击删除确认 ChildWindow 的 ok 按钮并且未命中我在 ok 操作事件中的断点之后发生这种情况(我拥有的其他删除确认,使用类似的代码没有这个问题)。堆栈跟踪指向

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

VS 指向我的 RadDateTimePicker 自定义样式:"BindingDebugging!RadDateTimePickerxaml_2.BindingOperation_1100_562(object BindingState = {System.Windows.Data.Debugging.BindingDebugState}) Line 1 + 0x11 bytes Unknown"

我从控件和 App.xaml 中删除了样式,但仍然出现异常......这次它指向 Telerik 主题"The debugger will ask the user to find the file: Telerik.Windows.Controls.Input;Component\Themes\Office\Black\DateTimePicker.xaml"

我的同事提到,当他向 XMLWriter 发送一些格式错误的 XAML 时,他在 Silverlight 中看到了同样的异常。

我会在找到时添加更多信息。

有人知道在该样式文件中要专门寻找什么吗?

编辑:我现在已经在几个地方看到了这一点,而不仅仅是连接到 DateTimePicker。我在http://forums.silverlight.net/p/245247/613094.aspx/1?p=True&t=634600762692144367交叉发布了这个。

我也通过这个堆栈跟踪得到了这个异常。它不会每次都发生,但是当我使用 RadNumericUpDown 更改矩形的宽度并调用 RaisePropertyChanged("Width") 时:>

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   

编辑#2:这似乎相关:http ://forums.silverlight.net/p/178858/402638.aspx

编辑#3:我无法在我的项目之外重现这个。我也没有通过注释掉用户控件和代码部分来阻止这种情况的发生。我什至从 XAML 和它似乎连接到的 RadNumericUpDown 中删除了绑定。我还没有删除我们的自定义样式,也许这是接下来要尝试的东西......有谁知道我如何重现这个并从那里工作?

编辑#4:他们根据以下内容使用最新版本对其进行了修复:http: //10rem.net/blog/2012/05/09/silverlight-51104110-released-today

4

5 回答 5

3

当数据绑定到隐藏元素时,我看到了这个异常。我们有一些基于某些数据绑定可见或不可见的字段,但是这两个字段都使用另一个数据绑定进行了更新。当在隐藏字段上触发 RaisePropertyChanged 时,我们会收到 AccessViolationException。当控件不可见时,我必须在我的代码中添加一些检查以抑制 RaisePropertyChanged。

于 2011-12-14T22:53:58.823 回答
2

在更新到 Silverlight 5 后,我们“正在”遇到此问题。在各种控件的加载事件期间设置 (sender as RadComboBox).ItemsSources 时抛出了 AccessViolationException。这个错误很难重现,并且并不总是在相同的测试条件下抛出。但是,我认为最好的解决方法如下:

银光 4:

(sender as RadComboBox).ItemsSource = OurClass.MakeOurList();

当我添加时问题消失了......

银光 5:

(sender as RadComboBox).UpdateLayout();

(sender as RadComboBox).ItemsSource = OurClass.MakeOurList();

我相信这充其量只是一种“解决方法”,并希望听到更好的解决方案。但是现在我们已经恢复正常运行了!

于 2011-12-28T06:34:03.023 回答
1

对于我们几个小时前提交的同一问题,有一个Microsoft Connect 错误报告。请投票,以便尽快修复。

RadComboBox 已经包含一个解决方法,所以请检查您帐户下的最新内部版本,如果问题仍然存在,请告诉我们。这是关于同一问题的 Telerik 论坛主题。

我希望这有帮助。

于 2012-01-20T14:25:19.227 回答
1

我已经为我的自定义主题更新了 DateTimePicker.xaml,以使用 Microsoft 的 Textbox 与 RadWatermarkText 作为我的解决方法。崩溃已经停止,但是水印功能显然已经消失了。

大约一年前,我从 Telerik 下载了一个主题项目,这样我就可以让他们的控件看起来几乎和默认的一样好。如果你们中的任何人希望像我一样做同样的事情,那么您会在他们的下载中找到 DateTimePicker.xaml。

我发现 Telerik 控件对我的口味来说太错误了,所以我选择不通过订阅不断地向他们支付错误修复费用。

于 2012-03-28T18:58:12.623 回答
0

我终于找到了我的具体问题。它只发生在我继承的 ChildWindow 之后的一个元素上。

我有这个 hack 试图修复我几个月前遇到的错误。一旦我删除它,异常就停止了。我很确定由于其他地方的改进,我不再需要黑客了,所以这是双倍的奖励!我尝试在几个地方将调用编组回 UI 线程,但是计时器中的某些东西(应该在 UI 线程上)不允许它(这是我的理论)。祝所有寻找答案的人好运。迄今为止的+1!

this.Closed += (s, e) =>
{
var timer = new System.Windows.Threading.DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(.25);
timer.Tick += (object senderTimer, EventArgs eTimer) =>
{
    timer.Stop();

    // without the timer, the content will disappear before the window closes
    this.contentHolder.Child = null;
};

timer.Start();
};

我无法在单独的项目中使用 ChildWindow 重现此问题。所以这个答案不是那么有用。

于 2012-01-10T22:43:39.553 回答