Skip to content

PostSharp 2027.0.2-preview

Pre-release
Pre-release

Choose a tag to compare

@gfraiteur gfraiteur released this 03 Oct 08:56

PostSharp 2027.0.2-preview is based on v2027.0.1-preview, plus the following changes.

New

  • #168 Advice parameter binding is now a publicly supported feature, after years of internal use by the Pattern Libraries. An advice method can receive only the values it needs, as typed parameters bound by attributes such as [Argument], [This] and [State], instead of an AdviceArgs object allocated on every call. This release reports invalid bindings as errors (#161, #162) and makes simple declarative aspects less verbose (#192).
  • #187 Added support for runtime-generated async methods (<Features>runtime-async=on</Features> on .NET 11), whose state machine is generated by the runtime instead of the C# compiler. Aspects applied to these methods previously failed at run time with InvalidProgramException. Aspects see the same advices, in the same order and with the same arguments, as with a compiler-generated state machine.
  • #188 A repository can opt out of telemetry for every build and every machine by setting the TelemetryEnabled property to False in the postsharp.config file at its root.
  • SharpCrafters.Backstage#24 Added the reading of a configuration file at the root of the repository. PostSharp reads postsharp.config, where a repository can opt out of telemetry with the TelemetryEnabled property (postsharp/PostSharp.Public#188). A file that cannot be read is reported as a build warning.

Enhancements

  • #192 In a declarative aspect, [SelfPointcut] and Master can now be omitted when there is only one way to group the advices.

Fixes

  • #161 Fixed an internal compiler exception, or an advice silently disabled, when an advice method has an invalid parameter binding, for example two binding attributes on one parameter or a parameter type that is not compatible with the bound value. An error located at the parameter is now reported.
  • #162 Fixed invalid IL, or an internal compiler exception, when an advice with bound parameters does not match its target, for example [Argument(n)] with an index out of range or [This] on a static target. An error that names the advice, the parameter and the target is now reported.
  • #171 The PostSharp.Tool package, which was missing from 2027.0.1-preview, is now published, so dotnet tool install -g PostSharp.Tool installs the postsharp command line tool.
  • #182 Warnings about the repository configuration, for example a postsharp.config file that cannot be read, are now reported as PS0284 build warnings located at the file. They were previously ignored.
  • SharpCrafters.Backstage#26 Fixed usage telemetry slowing down the parallel build of a large solution. Each project now records its usage session separately, so build processes no longer wait for each other on a single lock (metalama/Metalama#2092).
  • SharpCrafters.Backstage#25 Fixed a crash with COMException when Windows refuses to display a toast notification. The notification is now skipped when the machine cannot display it (metalama/Metalama#2047).

Resources