VS2010 Silverlight RIA应用程序-在实体对象中的ValidateProperty和RaiseDataMemberChanged上获取ArgumentException [英] VS2010 Silverlight RIA Application - Getting ArgumentException on ValidateProperty and RaiseDataMemberChanged in Entity Object

查看:76
本文介绍了VS2010 Silverlight RIA应用程序-在实体对象中的ValidateProperty和RaiseDataMemberChanged上获取ArgumentException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行良好的Silverlight 4 RIA.在将SP1应用到VS2010之后,我重新编译了它,现在我遇到了以下异常:

I have a Silverlight 4 RIA that has been working great.  After applying SP1 to VS2010 I recompiled it and now I am getting the following exception:

System.ArgumentException未通过用户代码处理
  Message =已添加具有相同键的项目.
  StackTrace:
     在System.ThrowHelper.ThrowArgumentException(ExceptionResource资源)处
     在System.Collections.Generic.Dictionary`2.Insert中(TKey键,TValue值,布尔值添加)
     在System.Collections.Generic.Dictionary`2.Add(TKey键,TValue值)处
     在System.ServiceModel.DomainServices.Client.MetaType..ctor(类型类型)
     在System.ServiceModel.DomainServices.Client.MetaType.GetMetaType(类型类型)
     在System.ServiceModel.DomainServices.Client.ValidationResultCollection..ctor(父对象)
     在System.ServiceModel.DomainServices.Client.Entity.EntityValidationResultCollection..ctor(实体实体)
     在System.ServiceModel.DomainServices.Client.Entity.get_ValidationErrors()
     在System.ServiceModel.DomainServices.Client.Entity.get_HasValidationErrors()处
     在System.ServiceModel.DomainServices.Client.Entity.get_IsReadOnly()
     在System.ServiceModel.DomainServices.Client.Entity.ValidateProperty(String propertyName,Object value)
     在WavelengthIS.PIExpress.Demographic.set_Active(布尔值)处
     在WavelengthIS.PIExpress.Demographic.GetNew()
     在WavelengthIS.PIExpress.NewPatientOperation.SetupPatient()
     在WavelengthIS.PIExpress.NewPatientOperation._Closure $ __ 17._Lambda $ __ 36()
     在WavelengthIS.PIExpress.PatientOperation._Closure $ __ 14._Lambda $ __ 29(LoadOperation op)
     在System.ServiceModel.DomainServices.Client.DomainContext中.<> c__DisplayClass13`1.< Load> b__11(LoadOperation lo)
     在System.ServiceModel.DomainServices.Client.LoadOperation中.<> c__DisplayClass4`1.< Create> b__0(LoadOperation`1 arg)
     在System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
处      在System.ServiceModel.DomainServices.Client.OperationBase.Complete(对象结果)
     在System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult结果)中
     在System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
     在System.ServiceModel.DomainServices.Client.DomainContext中.<> c__DisplayClass1b.< Load> b__17(Object)
  InnerException

System.ArgumentException was unhandled by user code
  Message=An item with the same key has already been added.
  StackTrace:
       at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
       at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
       at System.ServiceModel.DomainServices.Client.MetaType..ctor(Type type)
       at System.ServiceModel.DomainServices.Client.MetaType.GetMetaType(Type type)
       at System.ServiceModel.DomainServices.Client.ValidationResultCollection..ctor(Object parent)
       at System.ServiceModel.DomainServices.Client.Entity.EntityValidationResultCollection..ctor(Entity entity)
       at System.ServiceModel.DomainServices.Client.Entity.get_ValidationErrors()
       at System.ServiceModel.DomainServices.Client.Entity.get_HasValidationErrors()
       at System.ServiceModel.DomainServices.Client.Entity.get_IsReadOnly()
       at System.ServiceModel.DomainServices.Client.Entity.ValidateProperty(String propertyName, Object value)
       at WavelengthIS.PIExpress.Demographic.set_Active(Boolean Value)
       at WavelengthIS.PIExpress.Demographic.GetNew()
       at WavelengthIS.PIExpress.NewPatientOperation.SetupPatient()
       at WavelengthIS.PIExpress.NewPatientOperation._Closure$__17._Lambda$__36()
       at WavelengthIS.PIExpress.PatientOperation._Closure$__14._Lambda$__29(LoadOperation op)
       at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo)
       at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
       at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
       at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Object result)
       at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult result)
       at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
       at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
  InnerException

每当我尝试为我的任何RIA Entity对象的任何公共属性分配值时,都会发生这种情况.当该属性的Setter一部分调用ValidateProperty或RaiseDataMemberChanged时,将引发错误.我试了一堆 不同的解决方法,但都没有成功.我完全卸载了VS2010,并在没有SP1的情况下进行了重新安装,并重新安装了Silverlight 4工具包和适用于Silverlight v1.0的WCF RIA,没有问题.有什么想法吗? Google搜索显示了一对 其他有类似问题的人,但是没有提供解决方案.

This happens whenever I attempt to assign a value to any public property of any of my RIA Entity objects.  The error will throw when ValidateProperty or RaiseDataMemberChanged is called as part of the Setter for the property.  I have tried a bunch of different work arounds with no success.  I completely uninstalled VS2010 and reinstalled without SP1, along with reinstalling the Silverlight 4 Toolkit and WCF RIA for Silverlight v1.0, no dice.  Any ideas?  A Google search reveals a couple other people with a similar problem, however there are no solutions offered.

感谢您的帮助和考虑!

推荐答案

不确定是什么原因导致了此问题,但似乎Dictionary集合已经存在相同的键,因此项目无法插入其中.也许问题出在您的程序而不是环境中,可以粘贴您的项目代码吗?
Not sure what reasons cause this issue, but it seems that the Dictionary collection has already exist the same key, so that the item cannot insert into it. maybe the problem is in your program instead of environment, could you paste your project code?


这篇关于VS2010 Silverlight RIA应用程序-在实体对象中的ValidateProperty和RaiseDataMemberChanged上获取ArgumentException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