Skip to content

Commit 0c7e7c9

Browse files
committed
#35610 Document PostSharp 2025.0.
1 parent 1f1d59f commit 0c7e7c9

File tree

8 files changed

+265
-12
lines changed

8 files changed

+265
-12
lines changed

code/PostSharp.Sdk.Documentation.Consolidated/PostSharp.Sdk.Documentation.Consolidated.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</ItemGroup>
1717

1818
<Target Name="CheckConfiguration">
19-
<Error Text="This project can only be built in Debug configuration because its Debug output directory is specificially references. Check the sln file." Condition="'$(Configuration)'!='Debug'"/>
19+
<Error Text="This project can only be built in Debug configuration because its Debug output directory is specifically references. Check the sln file." Condition="'$(Configuration)'!='Debug'"/>
2020
</Target>
2121

2222
</Project>

conceptual/DeploymentConfiguration/Deployment/binary-formatter-security.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,29 @@ summary: "The .NET Core 3.1 BinaryFormatter, used for binary serialization, is c
77
---
88
# BinaryFormatter security
99

10-
In .NET Core 3.1 `T:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter`, which is used for binary serialization of CLR object, began to be considered insecure and dangerous. In .NET 5.0, `T:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter` started to throw an exception upon its use in ASP.NET Core applications. In .NET 8.0, more serialization-related APIs started to be obsolete and by default, BinaryFormatter is disabled (throwing exceptions) in all .NET 8.0 projects with an exception of WinForms and WPF projects.
10+
In .NET Core 3.1 `T:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter`, which is used for binary serialization of CLR objects, began to be considered insecure and dangerous. In .NET 5.0, `T:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter` started to throw an exception upon its use in ASP.NET Core applications. In .NET 8.0, more serialization-related APIs started to be obsolete and by default, BinaryFormatter is disabled (throwing exceptions) in all .NET 8.0 projects with an exception of WinForms and WPF projects. In .NET 9.0, the implementation of BinaryFormatter class and related types is removed from runtime and all members of these types now have only throwing implementation.
1111

1212
The attack vector of this vulnerability is deserialization of data that could be manipulated by the attacker, which can result in execution of arbitrary command under credentials of the process that executed the deserialization.
1313

14+
## Impact of vulnerability on PostSharp
1415

15-
## Impact of vulnerability on PostSharp
16+
PostSharp allows multiple methods of serializing aspects. The `T:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter` is used if the type has the `[Serializable]` attribute in C#. After PostSharp 4.0, the preferred method of serialization is using `T:PostSharp.Serialization.PSerializableAttribute`, which results in use of `T:PostSharp.Serialization.PortableFormatter`, which is our PostSharp's efficient and portable serialization format for aspect serialization.
1617

17-
PostSharp aspects are serialized at compile-time to preserve aspect parameters and analysis results and stored in a managed resource within the assembly. Serialized aspects are deserialized either at compile time to facilitate aspect inheritance (e.g. the aspect is applied to a derived class), or at run time when aspect is about to be used.
18-
19-
The above described **vulnerability does not apply to the use of serialization by PostSharp itself**, because in order to alter the serialized data, the attacker would have to alter the assembly containing the data. Being able to alter an assembly containing the serialized aspect data is itself a more general security vulnerability.
20-
21-
PostSharp allows multiple methods of serializing aspects. The `T:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter` is used if the type has the `[Serializable]` attribute in C#. After PostSharp 4.0, the preferred method of serialization is using `T:PostSharp.Serialization.PSerializableAttribute`, which results in use of `T:PostSharp.Serialization.PortableFormatter`, which is our own efficient and portable serialization format for aspect serialization.
22-
23-
Using `[Serializable]` on aspect classes will result in a build-time error LA206.
18+
Since PostSharp 2024.0, using `[Serializable]` on aspect classes will result in a build-time error LA0206.
2419

2520
In legacy applications that require usage of binary serialization, you can disable this error by setting `PostSharpBinaryFormatterAllowed` MSBuild property to `true`.
2621

