Post-compilation unhandled error: Cannot find a method named '..' with signature ...

amiy's Avatar

amiy

04 Feb, 2018 06:35 AM

I'm using VS2015 (.NET 4.6.1) with Postsharp 5.0.43. We a a large solution with lots of projects.
We're using an external obfuscation tool.
We recently upgraded from Postsharp 4.3.21 to 5.0.43 because it has functionality we need (async support).
Since the upgrade, when compiling with this obfuscator, Postsharp's post compilation fails with this error:

C:\git\be\External\Postsharp\5.0.43\Tools\PostSharp.targets(314,5): error PS0099: Unhandled exception (postsharp-net40-x86-srv.exe release | .NET Framework 4.6.1): PostSharp.Sdk.CodeModel.BindingException: Cannot find a method named 'MapSortParameter' with signature '(System.Collections.Generic.ICollection`1<T><System.Data.IDataParameter>, ST.Dal.Sort) : void' in scope 'ST.Dal.Sql.Repository.BaseRepository`1<T>' (module = 'ST.Dal.Sql.dll').
C:\git\be\External\Postsharp\5.0.43\Tools\PostSharp.targets(314,5): error PS0099: at PostSharp.Sdk.CodeModel.Collections.MethodDefDeclarationCollection.GetMethod(String name, IMethodSignature signature, BindingOptions bindingOptions)
C:\git\be\External\Postsharp\5.0.43\Tools\PostSharp.targets(314,5): error PS0099: at PostSharp.Sdk.CodeModel.MethodRefDeclaration.GetMethodDefinition(BindingOptions bindingOptions)
C:\git\be\External\Postsharp\5.0.43\Tools\PostSharp.targets(314,5): error PS0099: at PostSharp.Sdk.Extensibility.Tasks.IndexGenericInstancesTask.Execute()
C:\git\be\External\Postsharp\5.0.43\Tools\PostSharp.targets(314,5): error PS0099: at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
C:\git\be\External\Postsharp\5.0.43\Tools\PostSharp.targets(314,5): error PS0099: at PostSharp.Sdk.Extensibility.Project.Execute()
C:\git\be\External\Postsharp\5.0.43\Tools\PostSharp.targets(314,5): error PS0099: at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
C:\git\be\External\Postsharp\5.0.43\Tools\PostSharp.targets(314,5): error PS0099: at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation).

dotPeek shows the obfuscation actually removes this method (MapSortParameter) for some reason, but code still calls it normally when needed.
I'm not sure why Postsharp fails on this missing method: it's not used for or by Postsharp's attributes in any way. It did not happen on the previous version we used.

Thanks

  1. Support Staff 1 Posted by PostSharp Techn... on 06 Feb, 2018 01:27 PM

    PostSharp Technologies's Avatar

    Hi,

    would it be possible to extract and provide us a project which reproduces this issue, so we can diagnose the behavior?

    Best regards,
    -tony

  2. 2 Posted by amiy on 14 Feb, 2018 10:33 AM

    amiy's Avatar

    Yes.
    A zip is attached.
    VS2015 solution,
    Using postsharp dlls from "external" folder.
    Also using an obfuscated dll from External folder.

    Thanks,

  3. Support Staff 3 Posted by PostSharp Techn... on 15 Feb, 2018 03:52 PM

    PostSharp Technologies's Avatar

    Hello,

    I have managed to reproduce the issue. In case of the source code you have provided Postsharp is not able to find ST.Dal.Sql.Repository.BaseRepository`1.ctor constructor. Is that correct?

    (internal issue #15875)

    Thanks for reporting the issue.

    Best regards,
    Daniel

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac