44 lines
2.5 KiB
Markdown
44 lines
2.5 KiB
Markdown
---
|
|
source_files:
|
|
- Common/DTS.CommonCore/Exceptions/OutOfDataException.cs
|
|
generated_at: "2026-04-16T12:01:09.381744+00:00"
|
|
model: "zai-org/GLM-5-FP8"
|
|
schema_version: 1
|
|
sha256: "fdc72f1eddeb3763"
|
|
---
|
|
|
|
# Documentation: OutOfDataException
|
|
|
|
## 1. Purpose
|
|
This module defines a custom exception class, `OutOfDataException`, within the `DTS.Common.Exceptions` namespace. It is designed to signal that a read operation has attempted to access data beyond the available bounds of a stream or buffer. It extends the standard `System.Exception` class by capturing the specific location (`Index`) where the failure occurred, facilitating easier debugging of data parsing or deserialization errors.
|
|
|
|
## 2. Public Interface
|
|
|
|
### Class: `OutOfDataException`
|
|
Inherits from: `System.Exception`
|
|
|
|
**Constructor**
|
|
```csharp
|
|
public OutOfDataException(string ex, long index)
|
|
```
|
|
Initializes a new instance of the `OutOfDataException` class.
|
|
* `string ex`: The message that describes the error (passed to the base `Exception` class).
|
|
* `long index`: The position in the data stream or buffer where the out-of-bounds access occurred.
|
|
|
|
**Properties**
|
|
```csharp
|
|
public long Index { get; private set; }
|
|
```
|
|
Gets the numerical index where the data exhaustion was detected. This property is read-only from outside the class.
|
|
|
|
## 3. Invariants
|
|
* **Immutability of Index:** Once an instance of `OutOfDataException` is created, the `Index` property cannot be modified externally (the setter is `private`).
|
|
* **Base Type Guarantee:** The type always behaves as a standard CLR exception regarding stack traces and HResult, as it inherits directly from `System.Exception`.
|
|
|
|
## 4. Dependencies
|
|
* **Dependencies:** This module depends on `System` (specifically `System.Exception`).
|
|
* **Dependents:** Unknown from the source file alone, but intended for use by data readers, parsers, or stream processors within the `DTS` codebase.
|
|
|
|
## 5. Gotchas
|
|
* **Misleading Parameter Name:** The constructor argument `string ex` uses a naming convention typically reserved for an inner exception object (e.g., `Exception ex`). However, in this signature, it represents the exception message string. Developers might mistakenly expect a constructor signature of `(string message, Exception innerException)`.
|
|
* **Serialization Support:** The class does not explicitly implement the `ISerializable` pattern (a serialization constructor is missing). If this exception needs to be serialized (e.g., crossing AppDomain boundaries), the `Index` property may be lost depending on the serialization mechanism used. |