Error: '0' is not a valid value for 'Interval'

Jun 22, 2009 at 7:12 PM

Hi Andrea,

We have our WCF Cache Service set for automatic refreshes every 5 minutes. This runs fine all the time, but every once in a while (several times a day) , we get the following error:

'0' is not a valid value for 'Interval'. 'Interval' must be greater than 0.

Our appSettings are:

    <add key="expirationValue" value="0 0 5 0" />
    <!-- days hours minutes seconds -->
    <add key="StoreFilterName" value="" />
    <!-- leave empty for all Stores -->
    <add key="ApplicationFilterName" value="" />
    <!-- leave empty for all Applications -->
 <add key="WCFCacheServicePartners" value=""/>

Any idea what this error is?


Jun 22, 2009 at 9:05 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 22, 2009 at 9:11 PM


Every so often happened to me to see this error.

I think it is a problem with the calculation of the timer interval that sometimes produces a value of zero.

But looking at the code it seems impossible.

Now I will investigate better.



Andrea Ferendeles
NetSqlAzMan - Project Coordinator

Jun 23, 2009 at 8:20 AM

I have found the bug.

Look here:
if (delta.TotalMilliseconds >= 500)
      this.timer1.Interval = delta.TotalMilliseconds;

The issue is that sometimes delta.TotalMilliseconds is upper then 500 (at the if statement) ... but it is 0 or lesser at the assign statement (because the server is busy)

I will fix it as following:
double d = delta.TotalMilliseconds;
if (d >= 500)
      this.timer1.Interval = d;


Jun 23, 2009 at 3:21 PM

Thanks for the fix! I will make the change in our source code.