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


Hans Stuer
2010-09-27T11:21:03Z
Hi,

I have an executable which needs to be scheduled for daily usage. So far no problem.
I create a new task, fill out the command and Working Directory. Simple enoug, did this before, but the executable returns an error.
(Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at ExportNamespace.ExportNamespace.main(String[] sArgs) in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\ExportNamespace\ExportNamespace\Module1.vb:line 98)

The Log file created by the program looks like this:

ERROR: mscorlib
ERROR: The handle is invalid.


The weird thing is that it doesn't return the error when i launch it through explorer or when i schedule it using Windows scheduler. It seems to be VC bound.

Any ideas on what might be happening here?

Hans


-Hans
Sponsor
Forum information
Support
2010-09-27T11:23:54Z
Hi Hans,

the question is what you are trying to do in your .exe. Do you have the source? What is the reason you get an error on line 98 in your code?

Most common reason is that your code require some elevated rights, other than SYSTEM which is the default user. If that is so you might require a Credential. If you are only working locally you need to add your local admin user as a Credential and select it.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Hans Stuer
2010-09-27T11:34:35Z
Henrik,

Thanks for the quick response.

It's a third party .exe, so i do not have the source code. I'm in contact with them though to find out what happens on line 98. ;)

The exe is executed on a server and Credentials are always used. If i log on to the server and execute it manually the app runs correctly, running it from VC using the same credentials should have the same outcome, right?
-Hans
Support
2010-09-27T11:37:41Z
Yes, depending on what you try to do (in the code). For example, if you need to reach server X you need to use UNC paths in the code (because mapped drives are not shared among users). Also, you need to use a user on server X, not a local one (together with option "Network Credentials".
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Hans Stuer
2010-09-27T11:49:37Z
Actually there is a call from server A to Server B in the code.
However, i don't understand why this should matter. Even using a user that has full access/privileges on both servers, the app keeps throwing the error when run in VC.
-Hans
Support
2010-09-27T11:53:38Z
It does matter because it is Executed by the SYSTEM account by default (VisualCron is running as a service). So, by default, it has not network access unless you give the right privileges. If you are using a local user right now on server A you don't have access to Server B.

But, it could be more things that is in the code that changes this.

There are 3 ways to solve this:

1. use the right Credential (best option)
2. Run the Execute Task in foreground mode (limited - not recommended)
3. change the user that runs the VisualCron service (not recommended)
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Hans Stuer
2010-09-27T12:14:24Z
I might not have been very clear in my previous post.
I understand the importance an use of the right credentials to run a task.

We _ALWAYS_ use credentials for our tasks and in this particular case the credentials have access to both servers. I just don't see that this could be the reasoon for failure.

Running the task in Foreground mode hassen't helped either.

I'll try the third option as soon as i have the change...

Thanks for the input.
-Hans
Support
2010-09-27T12:18:36Z
Ok, it was just my guess that this was the issue. But, according to the very little debug information we have it seems to be about namespaces (and could be some kind of problem where your exe refers to a dll somewhere else - if workdir is changed or something like that). But please try to get this information from the developers.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Hans Stuer
2010-09-27T13:15:37Z
I've tried changing the user running the Vc service but that wasn't the solution either.

Windows scheduler performes the task without any problem.
I'm thinking there might be a fundamental difference in the way tasks are executed between VC and windows scheduler, that is causing this problem.

Maybe once i know what happens on line 98 of the code, i'll be closer to a solution...
-Hans
Support
2010-09-28T22:33:31Z
Hans Stuer wrote:

I've tried changing the user running the Vc service but that wasn't the solution either.

Windows scheduler performes the task without any problem.
I'm thinking there might be a fundamental difference in the way tasks are executed between VC and windows scheduler, that is causing this problem.

Maybe once i know what happens on line 98 of the code, i'll be closer to a solution...



Yes, please get back to us. If we could have the source we could examine ourselves.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Hans Stuer
2010-09-29T09:00:38Z
The issue has been resolved.
I don't know what the failing code was suppossed to do but by enabling the "Use shell Execute" option and subsequently providing no credential, the app runs without a problem.

Thanks for the helpfull suggestions.
-Hans
Support
2010-09-29T09:02:13Z
Ok, thanks for the update. One of the differences is that output is not captured the same way which could affect the behavior.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top