views:

73

answers:

1

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
+3  A: 
  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)
Philip Rieck
+1 for mentioning PEVerify, the super-duper-awesome il-verification program.
Simon Svensson