visual studio 2008 save or backup exceptions to break on - c#

Hi i have break on unhandled exceptions turned on, and turn off the ones i expect to happen as part of my code.
But every so often (usually on restarts visual studio resets all my Debug->Exceptions to all unselected
I want to backup these values, or manually copy the file so i can put it back rather than having to go through and reselect the ones i want.
Does anyone know how to do this?
I have tried to find answers on stack overflow already, and cannot find any, i have search google and also come up empty, i am really stuck

The way i have got round this is by upgrading to VS2010 or VS2012, as the export settings saves the exceptions list, which vs2008 didn't seem to do that.

Related

Observing a question mark sign (?) on every file of a c# project after i reload the project [duplicate]

I often get blue question marks on files in my VS2012 Solution Explorer when opening a solution bound to Perforce through P4VS.
Looks like something is having trouble to "synchronize" with the depot/workspace/whatnot. Hitting "Refresh View" always solves the issue but I'm growing tired on doing this everyday:
This is my VS version:
Microsoft Visual Studio Professional 2012
Version 11.0.61030.00 Update 4
And P4VS:
2014.1.85.4506
This is persistent across P4VS versions for a few months now, and seems to be affecting sometimes individual files, sometimes entire projects, with no apparent pattern.
How can I diagnose what's going wrong, be it a server issue, a VS issue, a workspace issue?... The Perforce Source Control output shows nothing special.
Actually it's not entire folders, it's entire projects. It appears that even if refreshing a project "fixes" the issue for one run, re-opening the solution brings it back. Whereas I think that for individual files, refreshing them solves the issue once and for all. I'll play with it a bit more to confirm that.
To help diagnose what is going wrong you should probably turn on logging, and check the preferences that will show everything in the output window. For the P4VS log, go to:
Tools- > Options -> Source Control -> Perforce - Logging
(This is not the same thing as the Visual Studio Activity log.)
There could be a possibility that you are getting disconnected and refresh reconnects you. I am not sure if you have your connection set to use solution-specific settings, since you did not mention the connection dialog coming up.
This "solved" the issue for me, at least for the entire projects that went blue-question-marked:
1) Tools > Options
2) Source Control
3) Perforce - General
4) Tick the option "Treat Solution/Project as directory when
selected"
Not sure why but that's one less annoyance for me every day. Thanks to Perforce support for suggesting that.
The file is probably not marked for version control. I noticed this icon in one file and opened Perforce to check. For whatever reason, this file was not marked for add in Perforce. After marking the file for add and submitting, the blue question mark went away.

Visual Studio 2015 not automatically adding asterisk for multiline comments

When typing multi-line comments Visual studio used to add an automatic asterisk to each new line of the comment as I press enter(apparently 2015 does not do this anymore). I really liked this. As of right now though, if I type "/*" and enter, Visual studio does not try to autocomplete it at all. In fact, it even lets me end the comment with "*/", too, instead of doing it for me. So my question is: is anyone else experiencing this? How do I get the original functionality back, so each new line is automatically prefixed with an asterisk, and closed for me by "*/"?
I already checked and yes, my environment settings are set to C# and yes the option "Generate XML documentation comments for ///" is indeed checked in my settings.
This is a well-known problem, the feature fell by the way-side in the Roslyn refactoring of the C# Editor Features. Nothing to do with config or a change of preferences, it simply was not implemented.
It is currently being tracked by this Github issue. Status is "Up for grabs" right now with nobody having shown an interest in grabbing it yet as of today. Afaict, best to not hold your breath for it, I think they have several bigger fires to put out. It will surely be delivered in an update sooner or later.
Just wanted to update and say that this problem was apparently fixed(sort of) in one of the newer updates of Visual Studio. The editor still does not complete the comment for you, but it does at least keep the formatting consistent, and adds an asterisk to the next line for you.

Visual Studio 2013 catching unhandled exceptions

