Skip to content

Connect.Koi auto-detect throws DateTimeOffset exception when no koi.json exists in default DNN skin #17

@bsegedin

Description

@bsegedin

Environment

  • DNN: 9.13.9
  • 2sxc: 19.3.5
  • Connect.Koi: bundled with 2sxc 19.3.5
  • Theme: Custom Bootstrap 5 theme (“Base”), no koi.json
  • Connect.Koi not actively used

Problem Description

On every Default skin request (/Default.aspx), DNN EventLog records an exception:

Connect.Koi: Error while loading framework settings from koi.json

Inner exception:
The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset

StackTrace:
System.Runtime.Caching.HostFileChangeMonitor
Connect.Koi.Dnn.DetectKoiOfCurrentDnnTheme.AutoDetect()

Context values are always:

PortalId = -1
TabId = -1
UserId = -1

This indicates the error happens very early in the request pipeline, before a portal or tab context is available.

Root Cause Analysis

DetectKoiOfCurrentDnnTheme.AutoDetect() always tries to attach a HostFileChangeMonitor to the resolved koi.json path:

policy.ChangeMonitors.Add(
    new HostFileChangeMonitor(new[] { koiPath })
);

When and what happens?

  • the default skin does not contain koi.json
  • skin metadata is resolved from cached values
  • the resolved path is invalid or points to a non-existent file
    In this situation, .NET internally attempts to construct a DateTimeOffset from invalid file metadata (LastWriteTimeUtc), which throws:

The UTC time represented when the offset is applied must be between year 0 and 10,000

The exception is then logged as:

Connect.Koi: Error while loading framework settings from koi.json

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions