Are there any stand-alone C#/.NET Debuggers? - c#

I'm wondering if there are any Visual Studio quality debuggers that can run outside of Visual Studio, instead of inside of the IDE? It would be great if it were Open Source so I could check out how it was done, but that's not a requirement, neither is that be product free.

WinDBG with SOS extension
Following has series of 6 videos, to get started on WinDBG
http://channel9.msdn.com/Series/-NET-Debugging-Stater-Kit-for-the-Production-Environment
WinDBG is also useful for following scenarios, where VS debugger is not effective/available
Hangs
Crashes
Deadlocks
Production environment

You should try mdbg.exe.
Also available in the Windows SDK directory on your machine, like C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools for VS2010.

It's not quite "standalone", but SharpDevelop might have what you're looking for:

You're not just looking for DbgCLR?

You can also use GDB or the Mono hard-debugger with C#/.Net code.

windbg
Its a bit of a pain for debugging managed code, but it can be done.

Related

Why does Microsoft Visual Studio 2013 restart unpredictably when it loads very large C++ and C# solutions?

Yesterday, I encountered the problem multiple times that Microsoft Visual Studio 2013 restart unpredictably when it loads very large C++ and C# solutions.
I researched Stack Overflow and found this particular article: Visual Studio 2013 hangs when opening a solution
which suggests deleting the suo files. However, when I tried that the problem persisted.
I also tried uninstalling and reinstalling Microsoft Visual Studio 2013 and still the problem persisted.
I then tried loading a smaller solution consisting of a C# solution and a C++ project and that succeeded in loading, compiling and linking.
I was wondering why I suddenly encountered this problem. Could the cause of the problem be related to the amount of 64 bit physical memory I have installed on my 64-bit desktop system? Alternatively, could it be due to a computer virus even though my desktop system has an antivirus package installed. We are tring to avoid reimaging the disk of my 64-bit desktop system and reinstalling all the software which could take 2 days to complete. Any help is greatly appreciated.
It's probably some plug-in misbehaving. You can try disabling them (Tools => Extensions and Updates) and experimentally determine which one is causing the issue.
If you want to go all-in, you can debug it:
Download and install WinDbg 32-bit
Run Visual Studio under windbg: windbg -g "%VS120COMNTOOLS%..\ide\devenv.exe" c:\my\solution.sln
Watch the incredible amount of debug info VS spews into
WinDbg
If Windbg breaks, inspect the stack - maybe some DLLs on it will clue you into which plug-in is the culprit.
Open file explore and past this command
'%AppData%..\Local\Microsoft\VisualStudio\12.0\ComponentModelCache'
Then remove 'ComponentModelCache' folder.
Restart the visual studio.

Visual Studio 2010 Debugger

I'm having some problems (as some of you will see from another question I asked) with getting a program I made in Visual Studio 2010 to run on another computer.
My computer is Windows 7 x64
The destination computer is Windows XP x86 (SP2)
I've already checked to see that I'm compiling for x86.
Anyway, my question is: Is there a debugger I can install that will tell me what errors the program is having? Like a .NET Debugger that does not involve me installing Visual Studio 2010 on the destination computer?
If you have access to the client computer when it is running the program, the easiest thing would probably be to deploy the remote debugger, and debug the program on your own machine, while it is running on the client PC.
Otherwise, you can use DbgClr, which is distrubted with the .NET framework SDK.
One option is to use WinDbg + the SOS extension. This is a much lighter weight debugger that is easily installable but has a steeper learning curve than Visual Studio. I often use it though when I need a light weight debugging experience
WinDbg http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx
SOS: http://msdn.microsoft.com/en-us/library/bb190764.aspx
Another option is to use a program like ProcDump to take several snapshot dumps of your program on the remote computer and USB copy them to debug back at your workstation.
http://technet.microsoft.com/en-us/sysinternals/dd996900.aspx
You can save a dump at various triggers like an Unhandled exception. Visual Studio can open the dump back at your workstation and 2010 supports mixed mode debugging.

How to debug without Visual Studio?

Python -> c++ dll -> c# dll
I have a com interop c# dll that is loaded in a wrapper c++ dll throught the .tlb file generated in c# to be used in a python project. When I run in my computer it works fine but when I run in a computer that just got formated it gives:
WindowsError: exception code 0xe0434f4d
I have the redistribute c++ installed and the .net compact framework 3.5 on the formatted computer.
How can I see what is the correct exception on a computer that does not have visual studio installed? How can I debug all of this? I can't debug the dll's itself can I?
Note: in my computer all works well so maybe is some dll or file missing. I allready used Dependency Walker to see if there's some dll missing, and nop!
Download the Microsoft Debugging Tools for Windows.
It contains the WinDbg debugger, which can also be used for debugging.
Advantage of WinDbg over Visual Studio is that you have much more low-level commands to find problems.
Disadvantage of WinDbg is that it's not that user friendly (compared to Visual Studio).
You can use WinDbg or other good applications to attach to the process or even run the application in the debugger application.
Another really good software is OllyDbg.
Both of these will both allow you to set breakpoints on different locations in your application.

Analyzing a .Net application without VisualStudio

Is there a simple, free way to analyze .Net code (set breakpoint, see stack traces, see running threads) without Visual Studio? Note that I don't need to compile the code, just analyze how it works. I have both source code and binaries but I don't have a Visual Studio license. Unfortunately, the solution file gives several error when I try Visual Studio Express.
EDIT: I may be able to get most of the projects in the solution to load, but I don't see an option for "Debug|Attach to process". Is this not available in Visual Studio Express?
Have you tried SharpDevelop?
If I remember right, MonoDevelop is free, runs on Windows, and supports debugging. I'm not sure if this only works with some languages, but you can give it a go!
Edit: Just checked, and MonoDevelop supports debugging of managed code in its Windows version.
Windbg, allthough its probably too low level for you.
if you want to statically peek at it dont forget reflector http://www.red-gate.com/products/reflector/
the worlds best source browser - and it doesnt even need the source
You're probably missing some required DLLs, causing VS Express to give you an error.
Please post the exact error message(s).
Visual Studio Shell (Integrated Mode) allows you to attach to a process. This edition is basically:
Does not include any support for particular languages, but
Allows extensions to be installed to, for example, add support for a new language
Allows you to attach to a process using the managed or native code debugger

WinDbg and Visual Studio Express editions

Can WinDbg can be used together with the Visual C# 2008 Express Edition?
windbg isn't really an IDE debugger; it is more commonly used directly on compiled exes on the machine. As such, yes, it should be OK to use with an exe compiled with Express Edition, but no: there is no direct involvement of Express Edition in this.
Ultimately, the Express, Pro, Team etc products all use the same compiler that can be used at the command line (csc - although they might access it more directly than the exe!).
Look also at "SOS" (Son Of Strike)
Good question.
VS C# 2008 Express Edition contains a managed debugger.
You will most likely run into some issues running both Windbg and VS2008 Managed Debugger against the same process.
Things you may experience are breaks, and access violations within Windbg that are typically handled just fine without the presence of a native debugger.
As long as you don't intent to perform simultaneous native and managed debugging (with different debuggers) you can attach Windbg in non-invasive mode to a process that is running under a managed debugger without any issues.
Here is a link to some additional inforamtion on ICordbg
(Partition of ICorDebug)
Thanks,
Aaron

Categories