Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


msOne
  •  msOne
  • No customer Topic Starter
2014-09-05T05:53:53Z
Hi;

I seem to crash (or break) VC when I execute the below code..

        
Dim c As New VisualCronAPI.Connection
Dim connection As New VisualCronAPI.Connection With {.ConnectionType = VisualCronAPI.Connection.ConnectionT.Remote, .Address = "smallappstest", .Port = 16444, .UseADLogon = True}
Dim Client As New VisualCronAPI.Client
Dim MyServer As VisualCronAPI.Server = Client.Connect(connection, True)
Dim Job As New JobClass With {.Name = "Test3", .TimeOut = New TimeOutClass With {.Minutes = 5, .Use = True, .ConsiderError = True}}
Dim Tasks2 As New TaskClass
Tasks2.Name = "Taskname"
Job.Tasks.Add(Tasks2)
MyServer.Jobs.Add(Job)


VC is returning the below after about 10 sec

System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
at VisualCronAPI.Jobs.Contains(String strJobId)
at frmMain2.LGOFIHDBKKNMKLGKEDAMKMHJDNAHAMGLGILI(Server& , JobClass , TaskClass ) in C:\sourcefiles\code\VisualCron\Main\frmMain2.vb:line 1935


I have added / removed / imported / generally playing around / so I am wondering if there could be a relation?

Upon VC restart, the application will display the same error again.


And also... does my code seem to be correct??



Thanks, Martin
Sponsor
Forum information
ErikC
2014-09-05T06:29:38Z
Hi Martin,

and from which line is this error comming?
Looks to me that you did not fill in all the required parameters to create a job.

Regards,
Erik
Uses Visualcron since 2006.
Support
2014-09-05T06:52:09Z
Sounds like the problem is about the Task. Try replacing:

Dim Tasks2 As TaskClass = Job.NewTask
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
msOne
  •  msOne
  • No customer Topic Starter
2014-09-05T06:57:20Z
Hi;

The error is not coming from any line at all. The code executes fine and completes with no warning.

After about 15 sec VisualCron returns the error message.

I am reinstalling VisualCron again as I could not connect to the service from client or remote server.

I'll try with the suggested code as well..


Dim Tasks2 As TaskClass = Job.NewTask 



Support
2014-09-05T07:13:13Z
This is definitely related to the Task not having the correct JobId. Your original code failed but after making my suggestions it succeeds. Here is the full code:


        Dim c As New VisualCronAPI.Connection
        Dim connection As New VisualCronAPI.Connection With {.ConnectionType = VisualCronAPI.Connection.ConnectionT.Remote, .Address = "localhost", .Port = 16444, .UseADLogon = False}
        Dim Client As New VisualCronAPI.Client
        Dim MyServer As VisualCronAPI.Server = Client.Connect(connection, True)
        Dim Job As New JobClass With {.Name = "Test3", .TimeOut = New TimeOutClass With {.Minutes = 5, .Use = True, .ConsiderError = True}}
        Dim Tasks2 As TaskClass = Job.NewTask(TaskClass.TaskT.Execute)
        Tasks2.Name = "Taskname"
        Job.Tasks.Add(Tasks2)
        MyServer.Jobs.Add(Job)

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
msOne
  •  msOne
  • No customer Topic Starter
2014-09-08T02:18:35Z
Hi.

Thanks for your help. I am pretty sure this was related to the wrong job-id.

I have removed and reinstalled. All is working now.

Thanks,
Martin
Scroll to Top