← All recipes
Moderne licensed

Avoid side effects in attached property CLR accessors

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Wpf.FindSideEffectsInAttachedPropertyAccessorArtifactOpenRewrite.Recipes.CSharp.CodeQuality

XAML bypasses the CLR Get/Set methods of an attached property and calls GetValue/SetValue directly, so any other work an accessor does runs only when the property is set from code. Flags the offending statement.

Single recipecsharpcode-qualityProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe OpenRewrite.Recipes.CSharp.CodeQuality.Wpf.FindSideEffectsInAttachedPropertyAccessor

If the recipe isn’t available locally, install it with:

mod config recipes nuget install OpenRewrite.Recipes.CSharp.CodeQuality