--- source_files: - Common/DTS.CommonCore/Exceptions/OutOfDataException.cs generated_at: "2026-04-17T16:38:13.290924+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "e17739ecd0d7bb21" --- # Documentation: OutOfDataException ## 1. Purpose `OutOfDataException` is a custom exception class within the `DTS.Common.Exceptions` namespace, designed to signal that a data-consuming operation has exhausted its available data. It extends the standard `System.Exception` class and adds an `Index` property to capture the position at which the out-of-data condition occurred, enabling more precise debugging and error reporting during data parsing, streaming, or iteration operations. ## 2. Public Interface ### Class: `OutOfDataException` **Inherits from:** `System.Exception` **Namespace:** `DTS.Common.Exceptions` #### Constructor ```csharp public OutOfDataException(string ex, long index) ``` Creates a new instance of `OutOfDataException` with the specified message and index position. | Parameter | Type | Description | |-----------|------|-------------| | `ex` | `string` | The exception message passed to the base `Exception` class | | `index` | `long` | The position/index at which the out-of-data condition occurred | #### Properties ```csharp public long Index { get; private set; } ``` A read-only property that stores the index position where the exception was raised. Set only at construction time via the constructor. ## 3. Invariants - **Index Immutability**: Once set during construction, the `Index` property cannot be modified externally (private setter). - **Index Requirement**: Every `OutOfDataException` instance must have an `Index` value; there is no parameterless constructor or constructor overload that omits the index. - **Inheritance Contract**: All standard `System.Exception` behaviors and invariants apply (e.g., serializability, stack trace capture). ## 4. Dependencies ### This module depends on: - `System` (specifically `System.Exception` as the base class) ### What depends on this module: - Cannot be determined from this source file alone. Consumers would typically be data parsing, streaming, or collection iteration components within the `DTS.CommonCore` library or dependent projects. ## 5. Gotchas - **Misleading Parameter Name**: The constructor parameter `ex` suggests it might accept an exception object, but it actually expects a `string` message. A more conventional name would be `message` or `msg`. - **No Standard Exception Constructors**: Unlike typical custom exceptions, this class does not provide: - A parameterless constructor - A constructor accepting only a message - A constructor for serialization (`SerializationInfo, StreamingContext`) - A constructor accepting an inner exception - **Serialization Concern**: The exception is not explicitly marked as `[Serializable]` and lacks the standard deserialization constructor, which may cause issues in scenarios requiring exception serialization (e.g., across AppDomain boundaries or in distributed systems).