bi01081993 / ncron

Automatically exported from code.google.com/p/ncron
Apache License 2.0
0 stars 0 forks source link

An unhandled exception has occured. C5.NoSuchItemException #21

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have downloaded the lastest version of ncron and I got the following 
exception while executing this code from a console project

class Program
    {
        static void Main(string[] args)
        {
            args = new [] { "debug" };
            Bootstrap.Init(args, ServiceSetup);

            Console.Read();
        }

        static void ServiceSetup(ISchedulingService service)
        {               
            service.At("* * * * *").Run<SampleJob>();
            service.Start();
        }
    }

An unhandled exception has occured. C5.NoSuchItemException: Exception of type 
'C5.NoSuchItemException' was thrown.
   at C5.IntervalHeap`1.DeleteMin(IPriorityQueueHandle`1& handle)
   at C5.IntervalHeap`1.DeleteMin()
   at NCron.Service.SchedulingService.Start()
   at NCron.Service.Bootstrap.RunService(Action`1 setupHandler, Boolean debug)

The interesting thing which I have noticed is that when you put a breakpoint a 
line after service.Start() and wait a while and press f5, then the job starts 
without any problems... but the next scheduled job is throwing the same 
exception as above.

Original issue reported on code.google.com by netK...@gmail.com on 25 Oct 2011 at 7:59

Attachments:

GoogleCodeExporter commented 8 years ago
ok, my bad.

I had started service twice.

Original comment by netK...@gmail.com on 25 Oct 2011 at 8:09

GoogleCodeExporter commented 8 years ago
I am not sure if your last comment is meant to dismiss this issue report 
entirely, or if it only relates to the observation about breakpoints. Do you 
still experience problems with NCron?

Original comment by j...@malamute.dk on 26 Oct 2011 at 7:47

GoogleCodeExporter commented 8 years ago
I experience the same thing but this time. What is the best way to start the 
schedulingservice?
....
protected override void OnLoad(EventArgs e)
{
            myService = new SchedulingService();
        ...
}

void doStart()
{
   if(myService != null)
   {
     myService.Start();<==== it throws an error in here
   }
}

Follow-up question, Is there a way to count the scheduled Services?

Please help, sorry for my english.

Original comment by w2ca...@gmail.com on 8 Dec 2011 at 9:14

GoogleCodeExporter commented 8 years ago
are you using scheduler from a console application ? or from other project type 
?

Original comment by netK...@gmail.com on 8 Dec 2011 at 9:25

GoogleCodeExporter commented 8 years ago
I am afraid that there is currently no way to ask the scheduling service how 
many jobs it has in its queue. The easiest workaround is probably to count the 
jobs manually as you add them to the service.

Also, OnLoad(EventArgs) seems to suggest that you are using NCron in a Windows 
or web forms project. Please be aware, that NCron was built to run as a Windows 
service, and I have no idea if it will work well in other deployments. I am not 
saying that it will not work - I simply do not know.

Original comment by j...@malamute.dk on 8 Dec 2011 at 9:30

GoogleCodeExporter commented 8 years ago
yes i'm doing this for my windows form project.

Original comment by w2ca...@gmail.com on 8 Dec 2011 at 9:45