I have an executable that runs perfectly on my machine. It happens to be the machine that created it with Visual Studio 2015 Community.
It fails to run however on other machines and creates the "Program has stopped working" and "Do you want to send more information about the problem" messages.
How can I capture all the debug information from this program into a file so I can find out where the program is breaking. It appears to be failing before the promgram.cs file is running as I have placed msgbox as the first line which it never gets to, so I can only assume it is failing during the initial framework load or similar.
I believe you need the original PDB file that should have been created with the application. There is a post that is relevant here: How do I use PDB files
There are a couple of ways to do this:
Important Note: You must have valid debug symbols to view source files, have meaningful call stack frames, and hit breakpoints. If you do not still have the pdb generated from when you built your app, you can rebuild and copy the freshly built exe over to your other machine.
Write some registry values on the machine where your app crashes and let it crash. Copy the dump file to your development machine and open it with Visual Studio to debug.
Use the command below to get started - you will have to replace "YourApp.exe" with the actual name of your exe. The default directory where the dump will be is %LOCALAPPDATA%\CrashDumps
reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\YourApp.exe" /v DumpType /t REG_DWORD /d 2
See Windows documentation for complete details.
On the machine where the app is crashing, install Visual Studio Remote Tools and start the Remote Debugger.
On your development machine, start Visual Studio, open project (Ctl + Shift + o), and choose your application's exe file. (It needs to match the exact full path as the machine where it is crashing, so you may have to create some directories and an empty text file and change the extension to .exe)
Example: If your app is at the full path of E:\Program Files (x86)\MyCoolApps\bin\MyCoolApp.exe, you must create a file (can be empty) at the exact same location on your development machine even though that same app is already located at C:\Program Files (x86)\MyCoolApps\bin\x86\MyCoolApp.exe
Open the project properties (right-click on the project node in Solution Explorer)
Fill in the appropriate fields (shown in bold) with values for your environment. You should change the debugger type to whatever your exe is (Managed for C#/VB or Native for C/C++).
Now you are ready to launch your app under the debugger. Hit F5 to debug just as your would any other project in Visual Studio.