Files
DP44/docs/ai/Common/DTS.Common.CPU/Properties.md

192 lines
13 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common.CPU/Properties/AssemblyInfo.cs
- Common/DTS.Common.CPU/Properties/Annotations.cs
generated_at: "2026-04-17T15:42:18.019490+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "42a5c903cb87b2e6"
---
# Documentation: DTS.Common.CPU
## 1. Purpose
This module provides a comprehensive set of code annotation attributes for static analysis and IDE tooling support within the DTS.Common.CPU assembly. The attributes are derived from JetBrains ReSharper annotations (MIT licensed, 2016) and enable enhanced nullability analysis, contract annotations, MVC/Razor development support, and various code quality inspections. The module exists to improve developer productivity and catch potential bugs at compile-time through rich metadata annotations rather than providing runtime functionality.
## 2. Public Interface
### Nullability Attributes
| Attribute | Targets | Description |
|-----------|---------|-------------|
| `CanBeNullAttribute` | Method, Parameter, Property, Delegate, Field, Event, Class, Interface, GenericParameter | Indicates the marked element's value could be `null` sometimes, requiring null checks before usage. |
| `NotNullAttribute` | Method, Parameter, Property, Delegate, Field, Event, Class, Interface, GenericParameter | Indicates the marked element's value can never be `null`. |
| `ItemNotNullAttribute` | Method, Parameter, Property, Delegate, Field | Applied to IEnumerable, Task, or Lazy types to indicate collection items, Task.Result, or Lazy.Value can never be null. |
| `ItemCanBeNullAttribute` | Method, Parameter, Property, Delegate, Field | Applied to IEnumerable, Task, or Lazy types to indicate collection items, Task.Result, or Lazy.Value can be null. |
| `ImplicitNotNullAttribute` | Class, Struct, Interface, Assembly | Implicitly applies `[NotNull]`/`[ItemNotNull]` to all type members and parameters in scope. |
### String and Parameter Attributes
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `StringFormatMethodAttribute` | `ctor(string formatParameterName)` | Indicates a method builds strings by format pattern. `FormatParameterName` property identifies which parameter contains the format string. |
| `ValueProviderAttribute` | `ctor(string name)` | Indicates a parameter expects values from a limited set, specified by the `Name` property. |
| `InvokerParameterNameAttribute` | Parameter | Indicates the function argument should be a string literal matching one of the caller function's parameters. |
| `PathReferenceAttribute` | `ctor()` / `ctor(string basePath)` | Indicates a parameter is a path to a file/folder within a web project. Optional `BasePath` property for relative paths. |
| `RegexPatternAttribute` | Parameter | Indicates the parameter is a regular expression pattern. |
### Property Change Notification
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `NotifyPropertyChangedInvocatorAttribute` | `ctor()` / `ctor(string parameterName)` | Marks a method in an `INotifyPropertyChanged` implementation used to notify property changes. Optional `ParameterName` property. |
### Contract Annotations
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `ContractAnnotationAttribute` | `ctor(string contract)` / `ctor(string contract, bool forceFullStates)` | Describes dependencies between method input and output using Function Definition Table syntax. Properties: `Contract` (string), `ForceFullStates` (bool). |
### Localization and Equality
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `LocalizationRequiredAttribute` | `ctor()` / `ctor(bool required)` | Indicates whether marked element should be localized. `Required` property defaults to `true`. |
| `CannotApplyEqualityOperatorAttribute` | Interface, Class, Struct | Indicates the type cannot be compared using `==` or `!=` operators; `Equals()` must be used instead. Comparison with `null` remains permitted. |
### Implicit Usage Attributes
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `UsedImplicitlyAttribute` | `ctor()` / `ctor(ImplicitUseKindFlags)` / `ctor(ImplicitUseTargetFlags)` / `ctor(ImplicitUseKindFlags, ImplicitUseTargetFlags)` | Marks a symbol as used implicitly (e.g., via reflection). Properties: `UseKindFlags`, `TargetFlags`. |
| `MeansImplicitUseAttribute` | `ctor()` / `ctor(ImplicitUseKindFlags)` / `ctor(ImplicitUseTargetFlags)` / `ctor(ImplicitUseKindFlags, ImplicitUseTargetFlags)` | Applied to attributes; prevents symbols marked with such attributes from being flagged as unused. Properties: `UseKindFlags`, `TargetFlags`. |
| `PublicAPIAttribute` | `ctor()` / `ctor(string comment)` | Marks publicly available API that should not be removed. Inherits `MeansImplicitUseAttribute` behavior with `WithMembers` target. |
### Enums for Implicit Usage
| Enum | Values | Description |
|------|--------|-------------|
| `ImplicitUseKindFlags` | `Default` (Access\|Assign\|InstantiatedWithFixedConstructorSignature), `Access` (1), `Assign` (2), `InstantiatedWithFixedConstructorSignature` (4), `InstantiatedNoFixedConstructorSignature` (8) | Flags specifying how a symbol is implicitly used. |
| `ImplicitUseTargetFlags` | `Default` (Itself), `Itself` (1), `Members` (2), `WithMembers` (Itself\|Members) | Flags specifying what is considered used implicitly. |
### Method Behavior Attributes
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `InstantHandleAttribute` | Parameter | Indicates a parameter is completely handled during method execution (delegate executed, enumerable enumerated). |
| `PureAttribute` | Method | Indicates a method makes no observable state changes. |
| `MustUseReturnValueAttribute` | `ctor()` / `ctor(string justification)` | Indicates the return value of a method invocation must be used. Optional `Justification` property. |
| `TerminatesProgramAttribute` | Method | **[Obsolete: Use `[ContractAnnotation("=> halt")]` instead]** Indicates a method unconditionally terminates control flow. |
| `LinqTunnelAttribute` | Method | Indicates a pure LINQ method with postponed enumeration (like `Select`, `Where`). |
| `NoEnumerationAttribute` | Parameter | Indicates an IEnumerable parameter is not enumerated. |
### Context and Base Type
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `ProvidesContextAttribute` | Field, Property, Parameter, Method, Class, Interface, Struct, GenericParameter | Indicates a member that should be used instead of other ways to obtain that type's value. |
| `BaseTypeRequiredAttribute` | `ctor(Type baseType)` | When applied to an attribute, requires types marked with that attribute to implement/inherit `BaseType`. Must be applied to `Attribute`-derived classes. |
### Source Templates
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `SourceTemplateAttribute` | Method | Marks an extension method as a source template for code completion expansion. |
| `MacroAttribute` | Parameter, Method (AllowMultiple) | Specifies macros for source template parameters. Properties: `Expression` (string), `Editable` (int), `Target` (string). |
### ASP.NET MVC Attributes
| Attribute | Targets | Description |
|-----------|---------|-------------|
| `AspMvcActionAttribute` | Parameter, Method | Indicates a parameter is an MVC action name. Optional `AnonymousProperty` property. |
| `AspMvcAreaAttribute` | Parameter | Indicates a parameter is an MVC area. Optional `AnonymousProperty` property. |
| `AspMvcControllerAttribute` | Parameter, Method | Indicates a parameter is an MVC controller. Optional `AnonymousProperty` property. |
| `AspMvcMasterAttribute` | Parameter | Indicates a parameter is an MVC Master. |
| `AspMvcModelTypeAttribute` | Parameter | Indicates a parameter is an MVC model type. |
| `AspMvcPartialViewAttribute` | Parameter, Method | Indicates a parameter is an MVC partial view. |
| `AspMvcViewAttribute` | Parameter, Method | Indicates a parameter is an MVC view component. |
| `AspMvcViewComponentAttribute` | Parameter | Indicates a parameter is an MVC view component name. |
| `AspMvcViewComponentViewAttribute` | Parameter, Method | Indicates a parameter is an MVC view component view. |
| `AspMvcActionSelectorAttribute` | Parameter, Property | Applied to attribute parameters to indicate MVC action name. |
| `AspMvcDisplayTemplateAttribute` | Parameter | Indicates a parameter is an MVC display template. |
| `AspMvcEditorTemplateAttribute` | Parameter | Indicates a parameter is an MVC editor template. |
| `AspMvcTemplateAttribute` | Parameter | Indicates a parameter is an MVC template. |
| `AspMvcSuppressViewErrorAttribute` | Class, Method | Disables MVC view inspections within a class or method. |
### ASP.NET MVC Location Format Attributes (Assembly-level)
| Attribute | Signature |
|-----------|-----------|
| `AspMvcAreaMasterLocationFormatAttribute` | `ctor(string format)` |
| `AspMvcAreaPartialViewLocationFormatAttribute` | `ctor(string format)` |
| `AspMvcAreaViewLocationFormatAttribute` | `ctor(string format)` |
| `AspMvcMasterLocationFormatAttribute` | `ctor(string format)` |
| `AspMvcPartialViewLocationFormatAttribute` | `ctor(string format)` |
| `AspMvcViewLocationFormatAttribute` | `ctor(string format)` |
### HTML Attributes
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `HtmlElementAttributesAttribute` | `ctor()` / `ctor(string name)` | Applied to parameters/properties/fields for HTML element attributes. Optional `Name` property. |
| `HtmlAttributeValueAttribute` | `ctor(string name)` | Indicates an HTML attribute value. `Name` property is required. |
### Razor Attributes
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `RazorSectionAttribute` | Parameter, Method | Indicates a parameter or method is a Razor section. |
| `RazorImportNamespaceAttribute` | Assembly | `ctor(string name)` - Imports a namespace in Razor. |
| `RazorInjectionAttribute` | Assembly | `ctor(string type, string fieldName)` - Configures Razor injection. Properties: `Type`, `FieldName`. |
| `RazorDirectiveAttribute` | Assembly | `ctor(string directive)` - Specifies a Razor directive. |
| `RazorHelperCommonAttribute` | Method | Marks Razor helper methods. |
| `RazorLayoutAttribute` | Property | Marks Razor layout properties. |
| `RazorWriteLiteralMethodAttribute` | Method | Marks Razor write literal methods. |
| `RazorWriteMethodAttribute` | Method | Marks Razor write methods. |
| `RazorWriteMethodParameterAttribute` | Parameter | Marks Razor write method parameters. |
### ASP.NET Web Forms Attributes
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `AspChildControlTypeAttribute` | Class | `ctor(string tagName, Type controlType)` - Specifies child control types. Properties: `TagName`, `ControlType`. |
| `AspDataFieldAttribute` | Property, Method | Marks ASP.NET data fields. |
| `AspDataFieldsAttribute` | Property, Method | Marks multiple ASP.NET data fields. |
| `AspMethodPropertyAttribute` | Property | Marks ASP.NET method properties. |
| `AspRequiredAttributeAttribute` | Class | `ctor(string attribute)` - Specifies required attributes. `Attribute` property. |
| `AspTypePropertyAttribute` | Property | `ctor(bool createConstructorReferences)` - Marks ASP.NET type properties. `CreateConstructorReferences` property. |
### Collection Access
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `CollectionAccessAttribute` | `ctor(CollectionAccessType)` | Indicates how a method/constructor/property affects collection content. `CollectionAccessType` property. |
| Enum | Values |
|------|--------|
| `CollectionAccessType` | `None` (0), `Read` (1), `ModifyExistingContent` (2), `UpdatedContent` (ModifyExistingContent\|4) |
### Assertion Attributes
| Attribute | Signature | Description |
|-----------|-----------|-------------|
| `AssertionMethodAttribute` | Method | Marks a method as an assertion method that halts control flow if conditions are satisfied. |
| `AssertionConditionAttribute` | `ctor(AssertionConditionType)` | Marks the condition parameter of an assertion method. `ConditionType` property. |
| Enum | Values |
|------|--------|
| `AssertionConditionType` | `IS_TRUE` (0), `IS_FALSE` (1), `IS_NULL` (2), `IS_NOT_NULL` (3) |
### XAML Attributes
| Attribute | Targets | Description |
|-----------|---------|-------------|
| `XamlItemsControlAttribute` | Class | Indicates a type with `ItemsSource` property should be treated as `ItemsControl`-derived. |
| `XamlItemBindingOfItemsControlAttribute` | Property | Indicates a `BindingBase`-derived property used to bind items in an `ItemsControl`. |
### Utility
| Attribute | Targets | Description |
|-----------|---------|-------------|
| `NoReorder` | All | Prevents Member Reordering feature from re