Note that there are some explanatory texts on larger screens.

plurals
  1. POCache key causes error "Negating the minimum value of a twos complement number is invalid."
    primarykey
    data
    text
    <p>This is one of the strangest errors I've ever seen.</p> <p>I'm doing a very simple call to return values from the HttpRuntime cache. The call is:</p> <pre><code>return HttpContext.Current.Cache[cacheKey]; </code></pre> <p>If it returns null, that's fine. I check if the returned value is null and act accordingly. I've been using this call for a long time.</p> <p>Recently, for some reason, when cacheKey is set to this exact value:</p> <pre><code>"Topic_GridSelectAll:5,null,2010-08-31-20-00-00,Published,desc,5,1" </code></pre> <p>a System.OverflowException is thrown: <strong>Negating the minimum value of a twos complement number is invalid.</strong></p> <p>Nothing about the call, associated code or server has changed. If the cacheKey has slightly different characters, it works perfectly fine. For instance, this cacheKey returns null without throwing any exception:</p> <pre><code>"Topic_GridSelectAll:5,null,2010-08-31-21-00-00,Published,desc,5,1" </code></pre> <p>Notice, the only difference between those two strings is the time characters: 2010-08-31-20-00-00 versus 2010-08-31-21-00-00.</p> <p>Why the hell would that make any difference? And why now after all this time?</p> <p>The stack trace is:</p> <pre><code>[OverflowException: Negating the minimum value of a twos complement number is invalid.] System.Math.AbsHelper(Int32 value) +12753486 System.Web.Caching.CacheMultiple.UpdateCache(CacheKey cacheKey, CacheEntry newEntry, Boolean replace, CacheItemRemovedReason removedReason, Object&amp; valueOld) +142 System.Web.Caching.CacheInternal.DoGet(Boolean isPublic, String key, CacheGetOptions getOptions) +122 MyProject.Helpers.CacheHelper.GetData(String cacheDomain, String cacheKey) in ... </code></pre> <p>I've tried changing the cache call to use HttpRuntime.Cache instead (ie. <code>HttpRuntime.Cache[cacheKey]</code>), but that made no difference. I know it's the same underlying cache provider, but I thought maybe the different call would make a difference. No dice.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload