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

214 lines
11 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.CommonCore/Properties/AssemblyInfo.cs
- Common/DTS.CommonCore/Properties/Settings.Designer.cs
- Common/DTS.CommonCore/Properties/Annotations.cs
generated_at: "2026-04-17T15:39:54.133449+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "adc61af3e00cb084"
---
# Documentation: DTS.CommonCore Properties
## 1. Purpose
This module provides assembly-level configuration and design-time annotations for the `DTS.CommonCore` library. It consists of three components: standard .NET assembly metadata (`AssemblyInfo.cs`), application settings with a tile location path (`Settings.Designer.cs`), and a comprehensive set of JetBrains ReSharper/Rider annotations (`Annotations.cs`) that enable enhanced static analysis, nullability checking, and code inspection hints throughout the codebase. The annotations are third-party code licensed from JetBrains under the MIT license.
---
## 2. Public Interface
### AssemblyInfo.cs
No public types. Contains assembly-level attributes:
- `AssemblyTitle`: "Common"
- `AssemblyCompany`: "Microsoft"
- `AssemblyCopyright`: "Copyright © Microsoft 2016"
- `AssemblyVersion`: "1.0.0.0"
- `AssemblyFileVersion`: "1.0.0.0"
- `ComVisible`: `false`
- `Guid`: "d16201c7-478c-4b92-ba6e-a0d39fd5f081"
### Settings.Designer.cs
**Namespace:** `DTS.Common.Properties`
#### `Settings` Class
```csharp
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
```
Auto-generated settings class providing application-scoped configuration access.
| Member | Signature | Description |
|--------|-----------|-------------|
| `Default` | `public static Settings Default { get; }` | Thread-safe singleton instance via `Synchronized()` |
| `TilesLocation` | `public string TilesLocation { get; }` | Application-scoped setting with default value `"Assets\\Tiles\\"` |
### Annotations.cs
**Namespace:** `DTS.Common.Annotations`
The following attribute classes are defined (all `public sealed` unless noted):
#### Nullability Attributes
| Attribute | Targets | Purpose |
|-----------|---------|---------|
| `CanBeNullAttribute` | Method, Parameter, Property, Delegate, Field, Event, Class, Interface, GenericParameter | Indicates value may be `null` |
| `NotNullAttribute` | Same as above | Indicates value is never `null` |
| `ItemNotNullAttribute` | Method, Parameter, Property, Delegate, Field | Collection items/Task.Result/Lazy.Value are never null |
| `ItemCanBeNullAttribute` | Same as above | Collection items/Task.Result/Lazy.Value may be null |
| `ImplicitNotNullAttribute` | Class, Struct, Interface, Assembly | Implicitly applies `[NotNull]`/`[ItemNotNull]` to scope |
#### String/Format Attributes
| Attribute | Constructor | Purpose |
|-----------|-------------|---------|
| `StringFormatMethodAttribute` | `(string formatParameterName)` | Marks method as string format builder; `FormatParameterName` property identifies format parameter |
| `ValueProviderAttribute` | `(string name)` | Parameter expects values from specified type fields; `Name` property |
#### Property Change Notification
| Attribute | Constructor | Purpose |
|-----------|-------------|---------|
| `NotifyPropertyChangedInvocatorAttribute` | `()` or `(string parameterName)` | Marks INPC notification methods; optional `ParameterName` property |
#### Contract Annotations
| Attribute | Constructor | Purpose |
|-----------|-------------|---------|
| `ContractAnnotationAttribute` | `(string contract)` or `(string contract, bool forceFullStates)` | Describes input/output dependencies; `Contract` and `ForceFullStates` properties |
#### Usage Attributes
| Attribute | Constructor | Properties |
|-----------|-------------|------------|
| `UsedImplicitlyAttribute` | Multiple overloads | `UseKindFlags`, `TargetFlags` |
| `MeansImplicitUseAttribute` | Multiple overloads | `UseKindFlags`, `TargetFlags` |
| `PublicAPIAttribute` | `()` or `(string comment)` | `Comment` property |
#### Enums
```csharp
[Flags] public enum ImplicitUseKindFlags
```
Values: `Default` (1|2|4), `Access` (1), `Assign` (2), `InstantiatedWithFixedConstructorSignature` (4), `InstantiatedNoFixedConstructorSignature` (8)
```csharp
[Flags] public enum ImplicitUseTargetFlags
```
Values: `Default` (1), `Itself` (1), `Members` (2), `WithMembers` (3)
#### Method Behavior Attributes
| Attribute | Purpose |
|-----------|---------|
| `InstantHandleAttribute` | Parameter is handled/delegate executed during method execution |
| `PureAttribute` | Method makes no observable state changes |
| `MustUseReturnValueAttribute` | Return value must be used; optional `Justification` property |
| `ProvidesContextAttribute` | Member provides context value that should be used |
#### Collection Access
| Attribute | Constructor | Property |
|-----------|-------------|----------|
| `CollectionAccessAttribute` | `(CollectionAccessType)` | `CollectionAccessType` |
```csharp
[Flags] public enum CollectionAccessType
```
Values: `None` (0), `Read` (1), `ModifyExistingContent` (2), `UpdatedContent` (6)
#### Assertion Attributes
| Attribute | Constructor | Property |
|-----------|-------------|----------|
| `AssertionMethodAttribute` | Default | Marks assertion method |
| `AssertionConditionAttribute` | `(AssertionConditionType)` | `ConditionType` |
```csharp
public enum AssertionConditionType
```
Values: `IS_TRUE` (0), `IS_FALSE` (1), `IS_NULL` (2), `IS_NOT_NULL` (3)
#### ASP.NET MVC Attributes
- `AspMvcActionAttribute` - Parameter is MVC action; optional `AnonymousProperty`
- `AspMvcAreaAttribute` - Parameter is MVC area
- `AspMvcControllerAttribute` - Parameter is MVC controller
- `AspMvcMasterAttribute` - Parameter is MVC master
- `AspMvcModelTypeAttribute` - Parameter is MVC model type
- `AspMvcPartialViewAttribute` - Parameter is MVC partial view
- `AspMvcViewAttribute` - Parameter is MVC view
- `AspMvcViewComponentAttribute` - Parameter is view component name
- `AspMvcViewComponentViewAttribute` - Parameter is view component view
- `AspMvcActionSelectorAttribute` - Parameter is action name in attribute
- `AspMvcDisplayTemplateAttribute`, `AspMvcEditorTemplateAttribute`, `AspMvcTemplateAttribute` - Template parameters
- `AspMvcSuppressViewErrorAttribute` - Disables MVC view inspections
- Location format attributes (assembly-level, multiple allowed): `AspMvcAreaMasterLocationFormatAttribute`, `AspMvcAreaPartialViewLocationFormatAttribute`, `AspMvcAreaViewLocationFormatAttribute`, `AspMvcMasterLocationFormatAttribute`, `AspMvcPartialViewLocationFormatAttribute`, `AspMvcViewLocationFormatAttribute`
#### Razor Attributes
- `RazorSectionAttribute` - Parameter/method is Razor section
- `RazorImportNamespaceAttribute` (assembly-level) - `Name` property
- `RazorInjectionAttribute` (assembly-level) - `Type`, `FieldName` properties
- `RazorDirectiveAttribute` (assembly-level) - `Directive` property
- `RazorHelperCommonAttribute`, `RazorLayoutAttribute`, `RazorWriteLiteralMethodAttribute`, `RazorWriteMethodAttribute`, `RazorWriteMethodParameterAttribute`
#### XAML Attributes
- `XamlItemsControlAttribute` - Class has `ItemsSource` property
- `XamlItemBindingOfItemsControlAttribute` - Property is `BindingBase` for ItemsControl item
#### Source Template Attributes
| Attribute | Purpose | Properties |
|-----------|---------|------------|
| `SourceTemplateAttribute` | Extension method expands as template | None |
| `MacroAttribute` | Macro for template parameter | `Expression`, `Editable`, `Target` |
#### Other Attributes
- `LocalizationRequiredAttribute` - `Required` property indicates localization needed
- `CannotApplyEqualityOperatorAttribute` - Use `Equals()` instead of `==`/`!=`
- `BaseTypeRequiredAttribute` - `[BaseTypeRequired(typeof(Attribute))]` on attribute classes; `BaseType` property
- `PathReferenceAttribute` - Parameter is file/folder path; optional `BasePath`
- `LinqTunnelAttribute` - Pure LINQ method with postponed enumeration
- `NoEnumerationAttribute` - IEnumerable parameter not enumerated
- `RegexPatternAttribute` - Parameter is regex pattern
- `NoReorder` - Prevents member reordering
- `TerminatesProgramAttribute` - **Obsolete**: Use `[ContractAnnotation("=> halt")]` instead
#### ASP.NET Web Forms Attributes
- `AspChildControlTypeAttribute` - `TagName`, `ControlType` properties
- `AspDataFieldAttribute`, `AspDataFieldsAttribute`, `AspMethodPropertyAttribute`
- `AspRequiredAttributeAttribute` - `Attribute` property
- `AspTypePropertyAttribute` - `CreateConstructorReferences` property
#### HTML Attributes
- `HtmlElementAttributesAttribute` - Optional `Name` property
- `HtmlAttributeValueAttribute` - `Name` property (required)
---
## 3. Invariants
- **Settings.Singleton Pattern**: The `Settings.Default` property always returns a synchronized singleton instance; it is never null.
- **Settings.TilesLocation**: Always returns a non-null string; default value is `"Assets\\Tiles\\"`. This is an application-scoped setting (read-only at runtime).
- **Annotations License**: The `Annotations.cs` file is MIT-licensed from JetBrains (2016). The license header must be preserved.
- **Annotations Design-Time Only**: All attributes in `Annotations.cs` have no runtime behavior; they are consumed by static analysis tools (ReSharper/Rider).
- **Settings Auto-Generated**: `Settings.Designer.cs` is tool-generated; manual changes will be lost on regeneration.
---
## 4. Dependencies
### This module depends on:
- `System.Reflection` (AssemblyInfo.cs)
- `System.Runtime.CompilerServices` (AssemblyInfo.cs, Settings.Designer.cs, Annotations.cs)
- `System.Runtime.InteropServices` (AssemblyInfo.cs)
- `System.Configuration.ApplicationSettingsBase` (Settings.Designer.cs)
- `System` (Annotations.cs - for `Attribute`, `Type`, `FlagsAttribute`, etc.)
### What depends on this module:
**Cannot be determined from source alone.** The `DTS.Common.Annotations` namespace attributes are intended to be used throughout the solution for static analysis hints. The `TilesLocation` setting suggests tile-based functionality elsewhere in the system.
---
## 5. Gotchas
1. **Settings.Designer.cs is auto-generated**: The file header explicitly warns that changes will be lost if the code is regenerated. Modify settings through the Visual Studio settings designer or the `.settings` file, not directly.
2. **Annotations.cs is third-party code**: This file is from JetBrains (copyright 2016). Updates to ReSharper/Rider may include newer versions of these annotations. Consider whether to update this file when upgrading IDE tooling.
3. **TerminatesProgramAttribute is obsolete**: The `TerminatesProgramAttribute` class is marked `[Obsolete("Use [ContractAnnotation('=> halt')] instead")]`. New code should use `ContractAnnotationAttribute` instead.
4. **Namespace mismatch**: The assembly title is "Common" but the root namespace appears to be `DTS.Common` (from `Settings.Designer.cs`) and `DTS.Common.Annotations` (from `Annotations.cs`). The project folder is `DTS.CommonCore`. This inconsistency could cause confusion when locating types.
5. **TilesLocation path format**: The default value uses Windows-style path separators (`\\`). Cross-platform compatibility is unclear from source alone.