Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight 引发ErrorsAnged事件时INotifyDataErrorInfo ArgumentOutOfRangeException_Silverlight_Validation_Silverlight 4.0_Inotifydataerrorinfo - Fatal编程技术网

Silverlight 引发ErrorsAnged事件时INotifyDataErrorInfo ArgumentOutOfRangeException

Silverlight 引发ErrorsAnged事件时INotifyDataErrorInfo ArgumentOutOfRangeException,silverlight,validation,silverlight-4.0,inotifydataerrorinfo,Silverlight,Validation,Silverlight 4.0,Inotifydataerrorinfo,这是一个非常复杂的问题,在这一点上,我认为这可能与我的机器配置有关 基本上,我已经创建了一个非常标准的INotifyDataErrorInfo实现,在某些情况下,当引发ErrorsChanged事件时,我会得到一个ArgumentOutOfRangeException。此异常不包含太多信息;它为我提供了跨越本机/托管边界的ArgumentOutOfRangeException以及关于非负索引和集合大小的标准ArgumentOutOfRangeException说明。InnerException为

这是一个非常复杂的问题,在这一点上,我认为这可能与我的机器配置有关

基本上,我已经创建了一个非常标准的
INotifyDataErrorInfo
实现,在某些情况下,当引发
ErrorsChanged
事件时,我会得到一个
ArgumentOutOfRangeException
。此异常不包含太多信息;它为我提供了跨越本机/托管边界的
ArgumentOutOfRangeException
以及关于非负索引和集合大小的标准
ArgumentOutOfRangeException
说明。
InnerException
为空。堆栈跟踪如下所示:

