EllanJiang/GameFramework · error · GameFrameworkException
Delta length is invalid.
Error message
Delta length is invalid.
What it means
DownloadAgentHelperUpdateLengthEventArgs.Create requires a strictly positive delta length because it represents newly downloaded byte count used for progress and speed calculation. A zero or negative delta would corrupt the download statistics, so the library rejects it at creation time.
Solutions
- Only fire the update-length event when the delta is > 0
- Compute delta as currentLength - lastReportedLength and skip the call when it is 0
- Check for integer underflow when subtracting length counters
Example fix
// before helperCallback.UpdateLength(deltaLength); // deltaLength may be 0 // after if (deltaLength > 0) helperCallback.UpdateLength(deltaLength);
Defensive patterns
Strategy: validation
Validate before calling
if (deltaLength <= 0) return; // skip event when no new bytes arrived
Type guard
bool IsPositiveDelta(int deltaLength) => deltaLength > 0;
Try / catch
try { var args = DownloadAgentHelperUpdateLengthEventArgs.Create(deltaLength); } catch (GameFrameworkException ex) { Log.Warning("Invalid download delta length: {0}", ex.Message); } Prevention
- Only fire progress events on actual byte movement
- Watch for signed integer underflow in length math
- Log deltas periodically to catch zero-increment spam early
When it happens
Trigger: Calling DownloadAgentHelperUpdateLengthEventArgs.Create with deltaLength <= 0, typically from a custom IDownloadAgentHelper reporting a download-progress event with a non-positive increment.
Common situations: Custom helper implementations calling the update-length callback on every poll tick even when no bytes arrived, or a signed underflow when computing the increment.
Related errors
- Offset is invalid.
- Length is invalid.
- Update interval is invalid.
- Record interval is invalid.
- Download agent helper is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/7501918eb697ca58.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Download/DownloadAgentHelperUpdateLengthEventArgs.cs:41
/// <summary>
/// 获取下载的增量数据大小。
/// </summary>
public int DeltaLength
{
get;
private set;
}
/// <summary>
/// 创建下载代理辅助器更新数据大小事件。
/// </summary>
/// <param name="deltaLength">下载的增量数据大小。</param>
/// <returns>创建的下载代理辅助器更新数据大小事件。</returns>
public static DownloadAgentHelperUpdateLengthEventArgs Create(int deltaLength)
{
if (deltaLength <= 0)
{
throw new GameFrameworkException("Delta length is invalid.");
}
DownloadAgentHelperUpdateLengthEventArgs downloadAgentHelperUpdateLengthEventArgs = ReferencePool.Acquire<DownloadAgentHelperUpdateLengthEventArgs>();
downloadAgentHelperUpdateLengthEventArgs.DeltaLength = deltaLength;
return downloadAgentHelperUpdateLengthEventArgs;
}
/// <summary>
/// 清理下载代理辅助器更新数据大小事件。
/// </summary>
public override void Clear()
{
DeltaLength = 0;
}
}
}
View on GitHub (pinned to d0c010b051)