This is not a duplicate question, my question is not answered in other threads. Please read before marking duplicate.
If I mark a breakpoint int Visual Studio 2013, and I leave that in there for several sessions of coding, I find that the breakpoint is duplicated. Sometimes hundreds of times. These are duplicates because they are for the same line of code. I usually click to the left of the line numbers to create my breakpoints.
My question is how do I prevent that from happening? I know how to delete them, I'm just wondering how to prevent them, which I have not seen an answer to.
The only reason I know of (that's not a serious bug) that would cause a line breakpoint in C# to have children is if your application is creating multiple (many by the looks of it) AppDomain's. As an Application Domain is created, not only is that executable code duplicated, but all of the breakpoints in that code are as well.
So, to prevent the excessive procreation of breakpoints, either stop creating AppDomains or do not set breakpoints in code executing in multiple AppDomains. There is no setting in Visual Studio to prevent this intended behavior.
Related
For some unknown reason, my visual studio adds many break marks in my code.
Some where I believe i had some in the past and some in utterly nonsense positions.
I have found nothing in the web. Dont know if thats a bug or if I am using it incorrectly.
Anyone had that before or knows how to resolve this?
I can remove them point by point until my app runs through but as soon as I start debugging, they are beeing readded. When I stop debugging, they are gone again. I was even able to capture one sample beeing added:
It litterally makes debugging impossible. I cant remove 50 break points whenever I want to debug...
Workaround #1
I have found kind of a workaround by going over Debug -> delete all Break points.
Be aware, this will delete your wanted breakpoints as well.
Lately, VS has been getting more and more annoying about warning me about editing code while debugging. Regardless of whether it is a popup telling me that a file has been edited, purple underlining, or a warning that gets grouped with the compiler warnings and errors, I don't want it. I wish it would just let me edit, continue running the program that was built, and keep quiet about it.
Is there a way to tell it to do that?
Incidentally, I have already disabled edit and continue. See Edit and Continue: "Changes are not allowed when..."
You can apply changes to the source code in debug mode when you stop at a breakpoint.
Manual: How to: Apply Edits in Break Mode with Edit and Continue (Visual Basic)
This is a workaround but some workarounds, well, work.
Run two instances of VS on the same solution. Debug one and encounter needed edit. Ctrl+TAB to the other instance and make the edit (without saving... by the way use auto-save). Continue until you’re done, and then save the files in instance 2. After debug, the changes are available to both instances.
Rarely (at least in my experience) do you actually want edit-and-continue; usually you’re watching the code under debug and realize it is wrong and want to fix it, but also want to see some downstream effects without killing the debug session.
This gives you that with a minor inconvenient task switch.
I have a really strange problem with my Visual Studio.
I usually press CTRL + S pretty often (call me paranoid, well however I got that habit some years ago now and I really don't want to get rid of it :-))
Now I had the issue that I was editing one file, changing a few dozen of strings according to a spec I had open in Word; so I switch around these two tasks pretty often, make one or two changes and then save.
The odd thing is, every once in a while, after saving, my file is suddenly in read-only-mode, so I cannot navigate through my changes (CTRL+Z/CTRL+Y) and have to reopen that file to continue to code and pray.
Indeed it feels random to me when this occurs:
sometimes I only change 1 thing and save and then it's immediately read-only,
well in other cases it will let me edit several things until it is stuck.
Someone else also experiencing this and maybe got a tip?
Maybe I hit some magic hotkey or something?
My bad, please check if your projects folder is not a synchronized one, so when you edit (change) your project, the backup tool starts to update in remote location for synchronization purposes, so locks the file.
The answer to this problem is most likely that you are currently in Debug mode - i.e. the application is being run. Click "Stop" and it'll allow you to edit the files again.
By default, you cannot edit source files while the Debugger is running.
I have a VS solution containing several projects. While debugging a particular project all the source files are locked by VS. I would like to unlock sources that the debugee doesn't have dependency on. Is there any way to do this within one solution?
UPDATE:
I'm using Win XP SP3 32bit. Visual Studio 2010, C#. Edit and Continue is enabled. The solution contains 6 projects (number in not important actually), 5 of them depend on the data access layer project which uses Entity Framework. None of the 5 have any mutual dependencies. They are WinForms and Console applications. I would like to be able to run one of the projects and make changes to others without stopping the first. The problem is starting and stopping the project take considerable amount of time.
The Edit and Continue feature is preventing you from editing files if the debugger hasn't stopped the program. The simple workaround is Debug + Break All, you should then be able to edit the files, your changes will be immediately effective provided your changes do not violate the restrictions imposed by E+C. This is the most efficient work flow.
The heavy-handed approach is to disable Edit and Continue. Tools + Options, Debugger, Edit and Continue, uncheck the Enable check box.
I don't think that there is a way to avoid that. While debugging Visual Studio lock all files to prevent any change on them, including those on other projects.
You can try to open the project which you are interested on with another Visual Studio instance to make changes to your files or open files singularly with another editor.
This doesn't quite answer the OP's question per se, but for anyone who has stumbled upon this page in the same (very frustrated) boat as I am, this might help.
The solution: start without debugging.
It was driving me absolutely crazy that Visual Studio would not let me edit files while the app was running. My typical workflow is:
Make some changes
Run the app to see the effects of those changes
Based on the results, make more changes, etc. etc.
The problem is Visual Studio was preventing me from step 3. It demands that you STOP running the app before you can even make any changes (including to a XAML file or adding a file to the project), which also means that you can't go back to the app to double-check something while you are actually programming it at the same time (which is how I work, bro).
Thank god I finally discovered if I run without debugging it doesn't impose this ridiculous limitation. It's still a pain in the butt if you actually need to debug something you have to re-run the app in debug mode, but it sure beats having to kill the app before it will even let you edit a file.
Bookmarks: In VS 5 they seemed like a great idea but I ended up not using them mainly because they didn't persist between sessions. E.g. If you closed a file that contained bookmarks they would not be there the next time you opened the file. You also could not move between bookmarks in different files etc. and I stopped using the feature.
For years I would kill the bookmarks toolbar whenever I installed VS. It took me years of using VS 2005 until I noticed that the bookmarks feature had actually been greatly enhanced and I use them on a daily basis.
Have you ignored Visual Studio features and later discovered their value?
It wasn't so much ignoring VS features as it was being ignorant of them, but for a while I didn't use custom project/item templates and code snippets, even though there was significant boiler plate code at my last job that was easily fixed by using these. I used the default templates for a while until I realized I could customize them for our application, and it's saved me loads of time since then. Code snippets I used to a lesser extent, but I do find them useful for smaller bits of code.
The other "feature" I find infinitely useful these days is "Delete all breakpoints" (CTRL-Shift-F9). I used to keep all of my breakpoints around, and they would persist in each solution...but it would 1) slow down VS load times, and 2) disrupt my debugging behavior by breakpointing in sections of code that I didn't need to breakpoint in anymore. Instead of manually removing them, I got into the habit of removing all of them, and then placing a few key ones around code I really needed to test. This was more contextual though - initially having a ton of breakpoints was useful to learn the codebase, but once I was familiar with it, isolating bugs was a lot easier without all of the breakpoints hanging around.
Macros for repetive keystrokes
The code palate (part of the toolbox) for storing my fave code clips
T4 toolkit for generating code
Customize the top toolbars to remove stupid shortcuts (like copy/cut/paste, undo/redo) and add ones I ALWAYS use (comment/uncomment block, step into/over/out)