Save Visual Studio Debug -> Exceptions settings? - visual-studio-2010

I find that in different cases you need to have different exception classes enabled/disabled in the Debug -> Exceptions dialog, and it's hard work to keep reconfiguring this.
So, is there any way to save the Debug -> Exception setting and restore them later?
I'd like to have a couple of different configurations to load depending on my needs.
I am aware that the settings are stored in SlnName.suo, but so are a lot of other stuff and it's a daunting and risky task to fiddle with it.
The question refers to Visual Studio 2010, but I'd be interested to know if the dialog has been improved in this respect in later versions of VS.

According to the following article:
https://faithlife.codes/blog/2010/01/saving_debug_exceptions_settings/
"These settings are stored in the SolutionName.suo file that lives alongside your .sln file. Once you’ve configured the Exceptions dialog to your liking, close all the open windows, then exit Visual Studio. Make a backup of the .suo file and restart Visual Studio. Whenever VS loses your settings, close it down, overwrite the real .suo file with your backup, restart VS, and you’re back to debugging the way you want to."

Related

Visual Studio 2015 not showing Debug Source Files for any solution

When I show any of my solutions' properties and navigate to Common Properties -> Debug Source Files, all I see is the list of projects and their configurations, the same as the Configuration Properties -> Configuration settings. According to #HansPassant below, this is the Configuration Manager that's showing up in both places. As I change back and forth between the two settings, all that changes is the three controls (Configuration, Platform, "Configuration Manager...") at the top of the window are disabled when I'm in "Debug Source Files". I've provided screenshots at the bottom of the question.
I restarted Visual Studio, removed my old and new .suo files, and confirmed that a teammate sees the same behavior for an entirely different solution. These solutions all worked fine under 2013 and earlier. How can I get this back? It's preventing me from setting breakpoints on external code.
Update
I did a repair of Visual Studio 2015, and the required system restart, and it didn't make a difference.
Update 2
I did a complete uninstall (which took multiple attempts, and eventually uninstalling from a system account), and reinstall, as well as installing all important (and most optional) Windows updates. There is still no difference.
After working with Microsoft support, we landed on the solution (which I asked them to pass along as a bug): you need to install the Common Tools for Visual C++ 2015. You can modify your installation to add this, and (for me) it didn't require a machine restart.

Global Section inside Solution File (.sln) of Visual Studio Solution secret?

Recently I was trying to load a solution source controlled by TFS but some projects in that solution were not being loaded in solution explorer inside visual studio. After spending hours of my time, for temporary reason when I deleted the whole "Global Section" at the end of .sln (solution file) by manually editing it in a notepad and restarted Visual Studio, all projects appeared as expected. I am using VS 2008. It hasn't shown any odd behavior yet, but couldn't understand the reason.
Does "Global Section" in solution file play and important role? Any harm in removing global section?
Well, you just deleted any source control bindings, plus build configuration and some solution-specific settings.
VS should revert to defaults if it doesn't find the section, though I suppose it would have been better if you knew just what was causing the issue. If the problem was with TFS then maybe resetting that fixed the problem.
As to harm, again, if VS is able to cope with the removal of the section and can revert to defaults then I see no harm. Of course you might lose configuration information, which will have to be re-applied.

Configure 'Save on losing focus' in visual studio 2010

Is it possible either in the standard build or via a extension to make visual studio 2010 save all unsaved work when I switch focus to another application.
It's a feature that IntelliJ and TextMate do rather well (spot the Java developer learning C#) and it means I've gotten out of the habit of saving changes before I switch to the browser and hit refresh.
Note I'm not expecting real code to just work like this, I'm kinda hoping that changes to views and scripts can be saved on alt+tab
Someone made an add-in which does the job, go to http://cbates.net/document-autosave-for-visual-studio/
UPDATE:
Beware in VS2015 it seems that sln/csproj files are not being saved when focus is lost. This can cause some pain when you pull latest changes outside VS and forget to save project manually.
You can configure an auto-save option that allows you to set a number of minutes and VS saves everytime that number of minutes is hit, its not exactly what you require but is an option you can consider.
To configure this option, go to Tools \ Options and then click on AutoRecover in the Environment section:

Getting Visual Studio to ignore source control bindings in a solution

