Easy way to copy breakpoint in Visual Studio - c#

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/

Related

visual studio: How to ignore pdb not loaded warnings during debug?

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

Visual Studio testc, how to get rid of it?

I could have asked this question years ago, but I think it has finally annoyed me enough to ask this question. Many times while I am coding, Visual Studio tries to Intellisense my deal with testc. I know that testc is a snippet for a test class, but it is something I will never use in anything except maybe a test project, and likely not even then. So, how do I prevent this annoyance from ever appearing in my Intellisense options again? Yeah I know... stupid thing to worry about...
On the Tools menu, click Code Snippets Manager.
Select the directory Test.
Click Remove.
Press CTRL + K, CTRL + B. This will bring up the code snippets manager. In the Visual C# directory, you can remove the snippets (testc in your case) that you don't want to include. Note that system generated snippets cannot be removed by this method, although per mojits answer you could remove the entire directory of snippets.
One way around this is to delete the snippet file manually, by finding / deleting its actual file. I am using Visual C# express 2010 right now, and this is the directory they are in for me (you may have to modify slightly, and restart VS for changes to take effect).
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC#\Snippets\1033\Visual C#

Is it possible to see a list of executing functions in Visual Studio while debugging without breaking?

I've worked with the Call Stack, Call Hierarchy, and Profiler. None of these tools gives me a simple, live "just executed function list"... in a tool Visual Studio window. I need something to look at when I click a button or link that guides me to a specific code file and line (if available).
I've found nothing of the sort. Maybe, even if PDB FULL is on, such information isn't available. I believe at this point that I'll have to write a Visual Studio 2012 Add-In or Extension to do what I need, but I run into problems there as well: For one, I can't get a function name from any viable interface unless I pause the debugger or encounter a break-point. Second, the application that I want the list for is a MVC app that runs as a DLL under "WebDev.WebServer40.exe".
I thought this would be very simple: From an extension, create a tool window and log the last executed method along with argument list.
Any ideas? Many thanks in advance!!
EDIT: For additional clarity
If you have Visual Studio Ultimate, you can use IntelliTrace. Alternatively, you can try Runtime Flow, but it can't work at the same time with VS debugger.

Visual Studio add in that alphabetizes values in a resource file

I want to make a visual studio's add in that has the ability to sort resource files alphabetically every time someone edits a resource file. I'm not looking for a solution, but I have never used the Visual Studio sdk before. I simple want to know if anyone that has experience with the Visual Studio sdk may know if this is possible? Also any suggestions on how to start making an addin are appreciated.
If you have never used visual studio extensibility, I recommend you this page:
Make a solution notebook tool window
There is some useful information about how to interact with visual studio for saving data in sln and suo files, and also you can find information about some attributes you can use to tell visual studio what your package (or plugin) needs to do.
It's a general knowledge thing although, not directly related to what you want to do.
this link is about how to listen to some specific events visual studio fires, it shows you general way of creating listeners in your plugin
this one is actually about what you need to do (it tells you how to catch the event fired before visual studio saves a file)
and the most important one: the source code for creating a custom source control for visual studio, that's where I found most of the info I needed to understand visual studio extensibility
with all these links you should get something to start with, and of course you have the official msdn documentation about extending visual studio
What you'll need to do is creating a plugin that will listen to events fired when an item is about to be saved in visual studio. I don't think there is a specific event for resx files, so you'll probably have to test which file is saved, but that should be all.
Once you have the item, you can find the physical file and sort it.
Another thing, I found out that the events declared in the DTE object don't really work (at least for me it didn't), that's why I recommend you to implement the listener pattern to catch the events you need.
Hope this helps
I actually did exactly that.
You can find the source code for the extension in GitHub. It shows you how the get handles for files from the Solution Explorer, add context menu actions, write to the output menu, etc..

Visual C# 2008 Express doesn't give me any options for break points besides creating/deleting them

I'm not sure why this is, but all I get is a 'create breakpoint' and 'delete breakpoint'. There is no option for a 'when hit' or something else like that.
Any ideas why?
This functionality is not provided in the Express edition of Visual Studio. You can have a look here for details.
I'm not quite sure where BP info is stored, but this did the trick for me (C# 2010 Express):
close the IDE
delete the *.vshost.exe (see EXE/DLL output folder)
delete the *.SUO file
now re-open the IDE and load the project again.
Notes:
The *.vshost.exe might need to be terminated the hard way before you can delete it.
Deleting the *.SUO file also takes away some of the IDE project group settings, such as files opened, project tree folding, etc.

Categories