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
Related
The shop where I work is currently using VB6 for development using controls and libraries. Someone once showed me how to use Visual Studio to be able to debug this code by simply creating a console application in C# and then changing a few options. He showed me this in VS2010, but I am now using 2015. When I go into the project properties and go to the Debug tab, the option for "Enable unmanaged debugging" is not there. Did Microsoft remove this option? I have searched the web quite a bit, but have had no luck finding a solution.
Also, for kicks, I also have 2010 installed on my machine. The option is available there, however when I attempt to run and debug I get a LoaderLock failure. After researching it I found that I have to disable the exception in Visual Studio. However, it would appear that my exceptions are locked down and I cannot change them as they are all greyed out. I am an administrator on the machine I am using, but I am unsure of where or what I need to change to enable me to change the exception settings.
Any recommendations on either issue would be greatly appreciated. It's not a show stopper for me, but a HUGE inconvenience.
I have .net application (GUI as well as PowerShell) built against 4.5. My OS is server 2012. When I attach my application to 2013 visual studio, the debugger is not working sometimes. Its not evaluating expression or showing locals (and also watch window/immediate window nothing works - its as if the project is build with release). But I have build with 'Debug' configuration. And as mentioned same thing works when I simply attach with VS 2012 ( yes, I have 2k13 and 2k12 SXS)
Please note that if I attach the same process with the same settings (managed debugging), to Visual Studio 2012 it always works.
I made sure the symbols are loaded (by checking modules tab in visual studio + debug + windows), break points are hit.
Any thoughts on what might be the issue? All the updates are up-to-date as well.
Its kind of annoying to launch vs 2012 just to debug, when I am using VS 2k13 IDE for development.
Regards!
If you are facing the same issue, please look at http://weblog.west-wind.com/posts/2013/Nov/21/Visual-Studio-2013-Could-not-evaluate-Expression-Debugger-Abnormality for details.
Here is the answer which solved for me:
I have set the flag "use managed compatibility mode" in Tools | Options | Debugger | General.
For details, take a look at the link as he explained it nicely as a story :)
Am happy it worked, otherwise I just had to load project in vs 2k12 just to debug it which is annoying.
EDIT on 12th June 2014
I have updated my dev environments with visual studio 2013 update 2 (http://www.microsoft.com/en-us/download/details.aspx?id=42666) (as per Maria's suggestion below) and removed "using managed compatibility mode". I will be testing my apps (ps cmdlets, gui, services) and update you in couple of weeks if the debugger is ok for me.
EDIT on 26th June 2014
I have tested my apps and luckily for me everything is working nicely :). Even the debugger is doing pretty good job with new async/await model. So, see if you can upgrade to 'update 2' - hopefully this works in your environment too?. Thanks to Maria and debugger's team!
Regards.
I deleted all my breakpoints and then it started working, with Visual Studio 2013 Update 1. This was one of the suggestions from the blog post mentioned by Dreamer.
We have released a fix for the issue you are describing in Update 2 CTP 2 of Visual Studio -
Please let me know if that doesn't resolve your issue!
Thanks!
Maria - Visual Studio Debugger
Please note that while the accepted answer probably will fix the problem for now, it's best to be aware of the drawbacks of this solution. Making this change will make VS 2013 use the older style debugger for all you projects. It is a global setting. There are other ways to locally change this for a single project. Please read here for more info on this:
http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/switching-to-managed-compatibility-mode-in-visual-studio-2013.aspx
We have a custom expression evaluator and our own language and this warning message to change the settings always appears even after I change the project settings to those specified in the blog.
<DebugEngines>{351668CC-8477-4fbf-BFE3-5F1006E4DB1F}</DebugEngines>
Is there something else?
Our clients are using VS2013 pro. I've turned off all the "Enable the Visual Studio hosting process" for all our projects and also added the property to our clients projects. I still see the warning each time I attack to w3wp.exe.
IMPORTANT NOTE: If your project is using the Visual Studio hosting process (the default for many project types), you must disable the hosting process for this fix to correctly change the debug mode. To disable the hosting process go to the Debug pane on the project properties page, and uncheck "Enable the Visual Studio hosting process"
You can resolve this error by applying below points
Sol 1:
1) Restart visual studio and re-open your project.
2) Open your project bin directory and delete DLL of that code where your debugger is not working properly.
3) Then again add DLL reference in the bin directory.
4) Remove all breakpoints.
5) Build project.
6) attach with one w3wp.exe process in attach to process window
7) Enjoy your problem has been resolved.
If above solution is not working then you can try solution that has been provided on bellow link
http://weblog.west-wind.com/posts/2013/Nov/21/Visual-Studio-2013-Could-not-evaluate-Expression-Debugger-Abnormality
I had a similar problem debugging where this error occurred from a return from creating a class. The class initialized fine (using "new classname()") but then it gave the "cannot evaluate expression" error on the return. Though it worked on previous visual studio versions, running on VS 2017 it crapped out.
After a lot of head banging, it turned out that private variables in the class, especially things like arraylists and other classes, needed to be declared with initial values, even if set to null.
Once that was done, everything worked, even though the solution "appeared" to have nothing to do with the problem and gave no apparent clue of where the problem occurred.
We had this problem with PostSharp extension version 5.0.32 with VS2013 Update 5.
Our workaround was downgrade PostSharp extension to version 4.3.19 or disable it.
Set AutoEventWireup="true" on aspx header file. This will turn debug mode on.
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.
Visual studio team system 2008 keeps crashing on me. Sometimes it just freezes, or certain parts of the UI get messed up or a weird popup box saying something about unable to load parameters or saying something else about memory or any other number of things.
it usually happens when I do a "complex" task like go into debug mode or do a search across of whole solution or run a unit tests or something like that.
I rebooted my machine countless time, reinstalled it VS, changed my virtual memory settings, flush my page file on every reboot and anything else i could think of.
It seems like VS runs out memory or something.
I have a powerfully machine with lots of RAM so that's not the issue
any suggestions?
You can always try some standard Visual Studio troubleshooting steps:
Clean the solution
Delete / rename all files in your solution created by VS, i.e. all .ncb, .suo, .user files
Launch Visual Studio with all add-ins disabled: devenv.exe /SafeMode
Reset All Settings: Tools -> Import / Export Settings -> Reset All Settings
Delete HKCU:\Software\Micosoft\VisualStudio\9.0 and then restart Visual Studio
Repair the Visual Studio installation through Add/Remove Programs
You might also check whether there is a hotfix available addressing your issue (e.g. KB960075 sounds like a good candidate for you), or whether you find your problem already reported on the Connect website.
The first step is to uninstall all 3rd party add-ins on Visual Studio. In particular if you have multiple add-ins as they can interfere with each other in unexpected ways and cause crashes. After uninstalling repeat your scenarios and see if this fixes the issue.
If not then it's best to consult the application log and find out why Visual Studio is crashing. The log will contain at least the error code of the crash which can searched on google or reposted here for us to take a look at.
Assuming this occurs with VS up to date with all service packs installed, you might try some of these suggestions. If you haven't tried with service packs, do that first.
What version of Windows are you using? If it is Windows 7, try launching Visual Studio with a compatibility mode and see if that resolves the issue. To do this, make a copy of the normal launch shortcut and go into the Properties dialog and set it to run as Windows Vista.
If this doesn't fix it, then you might also consider:
Checking your PATH environment for any weird settings which might be confusing it, e.g. paths pointing to other SDKs
Any 3rd party VS extensions such as source control, refactoring plugins, wizards etc.
Old versions of .NET or SQL server
Also test if the issue occurs for every kind of project or just certain kinds, e.g. does it happen for all projects? Does it happen in C++, C#, VB.NET projects etc.
You can also attach a debugger to Visual Studio, to see what it's doing. Sometimes a particular .sln will trigger bad behavior or more likely, some third-party add-on.
If you believe that you've gotten VS into a wired state, you can try the following command line switches
devenv.exe /ResetSettings (This will reset the visual studio settings to the defaults)
If that doesn't help, as a last resort, you can try
devenv.exe /ResetUserData
This is what I'm looking for: I'd like to be able to get a real time method call listing when I am debugging my program. So for example, say I run my program via the debugger if I press a button or do anything in my program I'd like for it to spit out, say on a visual studio plugin, in real time, all the methods it went through when I pressed this button or did some kind of user action with my program.
I actually once wrote a visual studio plugin that does that by using the visual studio profiler api (I had to write a c++ com server dll that receives this information and pipes it back into my c# plugin). I did this a few years back and I have no idea where I put it. But I'm wondering if Microsoft did something like this in visual studio 2010 or if you know of any third party plugins like this because it is a very handy debugging utility.
Thanks
Check out Visual Studio 2010's Intellitrace feature - it might get you what you need: http://msdn.microsoft.com/en-us/library/dd264915.aspx
You should check IntelliTrace debugging in Visual Studio 2010. It works only with x86 though
It's not free, it's not even cheap, but RedGate's ANTS Performance Profiler can provide that data and more.
I think you could achieve that using AOP, e.g. PostSharp and an implementation of it's OnMethodBoundaryAspect and a MultiCastAttribute to apply your aspect to every method of your program. They even have an example for something quite similar to what you want on their site.
Updated link as of 8/15/2018: IntelliTrace
Note that this feature is in Enterprise edition only
From the linked page:
You can spend less time debugging your application when you use
IntelliTrace to record and trace your code's execution history. You
can find bugs easily because IntelliTrace lets you:
Record specific events
Examine related code, data that appears in the Locals window during debugger events, and function call information
Debug errors that are hard to reproduce or that happen in deployment
You can use IntelliTrace in Visual Studio Enterprise edition (but not
the Professional or Community editions).
My Runtime Flow extension shows method call listing when you press a button or do anything in a program. It works outside Visual Studio debugger.