Exception while building in VS 2015

motuzko's Avatar

motuzko

18 Aug, 2015 05:32 PM

Getting the following exception while building in VS 2015 (exactly the same project in 2013 bulids without errors)

Severity Code Description Project File Line
Error Unhandled exception (4.1.21.0, postsharp.srv.4.0-x86.exe, CLR 4.0.30319.393297, Release): PostSharp.Sdk.CodeModel.BindingException: Cannot find a method named 'StartRowIndex' with signature '(Microsoft.Office.Interop.Excel.Range) : int32' in scope 'Scots.Excel.RangeExtensions' (module = 'Scots.Excel.dll').
   at PostSharp.Sdk.CodeModel.Collections.MethodDefDeclarationCollection.GetMethod(String name, IMethodSignature signature, BindingOptions bindingOptions)
   at PostSharp.Sdk.CodeModel.MethodRefDeclaration.GetMethodDefinition(BindingOptions bindingOptions)
   at PostSharp.Sdk.CodeModel.MethodRefDeclaration.get_IsVirtual()
   at ^fUDZPFxHJkVW.^f3TGHnx2(MetadataDeclaration _0, MethodDefDeclaration _1, IDependencyTransformationInstance[] _2, MethodSemantics _3, AspectInfrastructureTask _4)
   at ^fUDZPFxHJkVW.^zmnSLC74(AspectInfrastructureTask _0, MetadataDeclaration _1, IDependencyTransformationInstance[] _2, MethodSemantics _3)
   at PostSharp.Sdk.AspectInfrastructure.AspectInfrastructureTask.^jwku0geZ(MetadataDeclaration _0, PipelineTransversalState _1, MethodSemantics _2, Boolean _3)
   at PostSharp.Sdk.AspectInfrastructure.AspectInfrastructureTask.^MwzbegST(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.AspectInfrastructureTask.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). Scots.AddIn.Report D:\Development\.NET\Src\scots-addin-client\src\Scots.AddIn.Report\Scots.AddIn.Report.csproj

