How do I debug an application which is launched via scheduled tasks?
I have a simple application which works fine when double clicked to launch, but it doesn't work when launched through scheduled tasks.
I know how to debug projects on a local computer, but this application has no issues running on a local computer or on a different computer if launched manually by the user by double clicking the executable file.
I need a way to debug the application when it's being launched by scheduled tasks. Is this possible?
I would primarily suggest putting in some decent logging so that you can diagnose problems without resorting to the debugger. However, to launch the debugger, you can either attach it to an existing process in Visual Studio (using Debug/Attach to process... menu), or change the code to include the Debugger.Launch() method which will launch the debugger and attach it to the process. Of course all of this is dependent on your program actually being executed by the scheduler. If the scheduler doesn't execute the program, then the debugger obviously can't attach to it
Related
The bundled XPC Service in my macOS application need to do some post processing work with files dumped by the parent app, which most probably can't be completed within the usage time of the application. So, Is there a way to make the XPC service keep running even after the user quits the main app?
You could install it as launch daemon (running in root context as long as computer is switched on) or as launch agent (running in user context as long as user is logged in).
It sounds like you should be using the WatchPaths or QueueDirectories feature of launchd.
WatchPaths starts the job whenever any of the paths being watched have changed
or
QueueDirectories starts your job whenever the given directories are non-empty, and it keeps your job running as long as those directories are not empty
Both of these are covered by Apple's launchd documentation.
I have an offline WPF application deployed through Clickonce. I want this application to start when the windows computer starts up. Currently i'm trying to do this through Task Scheduler and have made some progress.
My program is accepting a parameter through launching the app through Task Scheduler and I can see that it is launching on StartUp and it is doing work because Task scheduler reports the task running, it processes incoming files; and the application is also logging correctly with no unexpected errors.
My problem is that although the program is executing; the view I am creating is not appearing to the user. The view contains information that can alert the user if there is an error and the application needs manually restarted, which they can do through the desktop application shortcut.
If the application is launched via the command line in the exact same way as the Task Scheduler the view shows correctly.
where can I look to find out why the view is not showing although the program is executing, or how can I get my view to show when the application has been launched At Startup
Just to clarify, if the deployed application is run by being clicked on, the command line, or even through manually starting the task in task scheduler the view will show correctly. only when the application starts At Startup does the view not show on the desktop.
I have a VBScript which basically calls some Informatica CLI commands. These commands will take a long time to execute and the script runs in a Windows 2003 server.
cscript //B //Nologo <script> params...
Actually, I am calling this script from a .NET Winforms application. The idea is, even when form is closed, the script continues to run. It works fine, as long as user is logged on, i.e. even when winform is closed, the script runs as a (user) process and execute the command.
The problem is however when the user logs off (or) remote system (MSTSC) times out, the (cscript) process is killed.
Is there anyway this can be run as a system process so that even when user logs off, the script continues to run?
(Please note that running the .NET EXE as a Windows service is a last option, which is currently not viable..)
Only way I know to do this is a pretty dirty hack so you should at least consider the .NET service approach... Visual Studio offers great tools which allow you to make a Windows service very easily.
What you can do if that is really not an option is using the task scheduler. As long as you do not need user interactivity you can say a task should be "Run whether a user is logged on or not". If you do this you are allowed to use "SYSTEM" as the account to run the task with. So you can create your task executing your script without any trigger, and then manually trigger the task from the program.
There is no nice way to do this from C# but you can just execute schtasks /run /tn <taskname> or do a quick google search for some of the wrappers people wrote for this. The script will run (invisibly) in the background and survive user logoff if started that way.
I am testing my application (Windows 7, WinForms, Infragistics controls, C#, .Net 3.5).
I have two monitors and my application saves and restores forms' position on the first or second monitors. So I physically switched off second monitor and disabled it at Screen Resolution on the windows display settings form. I need to know it is possible for my application to restore windows positions (for those windows that were saved on the second monitor) to the first one.
I switched off second monitor and press Detect to apply hardware changes.
Then Windows switched OFF the first monitor for a few seconds to apply new settings. When the first monitor screen came back, my application became unresponsive. My application was launched in debug mode, so I tried to navigate via stack and threads (Visual Studio 2008), paused application, started and did not find any thing that help me to understand why my application is not responsive. Could somebody help my how to detect the source of issue.
Download the Debugging Tools For Windows then run adplus in hang mode. The with the resulting .dmp file open in windbg and invoke:
!analyze -v -hang
You should provide more information about what you saw in the call stack and threads windows. Which threads were running? Did you see anything that was waiting in a sleep or join? Have you tried naming your threads so that it's clearer as to what's going on when you pause (though not necessary since you can get this info from the call stack anyway... it's a convenience thing).
I'm not sure if this is technically a Kiosk, but it's basically the same idea. I have a program that runs full screen all the time from boot to shutdown to control a machine that the computer is hooked to.
Right now I just have a shortcut to the exe in the Startup folder so it starts when the system boots up and logs in. Is there any better way to do this? I'd really like the user to never see the Windows environment (just the windows loading progress bar on boot) if at all possible, but I'm guessing that's not possible.
Just thought I'd ask and see if there is a better way to do this than putting it in the startup folder?
The best option is to use Windows Embedded. This gives you much more control over the shell, and what is run and installed with the system.
If you have to do this with a consumer OS, you can try to bypass the login prompts to auto-login your user, and have your program setup in the registry to startup. Disable any other services you don't need. That will minimize the time the shell is displayed (but it's very difficult to remove it).