Closed pinkfloydx33 closed 1 month ago
I set a breakpoint per @ejsmith and here's the values at that line:
kvp.Value.LastAccessTicks
= 638621018469854381
lastAccessMaximumTicks
= 638621022184909277
lastAccessTimeIsInfrequent
= true
kvp.Value.ExpiresAt
= {12/31/9999 11:59:59 PM} (DateTime
)
utcNow
= {9/16/2024 4:50:18 PM +00:00} (DateTimeOffset
)
_timeProvider
= SystemTimeProvider
So since ExpiresAt
is a DateTime
and utcNow
is a DateTimeOffset
the implicit conversion from DateTime
to DateTimeOffset
is invoked. In this case, ExpiresAt
happens to be DateTime.MaxValue
.
The problem is that ExpiresAt
's DateTime.Kind
is Unspecified
which for the purposes of the DateTimeOffset(DateTime)
constructor that the implicit conversion invokes is treated as Local
. I am currently in EST so it tries to advance the UTC time by 4 hours which is greater than the maximum allowed value and throws during validation
Thanks for reporting! Any chance you could submit a test / and or pr fix for this
New 11.0.3 release out with a fix for this.
I am running Foundatio 11.0.2. I am using a hybrid cache client (redis + in memory) as well as Queue and Distributed Cron jobs (if that matters).
I am noticing the following error in the logs.
Here's line 931: https://github.com/FoundatioFx/Foundatio/blob/ad61485bf82e67d3298375595842c0d43490603f/src/Foundatio/Caching/InMemoryCacheClient.cs#L931
Note that this doesn't crash the application or anything like that, but it is a bit annoying and probably needs to be fixed.