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


thomas
2015-07-09T10:00:19Z
Hi

I have noticed that the level of exception details you get, varies depending on the type of task. Here are 3 examples to illustrate the point

1) .NET Code execute task, with the following code:

private static int AddNumbers(int num1, int num2)
{
throw new Exception("Disaster!!!!");
return num1 + num2;
}

public static int Test()
{
return AddNumbers(1, 2);
}


When I execute Test(), I get the following info (I have extracted the relevant parts):

Exception in Task: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Disaster!!!!
at DynamicNS.ExceptionTest.AddNumbers(Int32 num1, Int32 num2) in c:\Users\njServiceNBP\AppData\Local\Temp\r5c3ouev.0.cs:line 9
--- End of inner exception stack trace ---


As you can see I get information about the Method and line number.

2) Assembly without any Try/Catch, ie the exception just propagates. With exactly the same code I get this exception:

ExecuteProcess("C:\Program Files (x86)\VisualCron\\NETExecute40.exe" 189386)->Execution error(s): Exception has been thrown by the target of an invocation. Disaster!!!!

I get only the exception message, and no info about the method where the error occured.

3) Assembly with a Try/Catch, where I simply rethrow the Exception using the ToString() representation. Code:

private static int AddNumbers(int num1, int num2)
{
throw new Exception("Disaster!!!!");
return num1 + num2;
}

public static int Test()
{
try
{
return AddNumbers(1, 2);
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
}


The exception I get then is this:

Exception in Task: ExecuteProcess("C:\Program Files (x86)\VisualCron\\NETExecute40.exe" 189420)->Execution error(s): Exception has been thrown by the target of an invocation. System.Exception: Disaster!!!!
at Test123.ExceptionTest.TestWithTryCatch()


Here I at least get information about the method.

So my simple question is this: Can you look into this and try to extract som more info from unhandled exceptions that occur in an assembly? I guess this may belong in a feature request, but it could ofcource be that I am am misunderstanding something.
Sponsor
Forum information
Scroll to Top