0

I am starting and doing testing with PostSharp 6.9.4 Community version, upgrading from 3.0.27 Express. Everything is fine building in VS2017, but when we queue a new build in tfs we get this error:

c:\B1\Net\SEP TR dev Visual Studio 2017\Sources\src\projectName\projectName.csproj : error LA0014: The custom attribute 'Helpers.TimeTraceAspect' constructor threw the exception NotImplementedException: The method cannot be executed at build time.

What does it mean?

Same code works and builds fine in 3.0.27 but not in 6.9.4.

I have not found any information about this error in PostSharp's support page.

Thank you for your help.

  • Seems like mixing of reference and runtime libraries. This exception is emitted for metadata-only assemblies. I would attach the debugger to PostSharp's process (using `/p:PostSharpAttachDebugger=True` MSBuild switch) and look at modules loaded into the PostSharp process (Debug->Windows->Modules in Visual Studio). I guess the assembly that contains TimeTraceAspect is loaded from an incorrect location. – Daniel Balas May 07 '21 at 11:35
  • Thank you Daniel. I find out the error happens when framework version is 4.8. If selected version is 4.6.1, build works fine. I have to say that error happens with each aspect in project, not only Helpers.TimeTraceAspect. – Jorge J. May 07 '21 at 14:51
  • Each method marked with an aspect attribute is shown in log as an error. – Jorge J. May 07 '21 at 14:58
  • Another way (if you do not have access to the build machine) is to produce a log with `/p:PostSharpTrace=AssemblyBinder` and look for the place where PostSharp loads the DLL containing aspects from. I think knowing how the metadata-only DLL is loaded is essential. – Daniel Balas May 09 '21 at 06:28

0 Answers0