I've written a basic program using Xamarin.Forms. I can run the UWP version of the program completely fine in both debug and release mode from Visual Studio 2017 with no crashes. However, if I try to run either the release or debug .exe directly from the file explorer, the program loads, but crashes almost immediately afterwards. There's no window that pops up for a split second; the program crashes without a trace. The same situation occurs on different computers. What's strange is that I could run either .exe directly about a week ago, and that everything stopped working only recently.
If I check the event viewer, I get a .NET Runtime error that states this:
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
I'm assuming this has to do with a blocked DLL or something auto injected by Visual Studio that isn't included in the build directories. However, I am unsure where I'm supposed to go from here and I've pretty much hit a brick wall in terms of research. How can I get the .EXE's running from the file explorer again?
Related
Currently I am developing a global exception handling in a .NET C# application. I get some strange behavior:
If I debug the application from Visual Studio (F5), an unhandled exception causes the main thread to be terminated.
If I start the application without Visual Studio (click on the .EXE) with the exact same compile output (DEBUG-Build), the App doesnt crash after an unhandled exception occured.
This is kind of weird behavior...Does anyone know what's going on here?
EDIT:
It seems as if something changes within the running code as soon as a debugger attaches to the process... If I start the App without Debugging from within VS, the App doesnt crash.
I’ve been doing some work with ASP.NET MVC but was having periodic issues with Visual Studio 2008 hanging (freezing / becoming unresponsive) when I tried to run my web application with debugging. The problem only occurred with a specific web project.
I tried deleting the Temporary ASP.NET Files (%userprofile%\AppData\Local\Temp\Temporary ASP.NET Files) but that did not solve the problem.
I tried deleting the obj folder. No luck.
I tried waiting it out one evening. I eventually feel asleep and when I awoke sometime in the middle of the night, my web app was happily waiting for input and Visual Studio debugging was completely responsive. That proved to be a temporary salve.
showallfiles The problem resurfaced again a few days later and I finally figured out the problem with my uncooperative debugger. I have a folder containing approximately 20,000 images that are not included in the Visual Studio web project but are sitting in a directory in the web site. I had turned on "Show All Files" in Solution Explorer to add some script files into the project. When "Show All Files" is off, F5 (Start Debugging) works like champ. When "Show All Files" is on, Visual Studio becomes unresponsive. In reality it is not "frozen" but simply taking a very long time to process those 20,000 image files.
Mystery solved.
I use unmanaged dll with P/Invoke in this app, and I always tested it inside Visual Studio (with debug mode on x86 CPU because the dlls are only x86), and it works just fine. But when I just start the exe manually after some time (probably at the first operation with those dlls, but I don't know exactly) it says the exe has stopped working, and it starts checking for solution (I use Visual Studio 2013 on Windows 8.1, if that matters). I tried to add the dlls to the project as existing item, but that doesn't help. Also I know, that it's not because it can't find those dlls, cause if I delete them, it doesn't crash, just freeze without any error message. Shouldn't it work the same from Visual Studio as manually started?
There is also a weird bug when I run from Visual Studio: everything's work fine, but sometimes Visual Studio just suddenly stops debugging, as if the program were closed and the GUI of my app freezes, and I can only close it by closing Visual Studio (as I close it, the GUI disappears). Maybe it's a totally different problem, but it can be connected.
Edit:
Here's the project on github, if somebody could check it:
https://github.com/geiszla/CycriptGUI
Some news: If I run it with Ctrl+F5 it also crashes. What's the difference between F5 and Ctrl+F5, that can cause this problem?
Searched all over Google with no real simple answers. Here it is folks(at least it worked for me and is simple):
When you run the console app in Visual Studio, look at the output window at the bottom, get the location of the ..\bin\Debug\*.exe
Copy the *.exe and the *.config to your desired folder, run it, it should work the same way in Visual Studio.
Thanks for every help, my problem was solved: I called an unmanaged function with only 2 parameters, while it had 3. However I still don't understand why it worked with debugging mode, and not without debugging.
I am developing an application using Visual Studio, and when I install it (via Setup Project, .msi file) in a client machine and run it, I get some "Heisenbug" exception.
I am almost sure the error comes from earlier in the codepath, so I would like to debug it.
Fact is: when the application crashes, the following dialog is displayed (referring to my application instead of Windows Explorer, of course):
and if I choose "Debug the program", the Visual Studio Debugger (which is somehow available in the deployed machine) starts and shows details from the exception.
What I would like to do is to start the debugging session from the very start, so I can go on hitting F10 and F11 and check some intermediate values.
Anyone know how can I start the Visual Studio debugging session at any time while the application is running? Not that I am running the deployed application, not starting it from Visual Studio.
Since you have Visual Studio up and running on the machine running the deployed application, it should be straightforward:
Run the application
Load the project in Visual Studio
Go to DEBUG -> Attach to process...
A list will pop up with all the running processes
From the list, pick the process corresponding to the application, it should be named after your exe (if you sort by the numeric IDs, it's very likely it will be near the highest end)
Click "Attach", Visual Studio will should start debugging similarly as when you normally start with F5.
I also have another suggestion: implement heavy logging until you have everything figured out. Write down everything you have doubts about for further analysis in case something goes wrong: values, queries, etc.
You can start the application directly under the Visual Studio Debugger using the debugexe parameter:
devenv /debugexe “C:\MyApplication\Debug\MyApplication.exe”
This will launch the application with the debugger immediately attached. Otherwise it's very hard to debug issues that happen at the time the application is starting. You won't be able to manually attach in time to catch any events that happen during this time.
You can also place the following piece of code at the first line of you application (usually the Main(string[] args)) to force a debugger to attach and cause the application to break immediately:
System.Diagnostics.Debugger.Break();
If your application starts and runs fine for some time, you can use the "Attach to Program" feature as described by #Alex.
If you don't have the sources available on the target machine, you can either copy them over, or if you're using Source and Symbol Indexing features of TFS Team Build, you can tell the debugger where to look for your Debug Symbols (which will then resolve to TFS source control automatically).
I have a relatively large C#/WPF Visual Studio 2008 solution that I am trying to test and synchronize across 2 developer's computers. On my computer, I am able to build and debug (run) the project successfully without errors.
On the second computer, I am able to build the solution without any errors. When I attempt to run the solution, Visual Studio starts the process but about 3 seconds later the entire development platform exits. Before it exits I briefly see one of our .xaml files opened by visual studio with a yellow 'unhandled exception' box pop-up on a certain line number. I'm currently contacting the part of my company who is responsible for implementing the functionality of that xaml file.
This raised a bigger issue in my mind: How can you troubleshoot an issue when Visual Studio is immediately exiting after attempting to run a program?
The Visual Studio 2008 crashes when starting to debug post may also be helpful. I'm trying those solutions now.
We found that executing the three following commands helped to fix our problem:
devenv.exe /ResetSettings
devenv.exe /ResetSkipPkgs
devenv.exe /Setup
This was suggested in another stackoverflow post here helped us to determine that it was a plugin, AccuRev's Visual Studio plugin, that was causing the issue.
The issue also appears to be a "known issue" with a hotfix from Microsoft, documented here.
VS2008 SP1: In Visual Studio 2008 SP1, having windows in non-default locations, for example after docking and undocking windows, when switching between debugging and designing or switching to/from full screen, can result in a crash of the Visual Studio IDE.
Thanks for your help!
Run devenv/debugexe to debug your exe. When an unhandled exception occurs, in the debug menu, select "save as dump", then visit http://connect.microsoft.com/visualstudio to open a bug report and attach the dump file after creating the report.
I just migrated to Windows Ultimate 64 SP1, because my system's hard drive crashed. I installed Visual Studio 2005 SP1 and all the patches that Microsoft has recommended. I finally got my source code from my SCM, but now debugging does not stop on any of my breakpoints I have set. This is just a plain Winforms app, nothing fancy.
The first thing I did was to change the build target to x86. No dice. Then I went and downloaded Debugging Tools for x64, still no dice. I set the debugger to break on all exceptions both handled and unhandled. No dice either.
I've been looking at Google search results, but no luck there either. I've been at this for 3 days now with no luck. Has anybody dealt with this issue before?
Update:
The projects are all set to Debug (x86).
Breakpoints stay normal when the debugging session starts.
I already did a re-install, and that didn't work either.
I am running as Administrator and turned off UAC.
I attached to the project using "Attach to Process", and I was able to step into the code that way. I'm hoping to find out why it is not auto attaching, in order to avoid having to do this manually every time.
This is listed as a known issue for VS2005 on Vista (Via MSDN):
Title: Just-In-Time (JIT) Debugging of
an elevated process will fail
Description: Elevated processes cannot
be JIT Debugged by VS 2005. This
includes system processes, such as
IIS, and applications started by
selecting ‘Run as administrator’.
Workaround: The debugger must be
attached manually before the debugger
will catch unhandled exceptions or
user break points
(System.Diagnostics.Debugger.Break,
__debugbreak, etc).
Couple of questions.
When your code fires up, does the breakpoint become an empty circle with a tooltip that indicates that the breakpoint won't be hit? Or does it become a full circle with a tooltip that indicates the process it's attached to?
You can try manually attaching the debugger to see if you get any traction that way. Just fire up the app and once it's running, go to the debug menu and choose "Attach to Process" - select the process that your app is running in and click "Attach".
I run Vista64 w/o issues - VS2008, though.
I am using Visual Studio 2005 with the same patch level on both Windows Server 2008 x64 and Vista x64 SP1 without any issues.
Are you running it as admin? When all else fails, try uninstalling and reinstalling.
Insure that the project is set for a debug compile and not a release compile, as the release compile doesn't contain your debug information.