Compilation issues after switching from PostSharp version 4.4.20.0 to 5.0.31.0

bayer.uwe's Avatar

bayer.uwe

07 Sep, 2017 07:08 AM

We at Siemens CT Forchheim plan to switch to VS2017 quite soon. Therefore we want to change also PostSharp version to the version supporting VS2017.
At the moment we are using VS2013 with PostSharp 4.4.20.0
By changing to PostSharp version 5.0.31.0 our product target compilation does not work anymore. We are trying this in VS2013 first.

So far I can see the following compilation errors:
a) issue with processing pdb (note: we compile in AnyCPU, PostSharp is set to x64 as Target Platform). Because of this our pdb files seems to be not available in binary output folder next to the dll's and remain in before-postsharp folder ?
   319>D:\VS2017\packages\tools\PostSharp.targets(329,5): warning PS0134: Cannot read 'D:\VS2017\CT.Exam\Configuration\RemoteContract\obj\Debug\Before-PostSharp\CT.Exam.Configuration.RemoteContract.pdb': Not at S_END. [D:\VS2017\CT.Exam\Configuration\RemoteContract\CT.Exam.Configuration.RemoteContract.csproj]
b) many times we have error LA0147 - is that a known change in new PostSharp version and our product code has to be aligned ?
   156>d:\VS2017\H.Common\Diagnostics\Tracing\TracingAttribute.cs(336,21,336,38): error LA0147: Cannot add the advice "H.Common.Diagnostics.Tracing.TracingAttribute.TraceInWithParams(PostSharp.Aspects.MethodExecutionArgs)" to "H.Common.Communication.EndpointRegistration.EndpointRegistrationService.H#Common#Communication#WcfSupport#IEndpointRegistrationService#Register(H.Common.Communication.Contract.EndpointRegistrationInfo).Anonymous": the advice cannot be applied to a anonymous method. [D:\VS2017\H.Common\Communication\EndpointRegistration\H.Common.Communication.EndpointRegistration.csproj]

I attached our compile output file as attachment.

Could you please support us to do the switch to new postsharp version and get rid of the current compilation blockers ?

Thanks&Regards,
Uwe Bayer

Siemens Healthcare GmbH
Diagnostic Imaging
Computed Tomography
PLM Tools
HC DI CT R&D ES PT
Siemensstr. 3
91301 Forchheim, Deutschland
Tel.: +49 9191 18-8254
Mobil: +49 162 2407517
mailto:[email blocked]

  1. Support Staff 1 Posted by PostSharp Techn... on 07 Sep, 2017 09:48 AM

    PostSharp Technologies's Avatar

    Hello,

    a) warning PS0134: Cannot read ...pdb
    This is a known issue (#15431) that has been fixed recently. We will release the fix in the next build of PostSharp 5.0.

    b) error LA0147: Cannot add the advice ...
    Applying advices to anonymous methods was never properly supported by PostSharp. Starting with 5.0 we now emit this error to prevent unexpected behavior of aspects in some cases. We also provide a "semantic info" API that allows to filter out unsupported elements when selecting targets in aspect/advice providers and advice pointcuts. You need to call the extension method PostSharp.Reflection.ReflectionHelper.GetSemanticInfo on the target element. If the property IsSelectable of the resulting SemanticInfo is false then that target is not a valid target for advising and should be skipped. The sample code below demonstrates this approach.

    [PSerializable]
    public class TracingAttribute : TypeLevelAspect
    {
        [OnMethodEntryAdvice, MethodPointcut("SelectMethods")]
        public void TraceInWithParams( MethodExecutionArgs args )
        {
            // ...
        }
    
        public IEnumerable<MethodBase> SelectMethods(Type targetType)
        {
            // var methods = targetType.GetMethods(...)
            foreach (MethodInfo method in methods)
            {
                // Skip methods that are not selectable.
                if (!method.GetSemanticInfo().IsSelectable)
                    continue;
    
                yield return method;
            }
        }
    }
    

    -alex

  2. 2 Posted by bayer.uwe on 07 Sep, 2017 09:56 AM

    bayer.uwe's Avatar

    Thanks for the quick reply.
    Regarding a): could you inform us once the PostSharp 5.0.x version containing the fix is released and can be downloaded ?

    Regards,
    Uwe Bayer

    -----Ursprüngliche Nachricht-----
    Von: PostSharp Technologies [mailto:[email blocked]]
    Gesendet: Donnerstag, 7. September 2017 11:49
    An: Bayer, Uwe (HC DI CT R&D ES PT)
    Betreff: [PostSharp Support] Compilation issues after switching from PostSharp version 4.4.20.0 to 5.0.31.0

  3. Support Staff 3 Posted by PostSharp Techn... on 19 Sep, 2017 12:50 PM

    PostSharp Technologies's Avatar

    Hello,

    the bug #15431 has been fixed in the current release of PostSharp 5.0.33.
    Should you need further help with this issue, don't hesitate to re-open this discussion.

    Best regards,
    -tony

  4. PostSharp Technologies closed this discussion on 19 Sep, 2017 12:50 PM.

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