Search code examples
postsharp

PostSharp.Sdk.CodeModel.BindingException


When compiling my project, which is having a Postsharp aspect (OnMethodBoundaryAspect) getting the error as

"Unhandled exception (4.0.41.0, 32 bit, CLR 4.5, Release): PostSharp.Sdk.CodeModel.BindingException: Cannot get the reflection object".

But this error message appears only on few machines, and the same project file is compiling successfully on most of the other machines.

I am using Visual studio 2013 and .net framework 4.5. Postsharp dll version is 4.0.41

Please suggest the possible reason for this or any fix for this.

Thank you


Solution

  •   <dependentAssembly>
        <assemblyIdentity name="PostSharp"
                          publicKeyToken="b13fd38b8f9c99d7"
                          culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.39.0"
                         newVersion="4.0.39.0" />
      </dependentAssembly>
    

    app.config is the first place I would look for errors of this nature. Make sure the references are correct.

    Unfortunately though, I still get this error i some cases that I can't discover why yet.