5.7 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T02:15:24.461897+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | e93e9dbcf99f35a2 |
DTS.CommonCore Module Documentation
1. Purpose
This module (DTS.CommonCore) is a shared infrastructure library containing assembly metadata, application settings, and JetBrains Annotations for static code analysis. It serves as a foundational component for other modules in the DTS ecosystem by providing standardized configuration (e.g., tile asset paths), compile-time nullability contracts, and tooling annotations that enable ReSharper and similar analyzers to improve code correctness and maintainability. It does not contain business logic but supports consistency and correctness across dependent modules.
2. Public Interface
Classes
DTS.Common.Properties.Settings
public static Settings Default { get; }
Returns the singleton instance of the application settings. This is the primary access point for reading settings values.
DTS.Common.Properties.Settings.TilesLocation
public string TilesLocation { get; }
Returns the configured path to tile assets, with a default value of"Assets\\Tiles\\". This is an application-scoped setting (read-only at runtime).
JetBrains Annotation Attributes (Namespace: DTS.Common.Annotations)
These are metadata attributes only—they have no runtime behavior but guide static analysis tools.
-
[CanBeNull]
Indicates a value may benull. Applied to parameters, return values, fields, properties, etc. -
[NotNull]
Indicates a value must not benull. Applied to parameters, return values, fields, properties, etc. -
[ItemCanBeNull]/[ItemNotNull]
Applied to collections,Task<T>, orLazy<T>to indicate whether items/values may benull. -
[StringFormatMethod(string formatParameterName)]
Marks methods that build strings using a format string (e.g.,string.Format-style). TheformatParameterNameargument specifies which parameter holds the format string. -
[ContractAnnotation(string contract)]
Describes input/output relationships (e.g.,"s:null => true"forstring.IsNullOrEmpty). Supports complex contracts using FDT syntax. -
[NotifyPropertyChangedInvocator]
Marks methods used to raiseINotifyPropertyChangedevents. Enables tooling to validate property name strings. -
[PublicAPI(string comment)]
Marks members as part of the public API surface, preventing them from being flagged as unused. -
[Pure]
Indicates a method has no side effects (likeSystem.Diagnostics.Contracts.PureAttribute). -
[MustUseReturnValue]
Indicates the return value of a method must be used; ignoring it triggers a warning. -
[InstantHandle]
Indicates a delegate or enumerable parameter is consumed synchronously within the method. -
[AssertionMethod]/[AssertionCondition(AssertionConditionType)]
Marks assertion methods (e.g.,ThrowIfNull) and specifies the condition under which execution continues. -
[NoReorder]
Prevents IDE member reordering for the marked type.
Note
: All other attributes in
DTS.Common.Annotationsare similarly annotation-only and serve static analysis purposes. Their full semantics are documented in the source file comments.
3. Invariants
- Settings immutability:
TilesLocationis anApplicationScopedSettingAttribute, meaning its value is fixed at compile time and cannot be modified at runtime. - Nullability contracts: Annotations like
[NotNull]and[CanBeNull]are declarative only—they do not enforce null checks at runtime. Violations are detected only by static analysis tools. - No side effects for pure methods: Methods marked
[Pure]must not mutate observable state; this is a contract enforced by tooling, not the runtime. - No runtime behavior: All attributes in
DTS.Common.Annotationsare inert at runtime (i.e.,Attribute.IsDefinedchecks will work, but they do not alter execution flow).
4. Dependencies
Dependencies of this module:
System.Configuration(forApplicationSettingsBase,ApplicationScopedSettingAttribute)System.Reflection(for assembly attributes)System.Runtime.InteropServices(for COM interop attributes)
Dependencies on this module:
- Any module referencing
DTS.CommonCorecan use:DTS.Common.Properties.Settings.Default.TilesLocationfor tile asset paths.- All annotation attributes in
DTS.Common.Annotationsto annotate their own code for static analysis.
5. Gotchas
- No runtime validation: Annotations like
[NotNull]do not throwNullReferenceExceptionorArgumentNullExceptionautomatically. Developers must manually enforce these contracts (e.g., viaGuardclauses). - Settings are compile-time constants:
TilesLocationcannot be overridden viaapp.configor user settings—it is fixed at build time. - Tooling-dependent: Annotations only provide value when using JetBrains ReSharper or compatible analyzers (e.g., Rider, Roslyn with ReSharper plugin). They are ignored by the C# compiler and .NET runtime.
- Auto-generated code:
Settings.Designer.csis auto-generated. Manual edits will be overwritten—changes should be made in the.settingsdesigner or viaSettings.cs(if present). - COM visibility disabled:
ComVisible(false)means types in this assembly are not exposed to COM. This is intentional for a .NET-only library. - Versioning: Assembly version is hardcoded to
1.0.0.0(withAssemblyFileVersionidentical). No automatic build/revision numbering is configured.