What's New in PostSharp 6.1
In PostSharp 6.1, we primarily focused on two directions: the logging API so that we can cope with distributed systems, and the debugging experience. Additionally, we fixed gapped in .NET Standard and C# 7.3 support.
This topic contains the following sections:
- Logging: major improvements in the front-end API
- Visual Studio debugger: better support for async methods
- Support for C# 7.3
- Fixing gaps in platform support
Despite being a minor version, PostSharp 6.1 contains some low-impact breaking changes in the logging API. The chances that you would be negatively affected are minor. See Breaking Changes in PostSharp 6.1 for details.
We've worked hard to improve the scenario of logging high-load distributed systems (such microservices) into a structured database (such as Elastic Search), and enable statistical processing of the log records.
To achieve this goal, we had to bring several improvements to PostSharp Logging:
Semantic-First Logging, suitable for statistical processing of messages and machine learning. See Writing Custom Messages for details.
Custom Properties on custom messages and activities, including cross-process properties (aka baggage). See Adding Properties to Messages and Activities for details.
Hierarchical and Cross-Process Activity ID that can be easily filtered and sorted on to get a logical view of a request in a distributed system. See Logging in a Distributed System for details.
Sampled Logging: Instead of hoarding gigabytes of useless logs, you can now enable logging for selected requests only. Seefor details.
Execution time measurement for custom activities. See Working with Custom Activities for details.
Serilog backend improvements: You now have more control over generated Serilog properties. See SerilogLoggingBackendOptions.IncludedSpecialProperties and SerilogLoggingBackendOptions.LogEventEnricher properties for details.
Application Insights backend improvements: the backend now supports custom properties. See ApplicationInsightsLoggingBackendOptions class for details.
Additionally, PostSharp 6.1 brings the following improvements to logging:
We are now using the type name instead of the role name by default to read the logging level from the backend.
Simplified API to set up verbosity. See LoggingBackend.DefaultVerbosity for details.
Exception logging is now again implemented in a catch block instead of an exception filter block.
Exception formatting can now be customized by setting the TextLoggingBackendOptions.ExceptionFormatter property.
We are releasing a complete refactoring of our add-in to the Visual Studio debugger. It solves a dozen of issues and finally fixes the debugging behavior of intercepted async methods.
PostSharp was affected by the following features of C# 7.3:
PostSharp.Patterns.Caching now supports .NET Standard 2.0 and .NET Framework 4.5.
PostSharp.Patterns.Diagnostics.Backends.CommonLogging now supports .NET Standard 2.0.