Some days ago our new Visual Studio 2013 copy was sent to us.
I was working with 2010 before, and after working with 2013 for a couple of days, I really like it, but now I've found something really annoying. Have a look:
Well, my Visual Studio is in german language, but I think you can get what is happening.
What I am wondering is why VS says I've got an unhandled exception. What other than putting a try catch around this I can do to handle the exception?
This is just an example. My real code is a bit more complex, and the try/catch is located some levels above this piece of code.
I can not remember VS2010 behaving like this.
I had a look in the exceptions settings, but I did not change anything there, so I'm using default settings:
What I am wondering is why VS deals with this code as if it were unhandled, when as you can see it is not. That's why I do not want to change anything in my exceptions settings. Do you have any ideas or suggestions?
It's helping you. At runtime you would get the expected result ie. it will go to the catch block.
Disable all exceptions in the options and VS will ignore all your exceptions and let the code catch them.
EDIT :
You should expand the lists as they will contain checked items even if the parent/group checkbox is unchecked.
so i tried Alex his hint, to uncheck the Exception in the dialog.
After unchecking the Exception my code acted like it runs outside the VS debugger.
But i was not happy with the statement
The setting is 'global'. It will ignore the exception from then onwards
So I went on with some researches.
I put some unhandled IOException throwing in my code. VS broke at the line of throwing the exception, what i was wondering about, because i unchecked the said point. Watching VS dialogs i figured out that they were not completly the same, they have a smal difference.
One said (as my VS is in german i transalted it to english by myself, maybe the text is quite a bit different in real): IOException was not handled - this is the unhandled IOException after unchecking the item at the Exception dialog.
The other said (translated by myself again): IOException was not handled by usercode - this while the item is checked in Exception-dialog.
So what is the difference between code and usercode?
I went to google for some research, i found two very importand sites. First explains the meaning of the ExceptionDialog. I do not quote anything, because all informations on this site are notable.
ExceptionDialog explained
Now let us know how VS is detecting usercode. Therefore i found the secound site:
usercode
With all these informations i did these experiments:
Delte .pdb file of the dll containing activateCommunication() -> VS did not break
Put pdb back again, unchecked "Enable the Visual Studio hosting process" -> VS did not break
Well, it is a bit more clear now. What i am still wondering is why with hosting process enabled, VS breaks, even if i have handling code. Maybe there is some debugCode around calling my method that might be seen as the "system code" mentioned on website one!?!?
Well, thats what i found out.
Greetings
Ronny

Stop Visual Studio 2010 from Spamming My Documents