at System.ThrowHelper
        .ThrowArgumentOutOfRangeException(ExceptionArgument argument,
                                           ExceptionResource resource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
at System.Collections.ObjectModel.ReadOnlyCollection`1.get_Item(Int32 index)
我之所以提到我的机器配置,是因为我尝试了一些发布到博客上的解决方案(如和),但遇到了相同的问题(即不是我的代码,是INotifyDataErrorInfo的另一个实现),而在任何其他人的评论中都没有提到我遇到的问题。谷歌搜索发现了一些随机的点击,但没有帮助

要求的国家如下:

at System.ThrowHelper
        .ThrowArgumentOutOfRangeException(ExceptionArgument argument,
                                           ExceptionResource resource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index)
at System.Collections.ObjectModel.ReadOnlyCollection`1.get_Item(Int32 index)
  • 我已在控件中输入一个值,从而触发验证错误。(这工作正常,错误文本将按预期显示在UI中)
  • 然后,我在控件中输入一个新值,这样验证将成功,错误将从错误集合中删除(HasErrors返回false)
  • 正在引发ErrorsAnged以将此更改反映为无错误的成功验证,并且发生异常
  • 更新:如果将焦点从显示验证错误的文本框移开,我也可以复制

    我有点想知道我是否错过了service pack/更新之类的东西,因为从我所看到的情况来看,框架代码中似乎有一个相当基本的错误,同时其他代码中也没有发生这种错误

    更新:我正在使用Silverlight 4的最终RTM版本。不是RC或Beta版。

    更新:我得到了与随附的官方MS样本相同的结果

    更新:我现在已经在另一台机器上测试了我的代码和上面提到的示例,效果很好。我仍然很想解决这个问题,因为它不能在我的常规机器上工作,这有点令人不安(我到现在为止还没有遇到任何问题)。任何关于我如何追踪导致这种情况的原因的建议都将不胜感激。我已经在问题机器上重新安装了Silverlight(运行时、SDK、工具包),但这并没有解决问题

    更新:以下是框架代码的调用堆栈,通过使用MS symbol server启用源服务器支持获得异常:

    mscorlib.dll!System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument argument, System.ExceptionResource resource) + 0x40 bytes 
      mscorlib.dll!System.ThrowHelper.ThrowArgumentOutOfRangeException() + 0x10 bytes 
      mscorlib.dll!System.Collections.Generic.List<System.Windows.Controls.ValidationError>.this[int].get(int index = 0) + 0x13 bytes 
      mscorlib.dll!System.Collections.ObjectModel.Collection<System.Windows.Controls.ValidationError>.this[int].get(int index) + 0x2e bytes 
      mscorlib.dll!System.Collections.ObjectModel.ReadOnlyCollection<System.Windows.Controls.ValidationError>.this[int].get(int index) + 0x2e bytes 
      [Native to Managed Transition] 
      [Managed to Native Transition] 
      System.Windows.dll!System.Windows.IndexerListener.Value.get() + 0xc3 bytes 
      System.Windows.dll!System.Windows.IndexerPathStep.Value.get() + 0x17 bytes 
      System.Windows.dll!System.Windows.PropertyPathListener.RaisePropertyPathStepChanged(System.Windows.PropertyPathStep source = {System.Windows.IndexerPathStep}) + 0x17 bytes 
      System.Windows.dll!System.Windows.IndexerPathStep.RaisePropertyPathStepChanged(System.Windows.PropertyListener source) + 0xe bytes 
      System.Windows.dll!System.Windows.IndexerListener.SourcePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs args) + 0xea bytes 
      System.Windows.dll!System.Windows.Data.WeakPropertyChangedListener.PropertyChangedCallback(object sender, System.ComponentModel.PropertyChangedEventArgs args) + 0x3d bytes 
      System.Windows.dll!System.Collections.ObjectModel.ReadOnlyObservableCollection<System.__Canon>.OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args) + 0x17 bytes 
      System.Windows.dll!System.Collections.ObjectModel.ReadOnlyObservableCollection<System.__Canon>.HandlePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + 0xe bytes 
      System.Windows.dll!System.Collections.ObjectModel.ObservableCollection<System.Windows.Controls.ValidationError>.OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) + 0x37 bytes 
      System.Windows.dll!System.Collections.ObjectModel.ObservableCollection<System.Windows.Controls.ValidationError>.RemoveItem(int index = 0) + 0x79 bytes 
      mscorlib.dll!System.Collections.ObjectModel.Collection<System.Windows.Controls.ValidationError>.Remove(System.Windows.Controls.ValidationError item) + 0x75 bytes 
      System.Windows.dll!System.Windows.Controls.Validation.RemoveValidationError(System.Windows.FrameworkElement fe = {System.Windows.Controls.TextBox}, System.Windows.Controls.ValidationError error) + 0x40 bytes 
      System.Windows.dll!System.Windows.Data.BindingExpression.RemoveErrorFromTarget(System.Windows.Controls.ValidationError error) + 0x48 bytes 
      System.Windows.dll!System.Windows.Data.BindingExpression.NotifyOldDataErrorInfos(System.Collections.ObjectModel.Collection<System.Windows.Controls.ValidationError> validationErrors) + 0x73 bytes 
      System.Windows.dll!System.Windows.Data.BindingExpression.NotifyOldDataErrorInfos(bool isNotifyChildDataErrorInfo) + 0x25 bytes 
      System.Windows.dll!System.Windows.Data.BindingExpression.NotifyDataErrorInfo_ErrorsChanged(object sender, System.ComponentModel.DataErrorsChangedEventArgs e) + 0xad bytes 
    
    mscorlib.dll!System.ThrowHelper.throwargumentofrangeexception(System.exception参数,System.exception资源)+0x40字节
    mscorlib.dll!System.ThrowHelper.ThrowArgumentOutOfRangeException()+0x10字节
    mscorlib.dll!System.Collections.Generic.List.this[int].get(int index=0)+0x13字节
    mscorlib.dll!System.Collections.ObjectModel.Collection.this[int].get(int索引)+0x2e字节
    mscorlib.dll!System.Collections.ObjectModel.ReadOnlyCollection.this[int].get(int索引)+0x2e字节
    [本机到托管转换]
    [管理到本机转换]
    System.Windows.dll!System.Windows.IndexerListener.Value.get()+0xc3字节
    System.Windows.dll!System.Windows.IndexerPathStep.Value.get()+0x17字节
    System.Windows.dll!System.Windows.PropertyPathListener.RaisePropertyPathStepChanged(System.Windows.PropertyPathStep源={System.Windows.IndexerPathStep})+0x17字节
    System.Windows.dll!System.Windows.IndexerPathStep.RaisePropertyPathStepChanged(System.Windows.PropertyListener源)+0xe字节
    System.Windows.dll!System.Windows.IndexerListener.SourcePropertyChanged(对象发送方,System.ComponentModel.PropertyChangedEventArgs)+0xea字节
    System.Windows.dll!System.Windows.Data.WeakPropertyChangedListener.PropertyChangedCallback(对象发送方,System.ComponentModel.PropertyChangedEventArgs参数)+0x3d字节
    System.Windows.dll!System.Collections.ObjectModel.ReadOnlyObservableCollection.OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs)+0x17字节
    System.Windows.dll!System.Collections.ObjectModel.ReadOnlyObservableCollection.HandlePropertyChanged(对象发送方,System.ComponentModel.PropertyChangedEventArgs e)+0xe字节
    System.Windows.dll!System.Collections.ObjectModel.ObservableCollection.OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e)+0x37字节
    System.Windows.dll!System.Collections.ObjectModel.ObservableCollection.RemoveItem(int index=0)+0x79字节
    mscorlib.dll!System.Collections.ObjectModel.Collection.Remove(System.Windows.Controls.ValidationError项)+0x75字节
    System.Windows.dll!System.Windows.Controls.Validation.RemoveValidationError(System.Windows.FrameworkElement fe={System.Windows.Controls.TextBox},System.Windows.Controls.ValidationError)+0x40字节
    System.Windows.dll!System.Windows.Data.BindingExpression.RemoveErrorFromTarget(System.Windows.Controls.ValidationError错误)+0x48字节
    System.Windows.dll!System.Windows.Data.BindingExpression.NotifyOldDataErrorInfos(System.Collections.ObjectModel.Collection validationErrors)+0x73字节
    System.Windows.dll!System.Windows.Data.BindingExpression.NotifyOldDataErrorInfos(bool isNotifyChildDataErrorInfo)+0x25字节
    System.Windows.dll!System.Windows.Data.BindingExpression.NotifyDataErrorInfo\u ErrorsAnged(对象发送方,System.ComponentModel.DataErrorsAngedEventArgs e)+0xad字节
    
    更新:应用程序(在有问题的机器上)运行良好,没有附加调试程序,工作正常,没有调用未处理的异常脚本(这有点难倒我了,不是吗