2013-07-18 80 views
1

與Microsoft.Bcl使用下面的代碼時BindingException編譯期間拋出異常:PostSharp:在Windows Phone 7的項目

[PSerializable] 
public class MyAspectAttribute : OnMethodBoundaryAspect { 
} 

[MyAspect] 
Task<object> Method1<T>() { 
    throw new NotImplementedException(); 
} 

我試圖找到最少的一組動作的重現這個問題,那就是:

  1. 創建空的Windows Phone 7.1的項目
  2. 添加Microsoft.Bcl和PostSharp的NuGet包它
  3. 創建簡單的空方面(樣b elow)
  4. 添加返回從System.Threading.Tasks.dll任何類型的地方泛型方法

全部異常文本:

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) 
+1

我在我們的錯誤跟蹤系統(#3762)中記錄了這個問題。當我有新的東西時,我會回到你身邊。不好意思推遲了。在夏季,我們比平時慢了一點。 –

回答