Self-Restarting application crashes under certain circumstances - visual-studio-2010

I use the RestartAPI to restart my application if I need to reload it. It works fine until I launch any Windows dialog (e.g. Open Dialogue), which ends with Open button being clicked! In this case, if I later choose to restart the new application (after restarting) will not be able to open ANY files. If I click Cancel button the new restarted application will work just fine.
It took me a long time to figure out that the difference between the two restarts is the Open button with some Open Dialog that is completely unrelated to the application restart. Note that I have eliminated the code that gets executed after the Open button is clicked so there's no way that it could be caused by some memory corrupting code that the Open button just initiates.
It is enough to click the Open button once (so I may 5 times click Cancel than once Open and than for example 3 times Cancel) and any attempt to restart the application however "late" will result in the new instance not being able to open any files (not even with std::ifstream).
Some details:
Visual Studio 2010
Windows 7 x64 (but with 32bit XP it is the same)
the dialog is launched in a separate thread
I use Allegro 5.0 for graphics but that should not be related
The dialog is launched by GetOpenFileName function

I don't know about RestartAPI, but you can create temporary batch file which will restart the process without any problems.

Related

Stop alert box in vscode when debugging .NET Core API

I am developing an API using c# in .NET Core in Visual Studio Code on a Mac. When I press F5 to debug, I get an alert box with the text Do you want Code to open the external website?. I usually just close this box by pressing escape. This process becomes tedious when you have to rebuild the API many times and every time you have to wait for the alert box just to close it to finish the build.
Any idea how to stop the dialog box from appearing?
Found a solution:
Open launch.json
Remove the serverReadyAction object.
Now the API starts without the alert or tab opening in browser.

windows Cmd freezes and I have to click on window to coninue

I have a ruby script that displays it's progress via the cmd and completes in about 10 minutes. In the last few weeks the cmd seems to freeze and after 10 minutes when I click on the cmd window it then completes the script.
I have searched on forums and suggestions include: disable QuickEdit Mode & Insert Mode which I have done but this has not fixed the problem.
The platform is an azure windows server 2016 VM.
Could this problem be due to a recent windows update?
Thanks
If you are using the usual Windows Command Window, Ruby has no way of knowing that you have clicked into the Window, so it is unlikely that it is related to the code. However, Windows does block a command to write to the command window on certain circumstances, and if this happens, Ruby waits on, say, STDOUT.puts, until it is allowed to continue. Of course this applies not only to Ruby, but to any application writing to the command console.
The most typical situation, in which this occurs, is, if you (maybe accidentally) select with the mouse something in the console Window. The script running in the console is blocked. By clicking with the mouse inside the window, the selection is cancelled, and the program continues to run.

Cannot Get Rid of Application Window After Application Crashes

I'm trying to debug a VS 2008 command-line application running under Windows XP. The application has been crashing (access violation), and I am catching the crsah in the debuuger. After looking at the call stack, etc., I tell the IDE to "Stop Debugging". The application window remains, but the process does not appear in Task Manager. Nothing happens when I click the "X" in the upper-right corner, though I can minimze / restore the window. The process is normally shut down by pressing Esc. It does not respond to this keypress.
I cannot even get rid of the application window by attempting to reboot XP. The machine will not reboot; it simply ignores my command to do so.
The only way I've been able to get rid of the application window is to do a hard power cycle. Ughh...
Does anybody have any suggestions on how to clean up this lingering application window after the application crashes?
Thanks,
Dave

restart emulator behavior in Windows Phone 7

I have a question about the expected behavior of Window Phone 7.5 emulator.
If I deactivate (start button), close (back button from first screen) or tombstone my data (selecting this option in VS first and then in the emulator clicking start button), and then press Stop Debugging (Shift+F5) in VS, all changed data in my app for that session is retained when I start the debug process again (F5).
However, when I just changed data in my app in the emulator and don't actively deactivate, close or tombstone my app, and then press Stop Debugging (Shift+F5) and then Start Debugging (F5) the changed data is not retained. I've noticed that upon stopping debugging, neither the Application_Deactivated or Application_Closing occur as well.
Is this expected behavior when starting/stopping the debugging processes? I'm asking because I need to know if this has any effect in the real world, like for example if I'm in my app and make a change and then someone turns off the phone completely right then and there and turns it back on, will my data be retained
This is expected. What you are doing is effectively crashing your app. If the phone/app is shut down in a normal situation then Deactivated or Closing will be invoked.

Inspect modal dialog on another window station

My app installs the visual Studio C++ runtimes on a remote machine as a prerequisite for another installation. On Windows 2003 when I upgrade to the latest patch of the VS 2005 C++ runtimes the upgrade appears to stall after the embedded MSI package has been run. The fix was to use the /Q:A rather than the /Q argument to the vcredist.exe bootstrapper.
Running the same command from a command prompt doesn't cause the modal dialog box to appear, so it's appear impossible to inspect the dialog box and reassure myself that I'm not just masking another problem.
Anyone got any tips for viewing dialog boxes in other window stations or sessions (currently the dialog is in session 0).
I think you cannot really view the dialog box. However, you can either try to attach and debug the application when it is frozen or attach and generate a dump of the application.
You must run your debugger as an administrator to attach to the process in session 0. In your case, I think you should look for msiexec.exe processes running in session 0.
You should be able to find the thread displaying the dialog box.
To inspect the contents of the dialog box, may be Spy++ will do the trick (not sure it is able to find windows in another session)

Resources