CLR 检测到无效程序
需要任何帮助、想法来解决这个问题。
我们正在开发一个应用程序,该应用程序可以调用 SAP 以使用 ERPConnect 发布一些数据。我们在 WCF 服务的实体框架调用之一中遇到以下问题。我们使用的是.NET4.0,Win 2008 Server。
该活动包含以下信息:
exception in getting ****getrebateproposal**-****Common Language Runtime detected an invalid program.****** at System.Data.Entity.DynamicProxies.RebateProposal_E1004D9B0153012E0A7A09FC9B574872909349EC992253740AB3C066FC63CF4D.set_Id(Decimal )
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at CommercialTermsRepository.GetRebateProposalsAmountToPay(String rebateAgreement) in D:\Projects\TFS\CIT V2\DataModel\BusinessObjects\CommercialTermsRepository.cs:line 794
at SAPInterface.RebateProposalService.SetZv41Data(List`1 uploadRebates) in D:\Projects\TFS\CIT V2\Server\UserService\RebateProposalService.svc.cs:line 187
Need any help, ideas to figure out this issue.
We are working on an application that makes a call to SAP for posting some data using ERPConnect. We encounter the following issues in one of our Entity Framework call in our WCF service. We are using .NET4.0, Win 2008 Server.
The following information was included with the event:
exception in getting ****getrebateproposal**-****Common Language Runtime detected an invalid program.****** at System.Data.Entity.DynamicProxies.RebateProposal_E1004D9B0153012E0A7A09FC9B574872909349EC992253740AB3C066FC63CF4D.set_Id(Decimal )
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at CommercialTermsRepository.GetRebateProposalsAmountToPay(String rebateAgreement) in D:\Projects\TFS\CIT V2\DataModel\BusinessObjects\CommercialTermsRepository.cs:line 794
at SAPInterface.RebateProposalService.SetZv41Data(List`1 uploadRebates) in D:\Projects\TFS\CIT V2\Server\UserService\RebateProposalService.svc.cs:line 187
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
还有一些需要注意的事情:
And a few things to look for:
这件事得到解决了吗?我遇到了类似的问题
InvalidProgramException:公共语言运行时检测到无效程序。
当动态代理尝试设置十进制类型的主键的属性时,会发生异常。这与我遇到的错误情况相同。我可以使用一个简单的 Gridview 和一个由一张表组成的数据库来重现该问题。
我使用标准 POCO 模板来生成上下文和代理。
如果您的环境可行,解决方法是将主键更改为 int。它看起来像是框架中的一个错误。
Did this ever get resolved? I'm running into a similar problem
InvalidProgramException: Common Language Runtime detected an invalid program.
The exception is occurring when the Dynamic Proxy is trying to set the property for a Primary Key that is of type decimal. This is the same error case I have. I am able to reproduce the problem with a simple Gridview and a database consisting of one table.
I am using the standard POCO templates to generate the Context and Proxies.
A workaround would be to change the primary key to an int if this is possible in your environment. It looks like a bug in the framework.