Files

82 lines
6.2 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/Properties/AssemblyInfo.cs
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/Properties/Annotations.cs
generated_at: "2026-04-16T13:52:16.308869+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "530eff79443974f8"
---
# Module Documentation: DTS.Viewer.Graph Properties
## 1. Purpose
This module component provides assembly-level configuration and static analysis support for the `DTS.Viewer.Graph` assembly. `AssemblyInfo.cs` establishes the assembly's identity, version (1.0.0.0), and COM visibility settings. `Annotations.cs` defines a comprehensive suite of custom attributes (sourced from JetBrains) used to enhance code inspection, nullability analysis, and framework-specific validations (ASP.NET MVC, Razor, XAML) within the codebase, enabling deeper static analysis without requiring external dependencies.
## 2. Public Interface
### Assembly Metadata (AssemblyInfo.cs)
These attributes configure the compiled assembly `DTS.Viewer.Graph.dll`.
* **`AssemblyTitle`**: Set to `"Graph"`.
* **`AssemblyProduct`**: Set to `"Graph"`.
* **`AssemblyVersion`**: Set to `"1.0.0.0"`.
* **`AssemblyFileVersion`**: Set to `"1.0.0.0"`.
* **`Guid`**: Set to `"61261c58-c32e-4dea-a87a-d7f956f28b4d"`.
* **`ComVisible`**: Set to `false`.
### Code Annotations (Annotations.cs)
The following attributes are defined in the `DTS.Viewer.Graph.Annotations` namespace. They are intended for use by static analysis tools (e.g., ReSharper, Rider) and the compiler.
**Nullability & Contracts:**
* **`CanBeNullAttribute`**: Indicates a value might be `null`.
* **`NotNullAttribute`**: Indicates a value should never be `null`.
* **`ItemNotNullAttribute`**: Indicates collection items or `Task.Result` are not `null`.
* **`ItemCanBeNullAttribute`**: Indicates collection items or `Task.Result` might be `null`.
* **`ContractAnnotationAttribute`**: Defines method input/output contracts (e.g., `null => halt`).
* **`PureAttribute`**: Marks a method as having no observable side effects.
**Usage & Visibility:**
* **`PublicAPIAttribute`**: Marks a type/member as part of the public API, preventing "unused" warnings.
* **`UsedImplicitlyAttribute`**: Indicates a symbol is used via reflection or external means.
* **`MeansImplicitUseAttribute`**: Applied to other attributes to indicate that targets should be considered "used".
* **`BaseTypeRequiredAttribute`**: Enforces that a type marked with a specific attribute must inherit from a specific base type.
**Method Behavior:**
* **`StringFormatMethodAttribute`**: Marks a method parameter as a format string (e.g., for `string.Format` validation).
* **`NotifyPropertyChangedInvocatorAttribute`**: Marks a method as raising the `PropertyChanged` event.
* **`InstantHandleAttribute`**: Indicates a delegate parameter is executed during the method call.
* **`MustUseReturnValueAttribute`**: Warns if the method's return value is ignored.
* **`CollectionAccessAttribute`**: Describes how a method modifies a collection (Read, Modify, Update).
* **`AssertionMethodAttribute` / `AssertionConditionAttribute`**: Marks methods that halt execution based on conditions (e.g., assertion methods).
**Framework Specific (ASP.NET, Razor, XAML):**
* **`AspMvcActionAttribute`, `AspMvcControllerAttribute`, `AspMvcViewAttribute`**: Assist in resolving MVC references.
* **`RazorSectionAttribute`, `RazorImportNamespaceAttribute`**: Assist in Razor view analysis.
* **`XamlItemsControlAttribute`, `XamlItemBindingOfItemsControlAttribute`**: Assist in XAML `DataContext` resolution.
**Miscellaneous:**
* **`SourceTemplateAttribute`**: Marks an extension method as a source template for code completion.
* **`MacroAttribute`**: Defines macros for source template parameters.
* **`NoReorderAttribute`**: Prevents code cleanup tools from reordering members.
## 3. Invariants
* **COM Visibility:** The assembly is explicitly configured with `ComVisible(false)`, ensuring types are not exposed to COM by default.
* **Version Consistency:** The `AssemblyVersion` and `AssemblyFileVersion` are both strictly defined as `1.0.0.0`.
* **Attribute Usage:** All annotation attributes are strictly constrained by `AttributeUsage` attributes. For example, `PureAttribute` can only target `Method`s, while `CanBeNullAttribute` can target methods, parameters, properties, delegates, fields, events, classes, interfaces, and generic parameters.
* **Licensing:** The `Annotations.cs` file is explicitly licensed under the MIT License (Copyright 2016 JetBrains), requiring the license notice to be preserved in copies.
## 4. Dependencies
* **System Dependencies:**
* `System.Reflection`
* `System.Runtime.CompilerServices`
* `System.Runtime.InteropServices`
* `System`
* **Tooling Dependencies:** The annotations in `Annotations.cs` are designed to be consumed by JetBrains static analysis tools (ReSharper, Rider). They have no runtime impact on the application logic itself.
* **Consumers:** This module is a foundational block for the `DTS.Viewer.Graph` project. Other projects referencing `DTS.Viewer.Graph` may utilize these annotations if exposed publicly, though they are primarily for internal analysis.
## 5. Gotchas
* **Obsolete Assertion Attribute:** The `TerminatesProgramAttribute` is marked `[Obsolete("Use [ContractAnnotation('=> halt')] instead")]`. Developers should avoid using this attribute in new code and prefer `ContractAnnotationAttribute`.
* **Hardcoded Version:** The version `1.0.0.0` is hardcoded in `AssemblyInfo.cs`. If this project uses CI/CD pipelines that typically auto-increment versions or use MSBuild properties (e.g., `1.0.*`), this file overrides that behavior, potentially requiring manual updates for new releases.
* **Duplicate Annotations:** The `Annotations.cs` file is a standard "copy-paste" of JetBrains annotations. If other modules in the solution (e.g., `DTS.Viewer.Core`) also include this file, there may be duplicate attribute definitions if namespaces are not carefully managed or if the `global` namespace is used, though here they are safely scoped to `DTS.Viewer.Graph.Annotations`.
* **Empty Description:** The `AssemblyDescription` attribute is an empty string, offering no metadata regarding the specific functionality of the Graph module.