PostSharp 2025.0 Generally Available: Support for C# 13, .NET 9 and More

by Gael Fraiteur on 04 Jan 2025

Alongside Metalama 2025.0, we’re announcing the general availability of PostSharp 2025.0. This release focuses on supporting C# 13 and .NET 9 while also including improvements like long path support for .NET Framework projects, runtime performance enhancements for WeakEventHandler, and a better debugging experience for projects using Windows PDB.

C# 13 and .NET 9

We’ve thoroughly tested and enhanced PostSharp to support the new .NET 9 SDK and C# 13.

Through this effort, we identified and resolved some old bugs. One was related to parameters of type ref struct, and the other involved the mapping of generic methods.

Improved Windows PDB support

We’ve rewritten the component that handles the Windows PDB format. Our previous implementation relied on source code from the outdated Microsoft CCI project, and was no longer maintainable. Our new implementation utilizes the ISymUnmanagedReader COM interface and should automatically benefit from all fixes and enhancements in the .NET Framework and Visual Studio.

This work resolves several issues affecting the debugging experience when using Windows PDB files. It also makes it easier for us to implement support for new PDB features.

Long path support

We’ve finally addressed a limitation affecting projects targeting the .NET Framework: they had to remain under a directory with a path length shorter than 256 characters.

We’re both pleased and a bit embarrassed (considering how long it took) to say that you can now store your projects as deep in your file system as you like.

WeakEventHandler performance

We’ve improved the performance of the WeakEventHandler class (used, among other things, in the [NotifyPropertyChanged] aspect) in cases with a large number of subscribers.

With 10,000 subscribers, our implementation could be 25 times slower than MulticastDelegate when removing subscribers. Yes, Big O analysis matters!

We’ve fixed this issue, and we’re happy to announce that our WeakEventHandler now has performance characteristics similar to MulticastDelegate.

Conclusion

While our new development efforts are focused on Metalama, PostSharp 2025.0 demonstrates our commitment to supporting loyal customers with the latest .NET stack while maintaining compatibility with the legacy .NET Framework as long as possible. We continually address issues that affect our customers and plan to remain a reliable partner in the future.

Happy meta-programming with PostSharp!