I have writen a method such as:
/// <summary>
/// A method having xml-comments
/// This comment could be very long
/// </summary>
/// <param name="input">Input parameter</param>
/// <returns>Calculated value</returns>
int CommmentedMethod(int input) {
return Calc(input);
}
But when I use this method, Visual Studio (I'm using VS 2010) just show up "A method having xml-comments This comment could be..." not a full document.
Is there an option to show it?
Updated picture:
Thanks :-)
You can use Ctrl + Shift + Space key combination to view the parameter information.
In the following screenshot you can see the overloads, definition and parameter information being shown after clicing Ctrl + Shift + Space with the caret on Format method.
This works in VS2010 as suggested by an answer above. It works in VS2010 showing the entire string fully in tooltip. I suggest you retry in a fresh project again and rebuild the project and see. Intellisense normally uses the text for tooltip that it has used recently. So if you have not completed it on the first time and built it, its not going to show fully. Rebuiding the project should work though. Having said this, I just tried your code and it worked like a dream. So, Please try in a fresh project and see.
Use Quick Info (the tooltip that's shown when you hover your mouse over a method). This will display more than one parameter per line and therefore be able to display more parameters without truncating.
Set a smaller font or font size for tooltips. This can be changed by going to Tools->Options->Environment->Fonts and Colors, choosing "Editor Tooltip" in the dropdown at the top, and setting a different font and/or size.
P.S: However there is one problem if you have done so. Did you migrate from other version of Visual Studio and transfer settings. Because Visual studio has capabilities to import and export settings which you can include intellisense settings also. It may be something I'm not aware of, if you have done so.
Please install SP1 for VS2010 because that's what is solving the problem of truncating quickinfo else reduce font size as I have mentioned ! Hope this helps ! This works by all means and verified !!
If you use ReSharper you can press CTRL+SHIFT+F1. I don't think Microsoft has this feature.
The tooltip for VS2010 will show the entire contents. I just tested with a new install of VS2010 with no installed addins (Windows 7 pro).
You might try clearing the Automatically adjust visual experience based on client performance flag in the Options... dialog General section and then checking Enable rich client visual experience. The documentation on exactly what this provides is vague, but I suspect this could affect the tooltip display.
Related
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.
The C# code formatting in Xamarin Studio (i.e. when hitting Ctrl-I to format the document) puts end of line comments onto a new line. I can't find any way to change this in the C# code formatting policy settings. How to change this to preserve end of line comments on the same line?
For example, take this code:
public class Foo
{
int bar; // comment
}
If I hit Ctrl-I (or alternately click Edit > Format > Format Document from the menu, or select the code and click Edit > Format > Format Selection from the menu), the code is reformatted as:
public class Foo
{
int bar;
// comment
}
I'm using v4.2.2 build 2 v4.3 build 52 on OS X.
Note: it seems this is a bug. So my question really is -- has anyone who has also encountered this come up with a fix or workaround and if so what is it?
I don't think there is a real answer to this question, as you have said its a bug in the version you are using.
UPDATE: We have discovered that this is not a bug in the software. As it affects all versions the OP updates to, most likely there is some setting or extension affecting the outcome.
A work around although you may not be to happy with it would be to place you comments above the line in question. This is a perfectly acceptable way of code-commenting.
public class Foo
{
// comment
int bar;
}
Using version 4.3
Pre Ctrl + I
Post Ctrl + I
As a final note you may want to view your code formatting preferences found here:
UPDATE 1
You could try resetting all your preferences by deleting everything in the following folders, see here.
I will add that I haven't tried this so could break your installation.
Just tested and this doesn't break Xamarin Studio and does reset all preferences.
~/Library/Preferences/XamarinStudio-4.0/
~/Library/XamarinStudio-4.0/
UPDATE 2
The only last thing you can try as we have found out this isn't a bug in the software but something on your computer. Is to do a full removal of Xamarin Studio. I recommend using AppCleaner as it will search for any related files and remove them.
Onces it has fully uninstalled, then reinstall Xamarin Studio.
UPDATE 3
Last solution, try creating a new user account. Run Xamarin Studio under that account to see if the problem persist. If it does the only thing left to do is a fresh install of OS X and reinstall Xamarin Studio first. The problem should be gone now... reinstall all other applications checking that nothing has broken Xamarin Studio after each install.
This has been acknowledged as a bug by Xamarin. See this bug report. In that report, Xamarin says it's replacing its entire formatting engine as of mid-2014, with the hope of having it in place by "next year." Xamarin further suggests avoiding the problem by turning off auto-formatting on save, suggesting there is no official fix or workaround at this time other than avoiding the issue.
I have the following code in a view model:
public Point Location
{
get
{
var rangePixels = Range * PixelsPerMile;
var xCoordinate = OwnLocation.X * MapScale + rangePixels * Math.Cos(Theta);
var yCoordinate = OwnLocation.Y * MapScale - rangePixels * Math.Sin(Theta);
return new Point(xCoordinate, yCoordinate);
}
}
One of the usings at the top of the code file is System, which contains Math.
If I view Math.Sin(Theta) in the Watch window (by selecting the code, right clicking, and choosing "Add Watch"), I get the following error:
The name 'Math' does not exist in the current context
What I want to know is:
Is this expected/default behavior for Visual Studio 2010? I could swear this never used to be a problem, but maybe it's always worked that way and I somehow never noticed.
If it's not normal to get this error, any thoughts on what the problem could be? There are a million settings in Visual Studio, and I wouldn't know where to begin.
I should note this question is vaguely similar to this, but I'm not having any issues mousing over my local variables, and I'm not using PostSharp.
Edit
I just tried resetting all my Visual Studio settings backs to default, and I'm still getting the same error. If someone wants to try a simple test in Visual Studio, I just want to know if you get an error if you add a watch for Math.Sin(1).
Edit 2
Here are a couple screen captures to show what I'm experiencing:
Edit 3
Interestingly, intellisense works if I type Math. into the Watch window, but if I complete the expression, I still get the error:
Edit 4
To address BACON's questions:
I get the same behavior with QuickWatch and Immediate.
Closing and reopening all the windows does not solve the problem.
I'm using Visual Studio 2010 Professional (version 10.0.40219.1 SP1Rel)
I tried targeting .NET 4.0 Client Profile and full .NET 4.0. Made no difference. I created a Console App (rather than a WPF app) targeting .NET 4.0 Client Profile, and finally, the error did not occur. So, WPF may be an issue (or WPF with some third-party libraries). (Will check on that next.)
It appears that the culprit is a third-party library that performs IL weaving (Fody.PropertyChanged).
If I create a new WPF project without this library, I'm able to use Math.Sin() in the Watch window. Once I install PropertyChanged, I start getting the "not available in this context" error.
Thanks to #BACON for leading me down the right path to figuring this out.
Here's a link to an issue I posted on the PropertyChanged site:
http://code.google.com/p/propertychanged/issues/detail?id=6&thanks=6&ts=1330494634
Edit
And subsequently, it turns out this is probably a bug in Mono-Cecil, which PropertyChanged uses:
https://github.com/jbevain/cecil/issues/90
I did this in a litte test app, in the constructor..
Trying to put a watch on Math lets me see the values of E and PI.
You cannot put one on Sin.
Putting one on val works just fine.
So, no, I don't think that it's quite normal, unless you clicked on the wrong name. I.e., not the variable, but the "Sin" portion...
Here is where I highlighted the entire thing...
Weird problem, started with migration to Visual Studio 2010.
Some forms, when opened, will have some objects' properties set to a string that is empty in resource file. Most often these are control properties like ImageKey, ToolTipText and for UltraGrid some columns get columnX.Header.Caption set to that string. This will obviously remove set images and give wrong column header texts in other locales. Additionally tooltips will show up in weird places (like tab panel body).
This string (strSaveInterestDetails8 below) is empty in Strings.resx (<value />), but not empty in Strings.fi.resx. When I changed this string to have a space, designer started to use an other "empty" string from Strings.resx..
These forms are all derived from common base, but it does not have anything special/suspicious. Debugging these from additional devenv instance failed, since the debugger never broke on the set breakpoints (thrown exceptions in internal VS code were caught).
example:
ultraGridColumn23.Header.Caption = global::Company.Module.Properties.Strings.strSaveInterestDetails8;
...
this._timespanCheck.ImageKey = global::Company.Module.Properties.Strings.strSaveInterestDetails8;
...
this.tabPage1.ImageKey = global::Company.Module.Properties.Strings.strSaveInterestDetails8;
this.tabPage1.ToolTipText = global::Company.Module.Properties.Strings.strSaveInterestDetails8;
So has anyone run into something similar or has better google-fu?
This is a long standing bug in Visual Studio. Microsoft is aware of the issue, but still no fix. You can vote up the issue here:
https://connect.microsoft.com/VisualStudio/feedback/details/683661/windows-forms-designer-cs-files-corrupt-after-changing-language#tabs
I'm having the same problem, but with VS2008. However, a VS2010 Web Developer Express version is also installed on my system (since a couple of months). First, I was developing in a project that uses multiple language resources and then I opened up another VS solution to change something on a form. The Windows Form Designer replaced all the empty strings in the Designer.vb file with a string resource identifier from the first project!
I could solve the problem by closing Visual Studio and reopen the solution.
In our experience, this is usually a bug caused by the presence of the text string
<value />
in the xml of a resx file. When you edit and save the form designer, all the empty strings "" in the designer file get mapped to the key associated with this self-terminating node.
Theses spurious <value /> entries sometimes appear if you start building a project while the resource editor has still got the flashing cursor in the 'new row' line, and there is no text associated with the key.
Search the project for <value /> and eliminate them from the resx files. Then clean and rebuild the project, (which will fail), then fix the compile errors by replacing them with ""
Hope this helps.
I think this will work for you. Check the accepted solution.
Or maybe this.
I am currently developing with VisualStudio 2008. I find it increasingly difficult to find files when the number of files and projects increase. The situation become so bad that I literally have to spend 10-20 seconds to find code I want to work on when switch between files. Sounds like not a lot of time, but this can be very annoying because it breaks the "coding flow".
I believe this is a general problem with all IDEs. But I still find it easier to work with Eclipse. One particular example is that in Eclipse, I could apply some key shortcut to find implementations defined in an Interface.(I have forgotten which key shortcut though, after not working with it for about 1 year.) Another example is that in VS 2008, rightclick->Find all references will find all occurrences containing the selected text(Update: This accusation is incorrect. Thanks for pointing it out); while similar operation in Eclipse will find all occurrences where the selected class/variable are referenced. Personally, I find the Eclipse way is better for file navigation.
This could be due to my inexperience with VS IDE. So, I am looking for suggestions to improve the file navigation experience so that I can get some more time for actual coding.
I have used the navigate buttons but they are only useful for small number of files.
Thanks.
I agree wholeheartedly about ReSharper. If you don't want a "paid" solution though, a useful Visual Studio shortcut is
CTRL + ,
it gives a list of recently edited files.
CodeRush is a free alternative to ReSharper which you might find useful too.
Kindness,
Dan
Have a look at Jetbrains Resharper. Ctrl N or Ctrl Shift N. To jump quickly to files by type name or by file name. Also you can control Click Classes to navigate to them instantly.
I can't even work in visual studio without it anymore. It virtually eliminates the need for the solution explorer
SamTools for Visual Studio 2005/2008 (and I have a build for 2010 if someone needs it). The particular feature that's handy here is the Solution File List.
You can right click the tab of any open document and Find In Solution Explorer or Show In Windows Explorer
You can right click in the Solution File List for the same
Unlike other solutions to this problem, this is a properly docking tool pane so it fits in great. Ctrl+Alt+F places you in the Filter box with the current text selected, so it's very easy to work with.
Oh and it's free/GPL. :)
Solution File List http://wiki.pixelminegames.com/images/8/88/SamTools_SlnFileList.png
Dpack is also a free alternative with some nice file navigation shortcuts, but Resharper is the bomb.
BTW, they should have some more of this stuff in vs2010, which is in beta right now (I think)