While debugging, I do not want visual studio to be looking for *.pdb files from 3rd party *.dlls. For example I use Jetbrains Resharper TaskRunner for unit testing. To use it requires a reference to Jetbrains.Resharper.TaskRunnerFramework.dll. When I debug my application via the TaskRunner, I end up with something similar to this picture below:
Well, I'm not debugging the task runner. That isn't my code anyhow. I want Visual Studio to be "smart" enough (or have a setting) to automatically know to NOT concern itself with *.pdb files for anything that isn't my code. Is this possible?
Have a look at the Just My Code setting in Visual Studio. From the documentation, there's a section that sounds relevant, which discusses one of the effects of having this setting applied:
When you Step Into (Keyboard shortcut: F11) non-user code, the debugger steps over the code to the next user statement. When you Step Out (Keyboard: Shift + F11), the debugger runs to the next line of user code. If no user code is encountered then execution continues until the app exits, a breakpoint is hit, or an exception occurs.
You can enable Just My Code in the Visual Studio options under Debugging > General:
Add a .gitignore file to your solution and add all extensions you want to ignore
Add this in your .gitignore file *.pdb
Related
Just as the title asks. I have solution with 5 projects in it. All dlls are connected with each other and whenever I start debugging, I can freely debug any of them. I'd like to add a separated project and access it's object by using reflection only (no references between the rest and 6th proj at all). Can I make it attach automatically to the debugger? I'm aware of function 'attach to existing process' but that's manual job.
You don't need anything special. Make sure you have pdb file next to the dll for that separate project, have source code locally matching to the version used to build that project, and possibly turn off "my code only" in tools -> options -> debug. At that point Visual Studio should pick up debugging information and allow you to set breakpoints and debug normally.
If PDB located somewhere else you can manually point to the PDP via debug->window->modules view by selecting "load symbols" from context menu on module you are interested to debug.
If sources don't match exactly you can instruct VS to use whatever you have also it likely will lead to confusing debugging experience (How does Visual Studio know if the source file matches the original version?).
You can put below line in your debugging dll ,in which function you want to debuge. it automatically ask you to attach with debugger
System.Diagnostics.Debugger.Launch();
Is there an easy way to copy/move breakpoint to another line in Visual Studio?
There are scenarios when breakpoints may contain some conditions, tracing, etc. and it is not easy to copy/move it around during debugging session.
The only solution I see now is by import/export which is not really acceptable.
What version of the Studio?
To move:
For 2013 and earlier, right-clik on the breakpoint and select "Location".
For 2015, hover over breakpoint's icon and click "Settings...".
In the location area, you can change the name of the file and the line number.
There is no obvious way to copy. How bad do you need it? Someone may write an extension to do that :)
You can export break point in xml file and when required import that xml file to visual studio again. There is option from export/import in break point window of visual studio.
Check this article for detail : http://www.c-sharpcorner.com/UploadFile/pranayamr/setting-breakpoints-in-visual-studio/
I have one solution file. When I running resharper code inspection in Visual Studio - there are no problems. When I run resharper code inspection with utility inspectcode.exe from command prompt on my local machine - everything is ok too. But when my build-machine copies files of my solution from tfs and runs resharper code analysis from command prompt - there are some problems: resharper doesn't look on some projects usages, and think that some properties can be made private - I get resharper inspection problems. How to understand why it happens?
By default, ReSharper Command Line Tools runs with SWEA (Solution Wide Error Analysis) enabled and "Property can be made private" suggestion is SWEA suggestion. You may disable SWEA on a build server by adding /no-swea key.
I am using Visual Studio 2013 in an ASP.NET MVC/C# project.
I am outputting to the output window using
System.Diagnostics.Debug.WriteLine
but for some reason VS has stopped running this line. I am executing in Debug mode. If I step through the code the debugger will jump over this line.
Is this controlled by a setting. I have searched the web but nothing obvious jump out
Go to project settings and see if there is check mark in front of Define DEBUG constant. Most likely that it's not there, although it should be by default.
If DEBUG constant is not defined - the method you are referring to is removed by compiler. That's why your debugger acts like code is not there.
I'm loading a dll (c#) from QTP. Is it possible to debug the c# code when the qtp test starts.
Yes you can debug into the dll's you can, but you will need source (unless you want to look at the disassembly) and you will also need the PDBs (debug symbols) for the assembly. It is pretty easy to setup...
start the QTP application
start visual studio
open the source code and make sure the pdb's are in the same directory as the dll
in VS go to the debug menu and select attach to process
In the process list, select the QTP process and click "attach"
Set a breakpoint in the code
Start the tests that execute the code and if all is well you should hit the breakpoint
NOTE: if the breakpoint is not hit, VS probably can't find the PDB's and you either need to add a path in options in VS (or something so it can find them).
Also, try turning off "Enable just my code" in the Tools->Options->Debugging options page if it is still not working (mostly if you are looking at release built code).
Update: Answering comment... If you go to Tools->Options... Select "Debugging" on the list on the left and expand that, then select "Symbols" you can add paths there for VS to search for symbols. Also, if you don't have the exact symbols you can right-click the breakpoint and select location and check the option that will allow the symbols to be out of sync.
Hope this helps!
You can insert a call to Debugger.Break()and run the external application, when the break point will be reached Windows will offer you to debug the exception.
Choosing debug will enable you to run the code after the break inside Visual Studio and set break points inside your code.
In case you're using Vista/Win7 you might need to enable debugging - have a look at this post to learn how.