I have Microsoft Visual C# 2010 Express edition, and every time I open it it makes a new folder in My Documents. Problem is, I want to reserve My Documents for, you know, actual documents. I managed to redirect most of the stuff in the folder into another place by changing the settings, but a folder called StartPages stays, no matter what. After some research I found I have to change something in the registry, which I can't seem to find. I researched into that and apparently I need to create a new Setup Project or something, which I also can't seem to find. I have no idea what I'm doing at the moment, so any advice would be appreciated.
(I have a bit of OCD when it comes to organizing my files the way I want, so if I can't get this to work I might go crazy). Thank you.
Go to Options in the Tools menu, select the Projects and Solutions -> General option group. The top item in that group of options should be the default project location. Change that to wherever you want your projects to go by default.
You might also need to change the other two directories in that option group.
This is based on VS2010 Pro version. If it's not there in Express, let me know and I'll have another look at it.
--
Except you've already done that. Sorry, wasn't paying attention as well as I should be.
If you can't find the registry entry to change, you could try turning off the Start Page completely. Personally I've never found it useful, so I turned it off shortly after installing VS2010.
In Tools->Options->Environment->Startup change the At startup option to Show empty environment. This disables the Start Page functionality, which also stops VS from executing the code that is creating the StartPages folder.
The registry path for Express editions is different to the Pro edition, and I don't have a VS2010 Express installed here at the moment to look at. Try searching for the value VisualStudioLocation in RegEdit, and change any value in that registry key that uses %USERPROFILE%\Documents to point to somewhere else.

Visual studio not updating project immediately

I have a very odd situation where by changes committed to the repository by my colleagues when updated to my local copy of the software, Visual studio doesn't recognise them immediately, and reload. the result (and this is very odd) is that most of the times, I will save my changes without the reloaded projects and will overwrite my colleagues changes. It is so embarrassing that sometimes I am asked why I had to change a piece of code and in reality I hadn't.
Another thing is, when I check in some VS project level changes like when someone added a new class, or form or anything and continue to work in Visual studio, it will take me at least 5 to 10 minutes before I get the warning that there was some changes and be asked to reload the project etc...
I think there should be a setting somewhere in visual studio to trigger an automatic reload, but can't find it.
This affect me and another person so far but mine is the strangest as it can take up to 30 minutes before a project start reload.
Any Ideas welcome
This is my settings
If you are working using Source Control, you will need to synchronise your local workspace with the server ("get" the latest code) before any changes by your colleagues will be copied to your PC.
If you don't "get" the latest code before you make changes then you may have to merge your changes with somebody else's, which can be a difficult, time consuming or even dangerous process - especially if you use the default Visual Studio automatic merge process, which usually does the wrong thing, resulting in essentially corrupt code (making it look like you deleted your colleague's works, just as you are describing, for example).
The best way to work with source control is the "little and often" approach:
Get the latest source code before you start any new work, so that your PC is as up to date as possible.
It's usually a good practice to "get" the latest code frequently (e.g. I do it first thing every morning) so that any merge conflicts are flagged up and dealt with as early as possible. The longer you wait before merging the worse the merge process tends to get. (Caveat: Check with your build system that the current version of the code on the server is working before you get it - you don't want to get broken code onto your PC as it may stop you being able to work at all).
Arrange your work as many small incremental steps that can be safely checked in as they are completed (rather than working for 3 months on hundreds of files and then dumping it on the system as one massive change )
When you are ready to check in, get the latest code, rebuild, and re-test your changes to be sure they still work when integrated with the latest program code. Only check in if everything works well.
Also be aware that when you try to edit a file, the source control provider may automatically "get" the latest version of that file for you (which could cause Visual Studio to tell you it has reloaded the file, and perhaps explain why you say it sometimes takes a while to "update", as it doesn't happen until you start editing a new file that has been changed recently by someone else). If this is the case, then the truth is that you have not "updated" the entire set of source code, only one file - in this case you really need to get all the latest changes to the source code (if you don't you may find it is uncompilable or (even worse), compiles but exhibits undefined behaviours due to only part of the code being up to date)
Lastly, a very good practice when checking in your code is to go through the list of files you are checking in and diff them one by one against the latest server code to see what you have changed. This may sound laborious but it confers several benefits:
It reminds you what you did, which can sometimes be helpful for filling in the check-in comment to clearly describe all your changes and make sure you don't miss an important note.
You will easily spot anything that has been screwed up in the merge process - there will be chunks of code that appear to be created or deleted that you know you didn't touch. So you'll be able to discover and fix these problems before you check in rather than annoying your colleagues by "deleting" their changes.
I find this very useful for finding temporary debugging code that I have forgotten to take out before I check in.
Sometimes you may even do a double-take on a bit of code you are about to check in and think "huh? why did I do that?". And then you might decide to re-examine and possibly even rewrite the code you thought was good to go.
Final Note: The options you show in your edit only relate to changes that are made to the files on your PC by another program on your PC. If another user makes a change and checks it in to source control, these options will have no effect. It is only when your Source Control system copies those changes to your PC's hard drive that you might see Visual Studio reacting to those changes (depending on how well your source control system is integrated with VS).
If you're sure the problem is Visual Studio (e.g. the file really has changed on the disk but you don't see it in Visual Studio)
Make sure that the Detect when file is changed option is checked.
Tools > Options > Environment > Documents > Detect when file is changed outside the environment
Since you are sometimes getting an alert to reload your project due to external changes means you already have the settings required to detect file changes in Visual Studio.
However, reloading of project/solution will only be triggered if the .csproj (or .vbproj) or .sln file was changed.
By the way, are you using some version control system? It seems that you are just sharing the solution and editing simultaneously.

Categories

Resources