Note that there are some explanatory texts on larger screens.

plurals
  1. POSql Server Agent Fails to run .net console application
    text
    copied!<p>I have a console app that runs absolutely fine manually, but when it is executed by SQL Server Agent it fails to run at all and also spits out a strange error message as follows:-</p> <pre><code>Executed as user: I01SVTD21\SYSTEM. Unhandled Exception: System.IO.IOException: The handle is invalid. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean&amp; succeeded) at System.Console.Clear() at ActiveDirectoryImport.Program.SendReports() at ActiveDirectoryImport.Program.GetUserInfo() at ActiveDirectoryImport.Program.Main(String[] args). Process Exit Code 255. The step failed. </code></pre> <p>Now this may not appear like a strange error message at first, until you realise that ActiveDirectoryImport.Program.SendReports() is the last method called by ActiveDirectoryImport.Program.GetUserInfo() so it seems like most of the code has run. However this is not the case as one of the first things the code does is update records in a database table, which has not happened.....</p> <p>So I am left with two questions. Why is the job failing at all when it runs fine from the same location manually? and, Why is it telling me that it is failing late on in the code when it clearly has not got that far?</p> <p>The console app does write to the console screen but takes no user input. It basically writes the status of the application to the screen and this is seemingly erroring....</p> <p>Any help is appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload