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

Jun 22, 2009 at 6: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?

Thanks.

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

Hi,

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.

Regards,

Andrea.

__________________________________
Andrea Ferendeles
NetSqlAzMan - Project Coordinator

http://netsqlazman.codeplex.com

Coordinator
Jun 23, 2009 at 7: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;


Regards,
Andrea.

Jun 23, 2009 at 2:21 PM

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