Can't get PostSharp metrics

gchaffarod's Avatar


14 Feb, 2018 11:37 AM

Hello PostSharp team.

I can't get PostSharp metrics in visual studio 2015.
The window doesn't show me anything.
How can we correct that ?

Thank you.

Best regards,


  1. Support Staff 1 Posted by PostSharp Techn... on 15 Feb, 2018 04:27 PM

    PostSharp Technologies's Avatar


    I have tried on a clean installation and it seems that when you open the PostSharp Metrics window for the first time it will not show any data. When I restarted Visual Studio and rebuilt the project, everything started to be shown as expected.

    Also, do you see PostSharp underlinings on enhanced types?
    Have you encountered any PostSharp crash report recently?
    Which build of PostSharp and PostSharp Tools are you using?

    (internal issue #15876)

    Thanks a lot for reporting the issue.

    Best regards,

  2. 2 Posted by gchaffarod on 15 Feb, 2018 04:57 PM

    gchaffarod's Avatar


    I effectively can now retrieve postsharp metrics, but only for one project in the visual studio solution.

    It helped us avoiding 17% and saving 15% of code lines for this project (this is the main project, the API, that uses many aspects).

    I think i didn't rebuild the solution before retrieving postsharp metrics

    Thank you for your answer (and for saved lines of code).

    Best regards,


  3. Support Staff 3 Posted by PostSharp Techn... on 16 Feb, 2018 10:57 AM

    PostSharp Technologies's Avatar


    do you use any aspects in other projects in your solution? You should get statistics for all projects that have PostSharp aspects with code saving information applied.



  4. 4 Posted by gchaffarod on 16 Feb, 2018 04:17 PM

    gchaffarod's Avatar

    I have an aspect in the API project of the solution for logging methods boundaries (OnMethodBoundaryAspect).

    It's dispatched using this on top of the aspect class:
    [assembly: Trace(AttributeTargetTypes = "IdmCic.*", AttributeTargetTypeAttributes = MulticastAttributes.AnyVisibility, AttributeTargetMemberAttributes = MulticastAttributes.AnyVisibility)]

    In my solution, I have other projects which namespace starts with IdmCic.
    For example, our API project namespace is IdmCic.API, but we also have a project for an Excel interface which namespace is IdmCic.ExcelApi, another one for managing all user forms which namespace is IdmCic.UI, etc...

    But the aspect is only situated in the API project.

  5. Support Staff 5 Posted by PostSharp Techn... on 19 Feb, 2018 05:04 PM

    PostSharp Technologies's Avatar


    Thank you for providing more details about your solution.

    Please note that the aspect is effective only in the project where you have [assembly: Trace(...)] attribute applied. You need to install PostSharp and apply the attribute in each project that requires this aspect.


  6. 6 Posted by gchaffarod on 20 Feb, 2018 08:53 AM

    gchaffarod's Avatar

    Hello and thank you for your reply,

    I also have aspects specific on the ExcelApi project applied only in this project but they don't come in metrics.
    This aspect is a method boundaries and is applied by attribute placed over specific methods by hand (without [assembly:...]).

  7. Support Staff 7 Posted by PostSharp Techn... on 20 Feb, 2018 01:47 PM

    PostSharp Technologies's Avatar


    In the bin directory of your ExcelApi project you should have a *.pssym file with information about the applied aspects including metrics data. Could you please send us this file for review?


  8. 8 Posted by gchaffarod on 20 Feb, 2018 01:51 PM

    gchaffarod's Avatar


    Here is the file.


  9. Support Staff 9 Posted by PostSharp Techn... on 20 Feb, 2018 03:03 PM

    PostSharp Technologies's Avatar


    The provided *.pssym file contains no data on the saved lines of code. If you want metrics to be calculated for your custom aspect, then we advise you to annotate this aspect with the [LinesOfCodeAvoided] attribute and provide your own estimate as documented in Estimating Code Savings.

    If you don't provide your custom estimate, then PostSharp should assume 2 lines are saved per advice applied to a target. Apparently this doesn't work due to a bug that we're currently investigating. We will get back to you once we have more information or the bug is fixed.

    In the meantime, please annotate your custom aspects with the [LinesOfCodeAvoided] attribute.


  10. Support Staff 10 Posted by PostSharp Techn... on 08 Mar, 2018 12:22 PM

    PostSharp Technologies's Avatar


    We're closing the ticket for now as the bug has been internally filed as issue #15876. We will contact you as soon as the bug fix has been released.

    For more details on our support policies and prioritization of bug fixes, please visit


  11. PostSharp Technologies closed this discussion on 08 Mar, 2018 12:22 PM.

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

Keyboard shortcuts


? 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