Please advise

  1. 1 Posted by motuzko on 18 Aug, 2015 05:33 PM

    motuzko's Avatar

    the method which is causing the problem is

        public static Int32 StartRowIndex(this Range inRange)
        {
          return inRange.Row;
        }

  2. Support Staff 2 Posted by PostSharp Techn... on 19 Aug, 2015 09:31 PM

    PostSharp Technologies's Avatar

    Hello,

    can you provide us with a reproduction project?

    Thanks!

    Best,
    Daniel

  3. 3 Posted by philus on 20 Aug, 2015 12:26 AM

    philus's Avatar

    Hello Daniel,

    I tried to isolate the problem into a small project with no luck.

    Please download a project from http://motuzko.com/obsilf/Downloads/scots-addin-client.rar - I was able to reproduce it on two PCs.

    Thanks,

    Phil

  4. 4 Posted by philus on 20 Aug, 2015 12:28 AM

    philus's Avatar

    Also, can you please ask someone to take a look at http://stackoverflow.com/questions/32015826/postsharp-removing-replacing-backing-fields

    Thanks!

  5. Support Staff 5 Posted by PostSharp Techn... on 20 Aug, 2015 09:29 AM

    PostSharp Technologies's Avatar

    Hello Phil,

    thanks for the reproduction, I will take a look and get back to you.

    Regarding the SO question, I hope that I will get to it soon.

    Best,
    Daniel

  6. Support Staff 6 Posted by PostSharp Techn... on 21 Aug, 2015 12:47 PM

    PostSharp Technologies's Avatar

    Hello Phil,

    the link seems not to be working anymore - is it possible to provide us with a new link?

    Best,
    Daniel

  7. 7 Posted by motuzko on 21 Aug, 2015 10:29 PM

    motuzko's Avatar

    It does work now - sorry, brought the server for maintenance

  8. 8 Posted by motuzko on 24 Aug, 2015 04:12 PM

    motuzko's Avatar

    Have you got the solution?

  9. Support Staff 9 Posted by PostSharp Techn... on 24 Aug, 2015 05:51 PM

    PostSharp Technologies's Avatar

    Hello,

    yes, I have successfully downloaded it and reproduced the issue. I will get back to you as soon as I know more.

    Thanks!

    BR,
    Daniel

  10. Support Staff 10 Posted by PostSharp Techn... on 26 Aug, 2015 09:25 AM

    PostSharp Technologies's Avatar

    Hello,

    it seems that the issue is associated with changes in C# compiler and .NET Framework 4.6. We have also encountered other similar errors while compiling your solution. We currently cannot provide you with any workaround other than compilation in VS2013.

    I will provide more details as soon as we determine the exact cause.

    Best regards,
    Daniel

  11. 11 Posted by philus on 26 Aug, 2015 02:51 PM

    philus's Avatar
  12. Support Staff 12 Posted by PostSharp Techn... on 26 Aug, 2015 04:18 PM

    PostSharp Technologies's Avatar

    Hello,

    the cause is that C# compiler now relies on type equivalence when dealing with embedded interop types. PostSharp does not currently implement this because it was not used by the C# compiler.

    Please let me know if disabling embedding of interop types may work for you, to help us prioritize this feature accordingly.

    (story #11909)

    Regarding the SO question, this is not supported by Aspect Framework directly, but I'm trying to implement an aspect that would help you automatically save at least some memory. Sorry for the delay, but be sure that the answer is coming :-).

    Best,
    Daniel

  13. 13 Posted by motuzko on 27 Aug, 2015 03:40 PM

    motuzko's Avatar

    Hello Daniel,
    Thanks for the update!

    Although disabling the embedding of the interop types is possible in theory, it makes the code uglier and requires significant changes. I thing everybody who experiences the same problem will agree. So in my opinion, this item should have a high priority.
    And another thanks for taking care of the SO question. Waiting for your suggestion.

    Regards,
    Phil

  14. Support Staff 14 Posted by PostSharp Techn... on 27 Aug, 2015 04:24 PM

    PostSharp Technologies's Avatar

    Hello Phil,

    we do indeed treat it as a high priority issue.

    I have answered on SO, but the code proved to be too cumbersome and not saving much memory, so I did not finish it. I may provide some suggestions privately if you decide to implement it as I describe.

    Best,

  15. Support Staff 15 Posted by PostSharp Techn... on 21 Sep, 2015 07:32 AM

    PostSharp Technologies's Avatar

    Hello,

    The issue has been fixed in the latest builds of PostSharp 3.1, 4.1 and 4.2.

    -gael

  16. PostSharp Technologies closed this discussion on 21 Sep, 2015 07:32 AM.

  17. motuzko re-opened this discussion on 21 Sep, 2015 03:16 PM

  18. 16 Posted by motuzko on 21 Sep, 2015 03:16 PM

    motuzko's Avatar

    The version 4.1.24 is even worse:

    the VS 2013 breaks on build:

    14>MSBUILD : error MSB4166: Child node "3" exited prematurely. Shutting down. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt.

    The VS 2015 also fails to build

  19. 17 Posted by motuzko on 21 Sep, 2015 03:22 PM

    motuzko's Avatar
  20. Support Staff 18 Posted by PostSharp Techn... on 23 Sep, 2015 03:38 PM

    PostSharp Technologies's Avatar

    Hello,

    Please, could you post a stack trace from VS2015. We are able to reproduce other issue than originally reported, so it would be nice to make sure that we found all problems. Internally filed as #12145 and we are going to solve it with high priority.

    We are not able to reproduce the issue with VS2013. Please, could you provide us a minimal example project?

    -jakub

  21. 19 Posted by motuzko on 23 Sep, 2015 06:23 PM

    motuzko's Avatar

    MSBuild logs attached - seems like the while building it tried to refer to the FileLogger class which in turn referred to the 'C:\Users\pmotuzko\Documents\Scots.txt' file, which was being used by another process. Once I terminated the other process, it built without any errors, but... Why does the build execute any of the code?

  22. Support Staff 20 Posted by PostSharp Techn... on 24 Sep, 2015 09:04 AM

    PostSharp Technologies's Avatar

    Hello,

    PostSharp may execute static constructors during build and it is not possible to avoid it automatically. PostSharpEnvironment.IsPostSharpRunning property can be used to resolve this issue manually (static constructor of Scots.Logging.FileLogger in case of provided logs).

    -jakub

  23. Support Staff 21 Posted by PostSharp Techn... on 28 Sep, 2015 03:05 PM

    PostSharp Technologies's Avatar

    Hello,

    the issue with VS2015 should be fixed in version 4.1.25. Please, could you test it and confirm that it really fixes the issue?

    -jakub

  24. 22 Posted by motuzko on 28 Sep, 2015 03:34 PM

    motuzko's Avatar

    Hello Jakub,

    I was able to successfully build the solution and run it.
    Although my testing was NOT thorough, I think we can close the issue.
    If I discover any problems, I'll let you know.

    Many thanks for the help,

    Phil

  25. PostSharp Technologies closed this discussion on 29 Sep, 2015 08:30 AM.

Comments are currently closed for this discussion. You can start a new one.

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