Unable to use System.Diagnostics.Trace with PostSharp

dfleuren's Avatar

dfleuren

05 Sep, 2017 07:42 AM

Dear all,

Currently I am checking if PostSharp can help us get better logs and error messages, but I run into a problem:
Because the application is a VSTO add-in, using the console for logging is not an option, so then the most simple method would be to use the System.Diagnostics.Trace system. If I follow the documentation I should put at the start of my file:
Imports PostSharp.Patterns.Diagnostic.Tracing (Yes, the application is VB.Net).

The problem is that the Diagnostic package does not seem to include Tracing? In the attachment I include a screenshot of the object browser to confirm that.

Furthermore, when I just use:
Imports PostSharp.Patterns.Dagnostic, and then in my startup method put: LoggingServices.DefaultBackend = New PostSharp.Patterns.Diagnostics.Backends.Trace.TraceLoggingBackend(), then it seems that this type also does not exist.

I feel like I am missing something very trivial here, but I cannot figure out what...

Thank you!

  1. 1 Posted by dfleuren on 05 Sep, 2017 07:43 AM

    dfleuren's Avatar

    Sorry, forgot the attachment...

  2. 2 Posted by dfleuren on 06 Sep, 2017 06:49 AM

    dfleuren's Avatar

    Note:
    While I still would like to know the answer to this question, it has become a bit less urgent. Was able to use the default console logging backend, by redirecting console output to my own version of a streamwriter.

  3. Support Staff 3 Posted by PostSharp Techn... on 08 Sep, 2017 02:33 PM

    PostSharp Technologies's Avatar

    Hello,

    The TraceLoggingBackend class is located in the PostSharp.Patterns.Diagnostics.Tracing NuGet package. After you install this NuGet package into your project, you should be able to configure the logging to use System.Diagnostics.Trace for output.

    The table on the documentation page shows the available logging backends and corresponding NuGet packages that you need to install to use the selected backend.

    -alex

  4. 4 Posted by dfleuren on 11 Sep, 2017 07:09 AM

    dfleuren's Avatar

    Dear Alex,

    Thank you! That was very trivial after all... (I had assumed those packages would automatically be download, just like the console logging backend, so that's why I didn't search there...)

    Please consider this question resolved.

  5. PostSharp Technologies closed this discussion on 11 Sep, 2017 09:07 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