My C# application is returning 0xE0434352 to Windows Task Scheduler but it is not crashing

67

I have written a few C# apps that I have running via windows task scheduler. They are running successfully (as I can see from the log files that they are writing ) but windows task scheduler shows them returning a last run result of 0xE0434352. Is there something I need to do in my C# application so that it returns a success code to the windows task scheduler?

c#
.net
scheduled-tasks
task
asked on Stack Overflow Feb 5, 2013 by Kynrek • edited Jan 18, 2017 by CJBS

9 Answers

80

Another option is to simply use the Application log accessible via the Windows Event Viewer. The .Net error will be recorded to the Application log.

You can see these events here:

Event Viewer (Local) > Windows Logs > Application

answered on Stack Overflow Mar 19, 2013 by voidmain • edited Oct 30, 2019 by tisaconundrum
33

When setup a job in new windows you have two fields "program/script" and "Start in(Optional)". Put program name in first and program location in second. If you will not do that and your program start not in directory with exe, it will not find files that are located in it.

answered on Stack Overflow Jan 8, 2015 by Dmitry Bosikov
23

Hans Passant was correct, I added a handler for AppDomain.CurrentDomain.UnhandledException as described here http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception(v=vs.71).aspx I was able to find the exception that was occurring and corrected it.

answered on Stack Overflow Feb 15, 2013 by Kynrek
12

I was referencing a mapped drive and I found that the mapped drives are not always available to the user account that is running the scheduled task so I used \\IPADDRESS instead of MAPDRIVELETTER: and I am up and running.

answered on Stack Overflow Jul 10, 2013 by RandyMorris • edited Nov 3, 2016 by David Murdoch
7

In case it helps others, I got this error when the service the task was running at didn't have write permission to the executable location. It was attempting to write a log file there.

answered on Stack Overflow Apr 23, 2014 by MDave
2

I had this issue and it was due to the .Net framework version. I had upgraded the build to framework 4.0 but this seemed to affect some comms dlls the application was using. I rolled back to framework 3.5 and it worked fine.

answered on Stack Overflow Aug 13, 2014 by user3936738
1

I got the same error but I have fixed it by changing the file reading path from "ConfigFile.xml" to AppDomain.CurrentDomain.BaseDirectory.ToString() + "ConfigFile.xml"

In my case, this error due to file path error because task manager starts program from "System32" as initial path but the folder we thought.

answered on Stack Overflow Feb 16, 2016 by RUTIS
1

I was getting the same message message within dotNet Core 2.2 using MVC 5, however nothing was being logged to the Windows Event Viewer.

I found that I had changed the Project sdk from Microsoft.NET.Sdk.Web to Microsoft.NET.Sdk.Razor (seen within the projects.csproj file). I changed this back and it worked fine :)

answered on Stack Overflow Mar 20, 2019 by MrBritton • edited Mar 20, 2019 by LuckyLikey
-1

It is permission issue in my case the task scheduler has a user which doesn't have permission on the server in which the database is present.

answered on Stack Overflow Oct 3, 2018 by Akash Vishwakarma

User contributions licensed under CC BY-SA 3.0