Is there a way to tell Visual Studio 2005 to just ignore source control binding when opening a solution? I sometimes need to load a solution for which I don't have access to the source control server, but Visual Studio insists on trying to connect anyway, meaning I have to click "temporarily work offline in disconnected mode" for every project in the solution (of which there are about 20) as it loads. For some reason, it also tries to check each project out immediately after I've told it to work offline, so I have to click past that dialog box too.
As I will never need to edit anything in this solution, is there any way I can open it and have Visual Studio just ignore the fact it has source control bindings in it?
Edit: Ideally, I'd like a way to do this without having to change the project/solution files. They change fairly frequently, so I'd have to redo any changes every time there was a new version (otherwise I'd just unbind them once and it wouldn't be a problem).
Thanks for the replies so far.
The source control bindings are stored in Visual Studio solution file (.sln). For TFS for example, it contains a global section for TFS information and the solution projects added to TFS. You can edit the solution file to remove these bindings manually. I would suggest making a copy of the solution file first. However, I would recommend removing bindins via Visual Studio. Open your solution and go through the offline scenario. Then go to File/Source Control/Change Source Control (VS 2008) to bring up the UI that shows you the source control bindings in your solution. There you can manage the bindings including unbinding them. Once unbound, the next time you open the solution, VS should not have a need to access the source control.
I've been looking for a way to disable Integration between SourceSafe 2005 and Visual Studio 2008. We are forced to use SourceSafe being in a corporate environment and all. SourceSafe is fine on its own if you treat it like a baby. As soon as you try to do anything approaching useful it starts to break. God forbid you try to use the integration with Visual Studio. Being that I didn't want the "Bindings removed" so that it doesn't confuse other devs on the team I needed to be able to tell Studio to ignore the solution and project bindings and continue on it's merry way.
I followed the registry hack suggested in the following post
Removing SourceSafe Integration from Visual Studio 6
Studio did what I wanted...sort of. It removed the SourceSafe integration. However when I opened up a source controlled solution it asked me if I wanted to remove the bindings.
"the projects will be treated as not under source control"
No I don't want you to remove the bindings from the files, I want you to IGNORE them. This dialog pops up every time you open the solution/project file and there is no way around it.
My solution at the moment seems to have worked...for now.
File->Source Control->Change Source Control...->Disconnect
I hope this helps anyone else in the position of having to use SourceSafe but can't remove the bindings from the files themselves. WHY, Microsoft, WHY would you put the bindings in the files themselves?
/rant

Visual studio forgets window settings and makes a mess

