c# - PostSharp: BindingException when using with Microsoft.Bcl in Windows Phone 7 project -
following code throws exception during compilation:
[pserializable] public class myaspectattribute : onmethodboundaryaspect { } [myaspect] task<object> method1<t>() { throw new notimplementedexception(); } i have tried find minimal set of action reproduce problem , here is:
- create empty windows phone 7.1 project
- add microsoft.bcl , postsharp nuget packages it
- create simple empty aspect (like below)
- add somewhere generic method returns type system.threading.tasks.dll
full exception text:
unhandled exception (3.0.31.0, 32 bit, clr 4.5, release): postsharp.sdk.codemodel.bindingexception: type 'system.threading.tasks.task`1' not exist in target platform. @ postsharp.sdk.codemodel.binding.reflectionbindingmanager.getreferenceassembly(iassemblyname assemblyname, string typename, bindingoptions bindingoptions) @ postsharp.sdk.codemodel.binding.reflectionbindingmanager.resolveassembly(type type, bindingoptions bindingoptions) @ postsharp.sdk.codemodel.moduledeclaration.findtype(type reflectiontype, bindingoptions bindingoptions) @ postsharp.sdk.codemodel.moduledeclaration.findtype(type reflectiontype, bindingoptions bindingoptions) @ ^xjbqcoexomcj.^i8lbkh1n(moduledeclaration _0, methodbase _1, bindingoptions _2) @ postsharp.sdk.codemodel.moduledeclaration.findmethod(methodbase reflectionmethod, bindingoptions bindingoptions) @ ^xjbqcoexomcj.^4irpp9et(object _0, imethod _1, type[] _2, type[] _3, bindingoptions _4) @ postsharp.sdk.codemodel.methoddefdeclaration.^nqb3cevx(bindingoptions _0) @ ^mzw3\.bgggrlj.^ccm832st[??0](object _0, bindingoptions _1, ^d1u4kzd5ajle _2) @ postsharp.sdk.codemodel.methoddefdeclaration.getsystemmethod(type[] generictypearguments, type[] genericmethodarguments, bindingoptions bindingoptions) @ postsharp.sdk.codemodel.methoddefdeclaration.^xha5o+hh(type[] _0, type[] _1, bindingoptions _2) @ postsharp.sdk.codemodel.metadatadeclaration.^udrjyqgbjz7t(type[] _0, type[] _1, bindingoptions _2) @ postsharp.sdk.aspectweaver.aspectweaverinstance..ctor(aspectweaver aspectweaver, aspectinstanceinfo aspectinstanceinfo) @ postsharp.sdk.aspectweaver.aspectweavers.methodlevelaspectweaverinstance..ctor(methodlevelaspectweaver aspectweaver, aspectinstanceinfo aspectinstanceinfo) @ ^wy1eta/ccvw/.createaspectweaverinstance(aspectinstanceinfo _0) @ postsharp.sdk.aspectweaver.aspectweavertask.^lp9i7zhc(instructionwriter _0, aspectinstanceinfo _1, structureddeclarationdictionary`1 _2) @ postsharp.sdk.aspectweaver.aspectweavertask.^vyy/rf6e.^qs9uz9qp(imetadatadeclaration _0, aspectinstanceinfo _1) @ postsharp.sdk.aspectinfrastructure.structureddeclarationdictionary`1.^lngkc+z4(imetadatadeclaration _0, func`3 _1) @ postsharp.sdk.aspectinfrastructure.structureddeclarationdictionary`1.^rdbvqi\.m.^8/psq47q(imetadatadeclaration _0) @ postsharp.sdk.aspectinfrastructure.structureddeclarationdictionary`1.^d+wozspf(imetadatadeclaration _0, func`2 _1) @ postsharp.sdk.aspectinfrastructure.structureddeclarationdictionary`1.^+g+tcqvg(typedefdeclaration _0, func`2 _1, set`1 _2) @ postsharp.sdk.aspectinfrastructure.structureddeclarationdictionary`1.^fjqg(func`2 _0) @ postsharp.sdk.aspectinfrastructure.structureddeclarationdictionary`1.^fjqg(func`3 _0) @ postsharp.sdk.aspectweaver.aspectweavertask.execute() @ postsharp.sdk.extensibility.project.executephase(string phase) @ postsharp.sdk.extensibility.project.execute() @ postsharp.hosting.postsharpobject.executeprojects() @ postsharp.hosting.postsharpobject.invokeproject(projectinvocation projectinvocation)
the exception by design in postsharp 3.0.31 because microsoft.bcl need supported explicitly. added feature request on http://postsharp.uservoice.com/forums/4949-general/suggestions/4225929-support-for-microsoft-bcl.
-gael
Comments
Post a Comment