我剛剛將項目從VS2008/.NET 3.5/PostSharp 1.5升級到VS2010/.NET4.0/PostSharp 2.0。PostSharp導致BadImageException應用到通用方法 - 運行時出現錯誤peverify.exe
現在,運行單元測試系統時,我得到的形式hundereds例外:
System.BadImageFormatException:試圖加載程序格式不正確。 (從HRESULT異常:0x8007000B)在COMPANY.Data.NHibernate.BaseRepository.c__Binding`1.Invoke 在COMPANY(對象&例如,參數的參數,對象aspectArgs) 在PostSharp.Aspects.Internals.MethodInterceptionArgsImpl.Proceed() 。 C:\ COMPANY \ Code \ COMPANY-NET4.0 \ Core \ Aop \ TransactionAspectAttribute.cs中的Aop.TransactionAspectAttribute.OnInvoke(MethodInterceptionArgs上下文):第68行 位於COMPANY.Data.NHibernate.BaseRepository.Save [T](T scoreBigModel )位於C:\ COMPANY \ Code \ COMPANY-NET4.0 \ Core \ DataAccess \ NHibernate \ BaseRepository.cs中:第102行 位於COMPANY.UnitTests.DataAccess.NHibernate.when_saving_a_canonical_term。 < .ctor> b__5()in C:\ COMPANY \ Code \ COMPANY-NET4.0 \ UnitTests \ DataAccess \ NHibernate \ CanonicalTermRepositorySpecs.cs:line 29 at Machine.Specifications.Utility.RandomExtensionMethods.InvokeIfNotNull(因爲) at Machine.Specifications.Model.Context.EstablishContext()
當我在程序集上運行peverify.exe時,在下面的表單中看到數百個錯誤。總是似乎是通用方法的問題:
[IL]:錯誤:[C:\ COMPANY \ Code \ COMPANY-NET4.0 \ Core \ bin \ Debug \ COMPANY.Core.dll:COMPANY.Data.NHibernate .ActivationRepository + c__Binding :: Invoke] [offset 0x0000008D] [found ref'PostSharp.Aspects.Internals.MethodBinding'] [expected ref'PostSharp.Aspects.Internals.MethodBinding`1 [COMPANY.Models.Activation]']意外的類型on堆棧。
[IL]:錯誤:[C:\ COMPANY \ Code \ COMPANY-NET4.0 \ Core \ bin \ Debug \ COMPANY.Core.dll:COMPANY.Data.NHibernate.ActivationRepository + c__Binding :: Invoke] [[偏移0x00000056] [找到ref'PostSharp.Aspects.Internals.MethodBinding`1 [COMPANY.Models.Activation]'] [expected ref'PostSharp.Aspects.Internals.MethodBinding']堆棧上的意外類型。
我正在運行PostSharp 2.0 RC的最新版本。
你提供該產品的beta測試者,你需要發送反饋給供應商。系統需求需要VS2010 RC,不要試圖使VS2010 RTM可以工作。 – 2010-07-02 17:59:06
支持VS2010 RTM,RC不支持。這是該網站的一個錯誤。我會糾正它。 – 2010-07-02 20:19:27