I have this problem where I open Visual Studio and the internal windows are scattered all over the place. None of them are docked; some that should be visible have become invisible and vice versa. I then have to spend ages getting the windows back where I like them.
It only seems to happen with some solutions and only appeared recently.
For the life of me I can't fix the problem. Has anyone else been through this?
Sounds like there is definitely a problem with Visual Studio retaining your settings between round-trips and possibly your Visual Studio settings profile in general.
The solution I'd recommend is firstly to reset all settings, secondly customize things to your personal preference and finally take a backup of those customized settings. The idea is that this settings backup file can be used later to automate a quick settings restore to a point you are happy with. The following steps show how to do this and hopefully should sort out even the most confused Visual Studio setting issues:
Close down all instances of Visual Studio.
Go to Start > Programs > Visual Studio 200X > Visual Studio Tools > and choose 'Visual Studio 200X Command Prompt'
Run the sligthly less well known 'devenv.exe /ResetUserData' command. With this command you will lose all of your Visual Studio environment settings and customizations. Because of this, the /ResetUserData switch is not officially supported and Microsoft does not advertise it (the switch is not described in the help for devenv.exe you get when you type devenv.exe /? in a command prompt). Importantly, wait for the resulting devenv.exe process to disappear from Task Manager or even better Process Explorer.
When the process disappears from Task Manager or Process Explorer, run 'devenv.exe /ResetSettings' which will restore the IDE's default settings and eventually start a single instance of Visual Studio.
Now in Visual Studio choose 'Import and Export Settings...' near the bottom of the 'Tools' menu to start the Import and Export Settings Wizard.
Choose 'Reset all settings' radio button and Next > Choose 'No, just reset settings, overwriting my current settings' and Next > Choose your personal 'Settings Collection' preference, I would choose Visual C# Development Settings here (Note: What you choose here has an effect on keyboard shortcuts etc. but you can always repeat this process until happy) and click Finish.
When you get the message that 'Your settings were successfully reset to XXXXXX Development Settings.' click Close then spend a good bit of time adding any personal customizations to Visual Studio such as opening windows you always want open, customizing toolbars and adding any toolbar buttons etc.
When you are finished with your personal customization and completely happy with your setup go again to Tools > 'Import and Export Settings...'
Choose 'Export selected environment settings' radio button and Next > Tick 'All Settings' and Next > Choose a file name and directory and click Finish to store a backup of your current settings in a .vssettings file.
In future if things go haywire again head back to Tools > 'Import and Export Settings...' and this time choose 'Import selected environment settings' radio button and Next > Choose 'No, just import new settings, overwriting my current settings' and Next > Either choose the name of your .vssettings file from the list (usually under the My Settings folder) or Browse.. to where you saved the file and Next > Tick 'All Settings' and click Finish.
Importantly, close the single instance of Visual Studio. Any future instance you open should retain your latest customizations.
Visual Studio corrupts its settings with regular monotony (always has done, I've been suffering from this since the Visual C++ days, and it's still a bugbear in VS2013).
Often this seems to be totally at random, but it's highly probable after a crash.
It will also lose any changes to your settings if Visual Studio doesn't shut down cleanly - for some reason instead of saving back the settings when you OK the dialog, VS seems to wait until it quits to write back your changes, so after changing options I always quit and restart to ensure the changes have been flushed to disk. Similarly you should never change options with 2 or more instances of VS running, as the last one to quit will overwrite the settings.
In particular, there is an easily reproducible case: If you launch two or more copies at the same time (by which I mean if you start up two or more copies, so they are all initialising at the same time), they seem to fight over the settings file and it becomes corrupted or resets to defaults.
The best two workarounds I've found are:
Never launch more than one instance at a time. If you need to run several instances concurrently, then wait for the first one to finish loading its Solution before you start to launch the next.
Always use Tools > Import and Export Settings to save your settings to a backup file, so that recovering from this corruption only takes a few seconds each time it happens.
Another smaller, but still rather irritating habit is that if VS is minimised when it is quit (e.g. by shutting down), it corrupts its window position information and the next time you run it, it will be maximised.
I had a similar issue when the My Documents folder was stored on a mapped drive. If I opened VS before mapping the drive, VS would act as if it was the first time it had been opened. I solved this issue by storing the environment settings on the local disk.
I just ran into this problem too (seemed to trigger after a windows update) where I kept getting some bogus window layout no matter what I did. The above suggestions didn't work either. But luckily the suggestions in: Why doesn't VS 2008 IDE remember my preferences? of deleting:
%APPDATA%\Application Data\Microsoft\VisualStudio\9.0\windows.prf
worked.
TP
Actually I worked out what the culprit was: previous VS crashes.
If one of my Visual Studio instances crashes for whatever reason - the next time I start up VS, I get a weird batch of settings. The behaviour depends on various factors, like whether or not I had other instances of VS open at the time.
I tried Peter McG's solution, still didn't help.
What ended up working for me was to delete my VS Solution User Options (.sou). Located in the same directory as my solution.
Only bad thing is you have to redo all of your settings. This included my exception changes. Not to much to change, but if you have a lot of customization it could be a real pain.
There must be something in that file messing everything up, but deleting the whole file is quick and easy.
Which solution you're opening shouldn't matter because those settings are not solution-specific. But I wonder do you maybe have Visual Studio 2005 and 2008 installed? If so, opening a solution created in 2005 will open VS 2005 and opening a 2008 solution will open VS 2008. You may have VS 2005 even if you didn't install it. For example, InfoPath 2007 installs a VS 2005 shell.
First I would position the windows where you want them, then do a Tools -> Export Settings and include only the window layouts. That way you at least have something you can revert to.
Then I would check Tools -> Options -> Import Export Settings and make note of where the "Automatically Save My Settings To This File" path is set to. Keep an eye on that file. Do you have any sync software that may be inadvertently overwriting it? Does it point to a non-existing location?
My issue is similar, but the result is the app crashes. The problem was this value
In HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\MainWindow. It was set to "0 1000 -280 -100 3" probably due to having multiple screens and moving the UI around a lot.
Deleting this value allowed the app to restart successfully. It gets recreated on startup.
I'm facing similar issue. And it also only started recently, like, within the last 30 days or so. The only thing I remember changing in this period was updating Resharper 4.5.
I have experienced something similar. In my case the text editor colors (c# editor for example) are going haywire. The only solution that I tried and works for me is change color theme so something else and then back to what I want.
In my case its not the Window layout being corrupted but Intellisense offering code completion and pop-up help. Never had this issue for the last decade, now it happens 3 times a day at least. Win8.1, Visual Studio 2013, ReSharper 8 and now ReSharper 9 (in hopes the upgrade would fix it).
I now routinely have to
close the solution,
Tools/Import-Export Settings/Reset all settings
Close Visual Studio
Open Visual Studio Import my saved settings
RE-open the solution and continue working
I can then work fine again for quite some time until something goes awry... lets say a stack-overflow while I'm debugging. At that point I just know my settings are screwed and my Intellisense is dead again.
I'm starting to wonder if it isn't something to do with a latest Visual Studio update. There are things in there I never use like the advertising crap and Office development integration. MS Office has its own issues, like Office 64 bit not being seen by any other application such as Quicken as an installed email program. Or maybe its a conflict with ReSharper which wants to overtake and 'extend' the Intellisense feature.
Either way, I'm sure its a different manifestation of the same issue: Visual Studio settings are going sideways during normal use.
I just came across this issue in VS 2012, reset window layout was doing nothing.
I extrapolated
%APPDATA%\Application Data\Microsoft\VisualStudio\9.0\windows.prf
to
%appdata%\Microsoft\VisualStudio\11.0\Windows.index
... deleted it and was back in business!
Make sure you close all instances of VS first!

Resources