Program execution through scheduler throws System.NullReferenceException error while it runs otherwise

0

Background: In server environment, I need to run few excel documents through scheduler with different parameters passed to it during runtime. It's Windows Server 2016 with MS Excel 2013 and I have a program (ToRunXL.exe) written in C# which selects the .XLSB file and passes all parameters to its macro. This runs successfully most of times (80% of times) and end users get their output net morning.

The command string scheduler runs with an example XLSB is as below:

\...\ToRunXL.exe CT1WSQL0079 PRVBA.MainVBA input FY2019_VBA_v3.xlsb output \...\run20200318\

But sometimes (around 20% of time) it breaks when we see no output at the specified output folder. The event logs at those failed execution report the following 2 errors:

1>> Level: Error Source: .Net Runtime Level: Error Source: .Net Runtime Event ID: 1026 Application: ToRunXL.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NullReferenceException at ToRunXL.Program.Main(System.String[])

2>> Level: Error Source: Application Error Event ID: 1000 Faulting application name: ToRunXL.exe, version: 1.0.0.0, time stamp: 0x5e6ff3e1 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc0000005 Fault offset: 0x01aa05f2 Faulting process id: 0x14c0 Faulting application start time: 0x01d5fd1f8ff29da0 Faulting application path: …\ToRunXL.exe Faulting module path: unknown Report Id: 408f0a95-0be6-4b9a-9798-e2486b79d14a Faulting package full name: Faulting package-relative application ID:

Surprisingly a forced run (either through scheduler again or through CMD window) executes the same (\...\ToRunXL.exe CT1WSQL0079 PRVBA.MainVBA input FY2019_VBA_v3.xlsb output \...\run20200318) without any complaint. It produces the expected results at the appropriate output folder.

Few more info: None of the paths have any space/blank in them, the .EXE sits on application server (i.e. not on the same server), group policy allows white-listed executable and other trusted programs to run, the scheduler runs the program with admin credentials.

We have peer reviewed the program code of ToRunXL and found nothing wrong in it. Is it possible to get this kind of error due to some network issue around the execution time to access the files (like ToRunXL or .XLSB or output file)? For information, checking Event Viewer under Windows Logs > System does not report any network issue around that time.

In general, I will appreciate any help on this.

c#
exception
unhandled
asked on Stack Overflow Mar 18, 2020 by PB4133944

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0