What's New in PostSharp 6.0 |
The primary focus of PostSharp 6.0 was to execute the PostSharp compiler itself on .NET Core when a .NET Core project is being built. This required the biggest refactoring of our compiler's internals since PostSharp 2.0, which broke backward-compatibility of build-time components, and warranted a major version change.
Additionally, PostSharp 6.0 brings support for C# 7.2 and improves the robustness of the logging component.
![]() |
---|
As a major version, PostSharp 6.0 contains some breaking changes. See Breaking Changes in PostSharp 6.0 for details. |
This topic contains the following sections:
- Support for .NET Core 2.0-2.1 and .NET Standard 2.0
- PostSharp compiler runs natively in .NET Core
- Support for Portable PDB
- Support for C# 7.2
- Logging: robustness to logging faults
- Logging: adapters for Log4Net and NLog now support .NET Standard
- Logging: no need to initialize before the first logged method is hit
- Caching: preventing concurrent execution (locking)
- Tools for Visual Studio: support for the new CPS-based project systems.
- GDPR Compliance
- End of support for Visual Studio 2012
- End of support for .NET Core 1.1 as a build platform
- Removal of the UI to use PostSharp without NuGet

.NET Core 2.0-2.1 and .NET Standard 2.0 are now completely supported. PostSharp 5.0 used to have partial and buggy support for these frameworks, and significant work was required to get it right (see below).

Up to version 5.0, the PostSharp compiler would always run the .NET Framework, even if it was building a project targeting .NET Core. That caused some serious challenges and problems because PostSharp is executing user code at build time, therefore it executed in .NET Framework code written for .NET Core.
Starting from PostSharp 6.0, PostSharp will run under .NET Core if you're building a project for .NET Core. Most of the PostSharp build-time code has been ported to .NET Standard 2.0.
This was a major refactoring and we've repaid a great deal of our technical debt. Support for new releases of .NET Core should become much quicker. This evolution also opens the path to supporting PostSharp on Linux, but there is still work to reach this objective.

Portable PDB (both standalone and embedded) are now fully supported.

PostSharp 6.0 properly handles and understands in parameters. It also understands ref struct, but prevents them from being used as parameters in methods that are enhanced by an aspect (except logging).

Errors in the logging component or in your logging code will no longer cause your application to crash. For details, see Handling Faults in the Logging Component.

PostSharp.Patterns.Diagnostics.Log4Net and PostSharp.Patterns.Diagnostics.NLog now support .NET Standard.

It is now possible to change the logging back-ends dynamically, even after a log record has been emitted. As a result, it is no longer necessary to avoid any logging until the logging service was initialized.

You can now configure a lock manager to prevent concurrent execution of the same method with the same arguments on different threads, processes, or machines. See Preventing Concurrent Execution of Cached Methods for details.

The new project systems, which work with simpler project files and include built-in support for NuGet package references, are now properly supported.

PostSharp is now compliant with GDPR. A few changes were needed, including requiring explicit consent before performing license audit (instead of just informing) or sending the newsletter (instead of soft opt in), and making all data transfers secure.

PostSharp 6.0 no longer includes support for Visual Studio 2012, as it is no longer in Microsoft mainstream support.

You can still build .NET Core 1.1 and .NET Standard 1.* projects, but using the .NET Core 2.0 SDK.

If is still possible to use PostSharp without NuGet, but we removed the UI from PostSharp Tools for Visual Studio.