You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FileSystem/Temp GetAllKeysAsync silently omits enum, TimeSpan and DateTimeOffset keys, although they are stored and retrievable #56
PersistenceProviderUtilities.TryConvertToKey (Essentials/PersistenceProviderUtilities.cs ~L180) special-cases string, Guid and int, and otherwise uses Convert.ChangeType. That only works for IConvertible targets, so enum, TimeSpan, DateTimeOffset, Uri and similar types throw InvalidCastException. The broad catch turns that into false, and the key is silently dropped from GetAllKeysAsync.
Expected:[Red], [00:05:00] and the stored DateTimeOffset. InMemoryPersistenceProvider returns them.
Why it matters
Anything that enumerates keys to list, migrate, export or selectively clear never sees these entries, with no error. Enum keys in particular are a natural choice for a fixed set of persisted slots.
Suggested fix
For enums, use Enum.TryParse(typeof(TKey), value, ignoreCase: false, out object? result).
More generally, use TypeDescriptor.GetConverter(typeof(TKey)).ConvertFromInvariantString(value), which covers TimeSpan, DateTimeOffset, Uri, etc.
Ideally, fix this together with #46 (culture-dependent key formatting), so keys are formatted and parsed through one invariant helper.
Priority: Medium. Keys of enum, TimeSpan and DateTimeOffset type are stored but silently missing from GetAllKeysAsync, which breaks list, migrate and clear flows without any error. No data is lost.
Area / suggested owner: Essentials persistence, PersistenceProviderUtilities.TryConvertToKey
Next step: Parse keys with TypeDescriptor.GetConverter(typeof(TKey)).ConvertFromInvariantString, special-casing enums with Enum.TryParse. Add key round-trip tests to the shared provider contract tests.
Activity
matt-edmondson commentedon Sep 28, 2026
Triage
TimeSpanandDateTimeOffsettype are stored but silently missing fromGetAllKeysAsync, which breaks list, migrate and clear flows without any error. No data is lost.PersistenceProviderUtilities.TryConvertToKeyNext step: Parse keys with
TypeDescriptor.GetConverter(typeof(TKey)).ConvertFromInvariantString, special-casing enums withEnum.TryParse. Add key round-trip tests to the shared provider contract tests.Generated by Claude Code