PostSharp 2027.0 gives AI coding agents real build data

a computer screen with a bunch of code on it

AI coding agents struggle with PostSharp for a structural reason. The source code of a method shows none of the logging, caching, or thread safety that PostSharp weaves into the compiled assembly. The agent writes aspects from memory, drawing on samples spread across twenty years of PostSharp versions. When the build fails, it deletes the aspect instead of fixing it.

PostSharp 2027.0 addresses all three of those failure modes with four concrete additions.

AI Plugin for Claude Code and Codex

The PostSharp.AI.Skills plugin ships the full documentation in Markdown format, the API reference for every namespace, two search scripts for finding articles and API entries, and compilable source code for all examples. It also instructs the agent to look up the API before writing code, to build and verify, and to fix the root cause of a build message rather than suppressing it.

Install in Claude Code with two commands:

/plugin marketplace add https://github.com/postsharp/PostSharp.AI.Skills
/plugin install postsharp

Codex setup is covered in the Configuring AI Coding Agents docs. Available now.

CLI Introspection Without Visual Studio

The new postsharp introspect commands read the files from the last build and report which aspects apply to a given declaration, what created each aspect, and what each one changed and in what order. No IDE required.

postsharp introspect show declaration Orders/Repository.cs:10

The JSON output tells the agent that the Log aspect applies to Save because of a multicast attribute on the assembly, which the source of Save does not show. That context is the difference between an agent that fixes the problem and one that deletes the aspect.

The commands are designed for agent consumption: JSON output by default with a stable schema, OData $filter expressions for querying aspect classes and transformations, output capped to fit inside a context window with commands to fetch the rest, a batch mode that runs multiple queries over one project load, and backward compatibility with projects built on PostSharp 2023.0 through 2026.0 on Windows, Linux, and macOS.

Available from 2027.0.7-preview via:

dotnet tool install -g PostSharp.Tool --prerelease

Build Message Documentation

The new Errors and Warnings reference has one article per message code, such as PS0215, with its cause and the fix. An agent that reads the message code and then its article can repair the code rather than silence the warning. Available from 2027.0.5-preview.

Aspect Test Framework

The PostSharp.Testing.AspectTesting package, built on xunit.v3, is the same framework PostSharp uses to test itself. Each source file is compiled, woven into its own assembly, verified with ILVerify, and run. Tests compare program output and build messages against stored expected files, so a test can assert on a build error. The @CompareTransformedCode annotation decompiles the woven code back to C# and diffs it against a .t.cs snapshot file. Available from 2027.0.5-preview.

These features are in preview and not supported in production. Full release notes are in What’s New in PostSharp 2027.0.

Stay on top of AI & Automation with BizStack Newsletter
BizStack  —  Entrepreneur’s Business Stack
Logo