CLR检测到一个无效的程序 [英] CLR detected an Invalid Program

查看:153
本文介绍了CLR检测到一个无效的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要任何帮助,思想要弄清楚这个问题。

我们正在开发一个应用程序,将调用到SAP张贴使用ERPConnect一些数据。我们遇到在我们在我们的WCF服务实体框架调用之一下列问题。我们使用的是.NET4.0,赢2008服务器。

下面的信息包括事件:

 例外地让**** getrebateproposal **  -  ****公共语言运行库检测到无效的程序******的。 System.Data.Entity.DynamicProxies.RebateProposal_E1004D9B0153012E0A7A09FC9B574872909349EC992253740AB3C066FC63CF4D.set_Id(Decimal )
       在lambda_method(封闭,牛头刨床)
       在System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly [TEntity](Func`2 constructEntityDelegate,的EntityKey的EntityKey,的EntitySet EntitySet的)
       在lambda_method(封闭,牛头刨床)
       在System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(整形整形)
       在System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
       在System.Collections.Generic.List`1..ctor(IEnumerable`1集合)
       在System.Linq.Enumerable.ToList [TSource](IEnumerable`1源)
       在CommercialTermsRepository.GetRebateProposalsAmountToPay(字符串rebateAgreement)在D:\项目\ TFS \ CIT V2 \的DataModel \的BusinessObjects \ CommercialTermsRepository.cs:行794
       在SAPInterface.RebateProposalService.SetZv41Data(List`1 uploadRebates)在D:\项目\ TFS \ CIT V2 \服务器\ UserService的\ RebateProposalService.svc.cs:行187
 

解决方案
  1. 您是否尝试过的EXE / DLL运行PEVerify,看看是否有任何问题?
  2. 你有没有尝试运行NGEN就可以了,看看NGEN不成?
  3. 您能后的失败code或小的摄制您的问题吗?

和几件事情需要寻找:

  • 是一个巨大的方法拉姆达? (也就是说,它是通过关闭一个的很多的值?) - 尝试将其移出使这一情况并非如此
  • 您是否使用具有在PARAMS或输出COM对象委托类型? (我已经受够了这问题在过去)

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

解决方案

  1. Did you try running PEVerify on the exe/dll to see if there are any issues?
  2. Did you try running ngen on it to see if ngen fails?
  3. Can you post the failing code or a small repro of your issue?

And a few things to look for:

  • Is the lambda in a gigantic method? (that is, is it closing over a lot of values?) - Try to move it out so that this is not the case
  • Are you using a delegate type that has a COM object in the params or output? (I've had issues with that in the past)

这篇关于CLR检测到一个无效的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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