Following code throws exception during compilation:
[PSerializable]
public class MyAspectAttribute : OnMethodBoundaryAspect {
}
[MyAspect]
Task<object> Method1<T>() {
throw new NotImplementedException();
}
I have tried to find the minimal set of action to reproduce this problem and here it is:
Full exception text:
Unhandled exception (3.0.31.0, 32 bit, CLR 4.5, Release): PostSharp.Sdk.CodeModel.BindingException: The type 'System.Threading.Tasks.Task`1' does not exist in the target platform.
at PostSharp.Sdk.CodeModel.Binding.ReflectionBindingManager.GetReferenceAssembly(IAssemblyName assemblyName, String typeName, BindingOptions bindingOptions)
at PostSharp.Sdk.CodeModel.Binding.ReflectionBindingManager.ResolveAssembly(Type type, BindingOptions bindingOptions)
at PostSharp.Sdk.CodeModel.ModuleDeclaration.FindType(Type reflectionType, BindingOptions bindingOptions)
at PostSharp.Sdk.CodeModel.ModuleDeclaration.FindType(Type reflectionType, BindingOptions bindingOptions)
at ^XJbqCOExOmCj.^i8LBKh1N(ModuleDeclaration _0, MethodBase _1, BindingOptions _2)
at PostSharp.Sdk.CodeModel.ModuleDeclaration.FindMethod(MethodBase reflectionMethod, BindingOptions bindingOptions)
at ^XJbqCOExOmCj.^4IrPP9eT(Object _0, IMethod _1, Type[] _2, Type[] _3, BindingOptions _4)
at PostSharp.Sdk.CodeModel.MethodDefDeclaration.^NqB3CEvX(BindingOptions _0)
at ^Mzw3\.bgGgRlJ.^cCM832sT[??0](Object _0, BindingOptions _1, ^d1u4kZd5aJLe _2)
at PostSharp.Sdk.CodeModel.MethodDefDeclaration.GetSystemMethod(Type[] genericTypeArguments, Type[] genericMethodArguments, BindingOptions bindingOptions)
at PostSharp.Sdk.CodeModel.MethodDefDeclaration.^xHA5o+hH(Type[] _0, Type[] _1, BindingOptions _2)
at PostSharp.Sdk.CodeModel.MetadataDeclaration.^UDRJYqgBJZ7t(Type[] _0, Type[] _1, BindingOptions _2)
at PostSharp.Sdk.AspectWeaver.AspectWeaverInstance..ctor(AspectWeaver aspectWeaver, AspectInstanceInfo aspectInstanceInfo)
at PostSharp.Sdk.AspectWeaver.AspectWeavers.MethodLevelAspectWeaverInstance..ctor(MethodLevelAspectWeaver aspectWeaver, AspectInstanceInfo aspectInstanceInfo)
at ^wy1eTA/ccvw/.CreateAspectWeaverInstance(AspectInstanceInfo _0)
at PostSharp.Sdk.AspectWeaver.AspectWeaverTask.^lp9i7ZhC(InstructionWriter _0, AspectInstanceInfo _1, StructuredDeclarationDictionary`1 _2)
at PostSharp.Sdk.AspectWeaver.AspectWeaverTask.^Vyy/rF6E.^Qs9Uz9QP(IMetadataDeclaration _0, AspectInstanceInfo _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)
The exception is by design in PostSharp 3.0.31 because Microsoft.Bcl
would need to be supported explicitly. I added a feature request on http://postsharp.uservoice.com/forums/4949-general/suggestions/4225929-support-for-microsoft-bcl .
-gael
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.