22+
When building under .NET 9.0+ in Postsharp 2025.0 and later, using this setting will automatically reference `System.Runtime.Serialization.Formattters` package as a build-time dependency. Additional steps have to be taken to enable runtime support for aspect binary deserialization. See more [in Microsoft documentation](https://learn.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-migration-guide/compatibility-package). .
23+
2724
> [!CAUTION]
28-
> Disabling LA206 and using `PostSharpBinaryFormatterAllowed` is not recommended.
25+
> Using `PostSharpBinaryFormatterAllowed` is not recommended and is unsupported.
2926
3027
> [!NOTE]
3128
> In releases before PostSharp 2024.0, using `[Serializable]` may result in build-time warning LA205, which can be suppressed through `NoWarn` MSBuild property.
3229
3330
## Recommended actions
3431

35-
Since the usage of BinaryFormatter is discouraged by Microsoft and in most projects using it would cause a runtime exception, it is required to use PortableFormatter for serializing aspects instead.
32+
Since the usage of BinaryFormatter is unsupported by Microsoft and in most projects using it would cause a runtime exception, it is recommended to use PortableFormatter for serializing aspects instead.
3633

3734
All aspects and types that are used for aspect serialization should use `[PSerializable]` instead of `[Serializable]`.
3835

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
---
2+
uid: requirements-20250
3+
title: "PostSharp 2025.0: Requirements and Compatibility"
4+
product: "postsharp"
5+
categories: "PostSharp;AOP;Metaprogramming"
6+
summary: "PostSharp 2025.0 supports C# 13.0 or earlier and VB 16.9 or earlier. It requires Microsoft Visual Studio 2022, .NET Framework 4.7.2 or later, and is compatible with various operating systems and .NET SDK versions. It also supports Blazor via .NET Standard."
7+
---
8+
# PostSharp 2024.1: Requirements and Compatibility
9+
10+
You can use PostSharp to build applications that target a wide range of target devices. This article lists the requirements for development, build and end-user devices.
11+
12+
> [!IMPORTANT]
13+
> Please read our [Supported Platforms Policies](https://www.postsharp.net/support/policies#platforms) on our web site as it contains important explanations, restrictions and disclaimers regarding this article.
14+
15+
16+
## Supported programming languages
17+
18+
This version of PostSharp supports the following languages:
19+
20+
* C# 13.0 or earlier,
21+
22+
* VB 16.9 or earlier.
23+
24+
PostSharp only supports the compilers that ship with the supported versions of Visual Studio, .NET Core SDK, or .NET SDK. Other compiler versions, especially pre-Roslyn ones, are no longer supported.
25+
26+
You may use PostSharp with an unsupported language version at your own risks by setting the `PostSharpSkipLanguageVersionValidation` MSBuild property to `True`. There are two risks in doing that: inconsistent or erroneous behavior of the current version of PostSharp, and breaking changes in the future version of PostSharp that will support this language version.
27+
28+
29+
## Requirements on development workstations
30+
31+
This section lists the supported platforms, and most importantly platform versions, on which PostSharp is intended to be used while developing software.
32+
33+
The following software components need to be installed before PostSharp can be used:
34+
35+
* Any of the following versions of Microsoft Visual Studio:
36+
* Visual Studio 2022 (17.8 and later).
37+
38+
The debugging experience may be inconsistent with other IDEs than Visual Studio or when PostSharp Tools for Visual Studio are not installed.
39+
40+
* .NET Framework 4.7.2 or later.
41+
42+
* Any of the following operating systems:
43+
* Windows 10, Windows 11 X64: any version in mainstream Microsoft support, except LTSB and S editions.
44+
* Windows 11 ARM64: any version in mainstream Microsoft support, except LTSB and S editions.
45+
46+
* Optionally, one of the following versions of .NET SDK:
47+
* .NET SDK 8.0 (build 8.0.100 or later).
48+
* .NET SDK 9.0 (build 9.0.100 or later).
49+
50+
## Requirements on build servers
51+
52+
* Any of the following operating systems currently in mainstream support by respective vendors:
53+
* Windows Server 2022 x64 or ARM64
54+
* Windows 10 x64
55+
* Windows 11 x64 or ARM64
56+
* Ubuntu 20.04 LTS x64,
57+
* Ubuntu 22.04 LTS x64 or ARM64,
58+
* Ubuntu 24.04 LTS x64 or ARM64,
59+
* MacOS 13+ ARM64,
60+
* Alpine Linux 3.18+ x64,
61+
* Alpine Linux 3.18+ ARM64.
62+
63+
At least one of the following:
64+
* .NET Framework 4.7.2 and later + Build Tools for Visual Studio 2022 or Visual Studio 2022 (17.8 and later).
65+
* .NET SDK 8.0 (build 8.0.100 or later).
66+
* .NET SDK 9.0 (build 9.0.100 or later).
67+
68+
## Requirements on end-user devices
69+
70+
The following table displays the versions of the target frameworks that are supported by the current release of PostSharp and its components.
71+
72+
| Package | .NET Framework | .NET Core & .NET | .NET Standard*** | Blazor*** |
73+
|---------|----------------|------------------|------------------|-----------|
74+
| *PostSharp* | 3.5 SP1, 4.5 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.6 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.7, 4.8 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">**</superscript> | 8.0, 9.0 | 2.0, 2.1 | Supported |
75+
| *PostSharp.Patterns.Common*<br>*PostSharp.Patterns.Aggregation*<br>*PostSharp.Patterns.Model* | 4.5 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.6 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.7, 4.8 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">**</superscript> | 8.0, 9.0 | 2.0, 2.1 | Supported |
76+
| *PostSharp.Patterns.Diagnostics* <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">%</superscript> | 4.5 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.6 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.7, 4.8 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">**</superscript> | 8.0, 9.0 | 2.0, 2.1 | Supported |
77+
| *PostSharp.Patterns.Threading* | 4.5 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.6 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.7, 4.8 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">**</superscript> | 8.0, 9.0 | 2.0, 2.1 | - |
78+
| *PostSharp.Patterns.Xaml* | 4.5 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.6 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.7, 4.8 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">**</superscript> | 8.0-windows, 9.0-windows | - | - |
79+
| *PostSharp.Patterns.Caching* <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">%%</superscript> | 4.6.1 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript>, 4.7, 4.8 <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">**</superscript> | 8.0, 9.0 | 2.0, 2.1 | Supported |
80+
81+
> [!NOTE]
82+
> <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">*</superscript> .NET Framework versions 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1 are no longer supported by Microsoft. Although we still provide libraries targeting them, we no longer run our tests on these specific versions of the .NET Framework.
83+
84+
> [!NOTE]
85+
> <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">**</superscript> .NET Framework ARM64 is experimentally supported for PostSharp Pattern Libraries. We recommend using PostSharp Pattern Libraries on ARM64 Windows with emulated .NET Framework x64.
86+
87+
> [!NOTE]
88+
> <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">***</superscript> PostSharp does not implicitly support all platforms that support .NET Standard. Only platforms mentioned in this table are supported.
89+
90+
> [!NOTE]
91+
> <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">%</superscript> Each PostSharp.Patterns.Diagnostics logging backend has different set of supported target frameworks. Please refer to individual packages on [nuget.org](http://www.nuget.org).
92+
93+
> [!NOTE]
94+
> <superscript xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">%%</superscript> Each PostSharp.Patterns.Caching caching backend has different set of supported target frameworks. Please refer to individual packages on [nuget.org](http://www.nuget.org).
95+
96+
97+
## Compatibility with Xamarin
98+
99+
Xamarin support by Microsoft ended on May 1, 2024 and is therefore unsupported by PostSharp.
100+
101+
Xamarin was supported as a runtime platform only via .NET Standard. PostSharp still contains mechanisms that allow for use with Xamarin, but these will not be maintained further.
102+
103+
It is possible to include PostSharp packaged in your .NET Standard libraries and then reference these libraries in your Xamarin application project. Adding PostSharp directly to a Xamarin application project is not possible.
104+
105+
Xamarin applications use a linker that is executed during build to discard the unused code and reduce the size of the application. To prevent the linker from removing the code required by PostSharp you need to add a custom linker configuration to your project. See <xref:xamarin> for more details.
106+
107+
108+
## Compatibility with Blazor
109+
110+
Blazor is supported as a runtime platform only via .NET Standard. You can add supported PostSharp packages to your .NET Standard libraries and then reference these libraries in your Blazor application project. Adding PostSharp directly to a Blazor application project is not supported.
111+
112+
Blazor applications use a linker that is executed during build to discard the unused code and reduce the size of the application. To prevent the linker from removing the code required by PostSharp you need to add a custom linker configuration to your project. See <xref:blazor> for more details.
113+
114+
To debug Blazor applications, `PostSharpDebuggerExtensionsMode` MSBuild property should be set to `Disabled` for all referenced projects using PostSharp, otherwise the debugger may fail to load debugging symbols properly. See <xref:blazor> for more details.
115+
116+
117+
## Compatibility with ASP.NET 1.0 - 4.8
118+
119+
There are two ways to develop web applications using Microsoft .NET:
120+
121+
* **ASP.NET Application projects ** are very similar to other projects; they need to be built before they can be executed. Since they are built using MSBuild, you can use PostSharp as with any other kind of project.
122+
123+
* **ASP.NET Site projects ** are very specific: there is no MSBuild project file (a site is actually a directory), and these projects must not be built. ASP.NET Site projects are not supported.
124+
125+
* ASP.NET Core is supported when used with a supported .NET SDK.
126+
127+
## Compatibility with Microsoft Code Analysis
128+
129+
By default, PostSharp reconfigures the build process so that Code Analysis is executed on the assemblies as they were *before* being enhanced by PostSharp. If you are using Code Analysis as an integrated part of Visual, no change of configuration is required.
130+
131+
You can request the Code Analysis to execute on the output of PostSharp by setting the `ExecuteCodeAnalysisOnPostSharpOutput` MSBuild property to `True`. For more information, see <xref:configuration-msbuild>.
132+
133+
134+
## Compatibility with Microsoft Code Contracts
135+
136+
PostSharp configures the build process so that Microsoft Code Contracts is executed before PostSharp. Additionally, Microsoft Code Contracts' static analyzer will be executed synchronously (instead of asynchronously without PostSharp), which will significantly impact the build performance.
137+
138+
139+
## Compatibility with Obfuscators
140+
141+
PostSharp generates assemblies that are theoretically compatible with all obfuscators.
142+
143+
> [!NOTE]
144+
> PostSharp Logging is not designed to work with obfuscated assemblies.
145+
146+
> [!CAUTION]
147+
> PostSharp emits constructs that are not emitted by Microsoft compilers (for instance `methodof`). These unusual constructs may reveal bugs in third-party tools, because they are generally tested against the output of Microsoft compilers.
148+
149+
150+
## Compatibility with ARM platforms
151+
152+
**Developing** on ARM platforms (e.g. Mac M1, Raspberry Pi) is not supported.
153+
154+
**Targeting** ARM platforms is not supported. Target Any-CPU instead.
155+
156+
157+
## Known Incompatibilities
158+
159+
PostSharp is not compatible with the following products or features:
160+
161+
| Product or Feature | Reason | Workaround |
162+
|--------------------|--------|------------|
163+
| Visual Studio 2019 | No longer under Microsoft mainstream support | Use PostSharp 2024.0. |
164+
| Visual Studio 2017 | No longer under Microsoft mainstream support | Use PostSharp 6.10. |
165+
| Visual Studio 2015 | No longer under Microsoft mainstream support | Use PostSharp 6.5. |
166+
| Visual Studio 2013 | No longer under Microsoft mainstream support | Use PostSharp 6.0. |
167+
| Visual Studio 2012 | No longer under Microsoft mainstream support | Use PostSharp 5.0. |
168+
| Visual Studio 2010 | No longer under Microsoft mainstream support | Use PostSharp 3.1. |
169+
| ILMerge | Bug in ILMerge | Use another merging product (such as ILPack, SmartAssembly). |
170+
| Edit-and-Continue | Not Supported | Rebuild the project after edits |
171+
| Silverlight 3 or earlier | No longer under Microsoft mainstream support | Use PostSharp 2.1. |
172+
| Silverlight 4 | No longer under Microsoft mainstream support | Use PostSharp 3.1. |
173+
| Silverlight 5 | Low customer demand. | Use PostSharp 4.3. |
174+
| .NET Compact Framework | No support for PCL | Use PostSharp 2.1. |
175+
| .NET Framework 4.0 | No longer under Microsoft mainstream support | Target .NET Framework 4.5 or use PostSharp 6.5. |
176+
| .NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1 | No longer under Microsoft mainstream support | Target .NET Framework 4.6.2 or use PostSharp 6.10. |
177+
| .NET Framework 2.0 | No longer under Microsoft mainstream support | Target .NET Framework 3.5 or use PostSharp 3.1. |
178+
| .NET Core SDK 1.0, 1.1, 2.2, 3.0, 3.1 | No longer supported by Microsoft (end of life) | Use .NET 8.0 SDK (LTS). |
179+
| .NET SDK 5.0 (any version) | No longer supported by Microsoft (end of life) | Use .NET 8.0 SDK (LTS). |
180+
| Windows Phone 7 | No longer under Microsoft mainstream support | Use PostSharp 3.1 |
181+
| Windows Phone 8, WinRT | Low customer demand. | Use PostSharp 4.3 |
182+
| Visual Studio Express | Microsoft's licensing policy | Use Visual Studio Community Edition |
183+
| ASP.NET Web Sites | Not built using MSBuild | Convert the ASP.NET Web Site to an ASP.NET Web Application. |
184+
| Universal Windows Platform (UWP) | Not supported (low customer demand) | Contact PostSharp support team. |
185+
| Mono, Unity3D | Unsupported | None. |
186+
| Xamarin | Unsupported | Use Microsoft MAUI. |
187+

conceptual/DeploymentConfiguration/Deployment/requirements.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ You can use PostSharp to build applications that target a wide range of target d
1414
1515
This chapter contains the following sections:
1616

17+
* <xref:requirements-20250>
1718
* <xref:requirements-20241>
1819
* <xref:requirements-20240>
1920
* <xref:requirements-20230>

0 commit comments

Comments
 (0)