2016-09-16 68 views
1

當我嘗試從Visual Studio 2015內部進行編譯時,出現以下錯誤跟蹤。有沒有其他人經歷過這個?使用PostSharp編譯時出錯4.3.20

Error  Unhandled exception (4.3.20.0, postsharp-net40-x86-srv.exe, CLR 4.0.30319.394271, Release): System.NullReferenceException: Object reference not set to an instance of an object. 
    at PostSharp.Sdk.CodeModel.GenericMap.GetGenericParameter(GenericParameterKind kind, Int32 ordinal) 
    at PostSharp.Sdk.CodeModel.TypeSignatures.GenericParameterTypeSignature.MapGenericArguments(GenericMap genericMap) 
    at PostSharp.Sdk.CodeModel.MethodDefDeclaration.WriteReflectionName(StringBuilder stringBuilder, ReflectionNameOptions options, NameMapper mapper) 
    at PostSharp.Sdk.CodeModel.WriteReflectionNameExtensions.GetDisplayName(IWriteReflectionName declaration) 
    at PostSharp.Sdk.Extensibility.Licensing.LocalLicenseManager.^BLnBYDPkLE/l(MetadataDeclaration _0, TypeDefDeclaration _1, List`1 _2, List`1 _3, ^hjDNKkMra\+ry _4) 
    at PostSharp.Sdk.AspectWeaver.AspectWeaver.^Rb+2eJKK(MetadataDeclaration _0) 
    at PostSharp.Sdk.AspectWeaver.AspectWeaverInstance.ProvideAdviceTransformations(AspectWeaverTransformationAdder adder) 
    at PostSharp.Sdk.AspectWeaver.AspectWeaverTask.^5t5Tu4zL(AspectWeaverInstance _0) 
    at PostSharp.Sdk.AspectWeaver.AspectWeaverTask.^vPCloP06(IMetadataDeclaration _0, AspectWeaverInstance _1) 
    at PostSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary`1.^lNgKC+Z4(IMetadataDeclaration _0, Func`3 _1) 
    at PostSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary`1.^RdBVqi\.M.^8/pSq47Q(IMetadataDeclaration _0) 
    at PostSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary`1.^d+wOzSPF(IMetadataDeclaration _0, Func`2 _1) 
    at PostSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary`1.^+g+TCqVg(TypeDefDeclaration _0, Func`2 _1, Set`1 _2) 
    at PostSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary`1.^fJqG(Func`2 _0) 
    at PostSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary`1.^fJqG(Func`3 _0) 
    at PostSharp.Sdk.AspectWeaver.AspectWeaverTask.Execute() 
    at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase) 
    at PostSharp.Sdk.Extensibility.Project.Execute() 
    at PostSharp.Hosting.PostSharpObject.ExecuteProjects() 
    at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation). 

編輯:在試圖製造一個示例項目爲了這個,我能事業隔離。我們有一個OnMethodBoundary方面(內部記錄之一)應用於public static implicit operator T(Editable<T> item)類型。當我告訴PostSharp排除這種方法時,問題就消失了。

所以要重現它,請在使用Express許可證時將OnMethodBoundary應用於通用隱式運算符。

[ExceptionLoggerAspect] 
class Challenged<T> 
{ 
    public T Value { get; set; } 

    public static implicit operator T(Challenged<T> item) 
    { 
     return item.Value; 
    } 
} 
+0

您能否與我們分享重現該問題的項目?還是一個樣例項目的行爲方式相同? –

+0

@AntonínProcházka我添加了一種簡單的複製方式。在找到這個時,我能夠解決這個問題。 –

回答

1

的變通最後我用是使用AttributeExclude =真在一般類型的隱式操作,這對我們是OnMethodBoundaryAspect上被多播。

[ErrorLoggingAspect(AttributeExclude = true)] 
public static implicit operator T(Editable<T> item) 
{ 
    ... 
} 
+1

在PostSharp 4.3.22中已修復此問題。 – AlexD