RunicDevelopmentOnlyAttribute class

Namespace Runic.Application.Views in Runic.Application.Views 0.23.0

public sealed class RunicDevelopmentOnlyAttribute : Attribute

Inherits or implements Attribute.

Marks a ViewModel, or one of its properties or commands, as a development tool, such as a mock-control panel or a diagnostics member: a trimmed or NativeAOT publish leaves it out, together with the generated code only it needs.

Remarks

In builds, dotnet run, the debugger and untrimmed publishes, everything is as without the attribute. A trimmed or NativeAOT publish turns RunicDevelopmentOnly.IsSupported off (the MSBuild property RunicDevelopmentOnlyViews, auto by default; true keeps them in every publish):

  • A marked ViewModel has no Bridge: presenting it, or opening a Window or View of it, throws an InvalidOperationException that names it.
  • A marked property is absent from the state, and the page cannot set or write it. A marked command, on its property or on its CommunityToolkit [RelayCommand] method, and its can… and is…Executing state are absent too; calling it is rejected as unavailable.

The generated client is the same in every configuration, so the page's types describe a marked member as one that may be absent (an optional state member) and a marked command as one that may be unavailable. Marking a member changes the View's contract fingerprint; marking a ViewModel does not.

Constructors

RunicDevelopmentOnlyAttribute

public RunicDevelopmentOnlyAttribute()

No documentation.