Visual Studio Intellisense describing the property/method not working - visual-studio

I was using Visual Studio 2012 and it used to give the description of a property/method, which doesn't seem to work in VS2019. Is there an option that I will have to enable for this to work?
Below screesnhot is an example of File Input/Output operation:
When I scroll/hover over ios::app, it should give a description "Append to the end of the file" which it does not.
Second concern is that it is giving me a lot of other options as well (marked as * in VS). Is there an option to disable that permanently?
Final concern is that, when I hover over a function, it will display the parameters that the function is expecting (Or list of suggestions if the function is overloaded). But for some reason, in the below case, it is displaying along with namespace. Is there an option to disable that?
public static constexpr std::_losb::_Openmode std::_losb::app = (std::_losb::_Openmode)8

Related

Is there a keyboard shortcut to enable/disable "Common Language Runtime Exceptions" in Visual Studio exception settings?

I find myself enabling and disabling the "Common Language Runtime Exceptions" checkbox in Exception Settings with considerable regularity. I'm tired of having to open the window every time. Is there a keyboard shortcut?
EDIT: as the answer as of June 2020 appears to be "no", I've requested a feature here: https://developercommunity.visualstudio.com/idea/1073035/keyboard-shortcut-to-enabledisable-the-common-runt.html
Is there a keyboard shortcut to enable/disable “Common Language
Runtime Exceptions” in Visual Studio exception settings?
I think there is no such quick shortcut to do that.
Actually, the shortcut for the Exception window is Ctrl+Alt+E, you can call such window by that.
However, VS only has a shortcut key to open a window, and there is no shortcut key to enable or disable an exception, and there are many different types of exceptions in the exception window. So it can be a bit difficult.
So you should use shortcut Ctrl+Alt+E to open Exception and then set the exception manually.
Besides, if you still want that feature to have a keyboard shortcut to enable/disable Common Language Runtime Exceptions, you can suggest this feature on our User Voice Forum.
After that, you can share the link with us here and anyone who is interested in this feature will vote it so that it will get more attention from Microsoft.
It is managed by the DebuggerServiceHelper class in VSDebugCoreUI.dll:
ExceptionSettingsBatchOperation{_operationDepth=3} DebuggerServiceHelper.BeginExceptionBatchOperation()
DebuggerServiceHelper.UpdateException(EXCEPTION_INFO150{bstrProgramName=null, bstrExceptionName="Common Language Runtime Exceptions", dwCode=0, dwState=16418})
ExceptionSettingsBatchOperation.EndBatchOperation()
But these are all internal classes and not easily accessible from external code.
Another approach is to find this WPF CheckBox on screen (by the TextBlock following it with the given Text property) and click it programmatically.
I really wish Exception Breaker worked for later versions of Visual Studio.
In combination with this answer to a similar question, I was able to get something to work. It is not ideal, but you might give this a try.
Note: I am using Visual Studio 2019
Tool required
The free version of the Visual Commander extension that allows Visual Studio macros in later versions.
Note: I tried (a little) to use the Macros for Visual Studio extension, but with no luck
Steps
Using Visual Commander, add a new command with the code below, save and compile.
Run with one of:
Run directly from the Visual Commander UI
Modify a toolbar and add the Extensions/Command01 command to it
Add a Keyboard shortcut via Options and select VCmd.Command01
Code
Notes:
I tried toggling the <All Common Language Runtime Exceptions not in this list> item, but did not have luck with it.
I tried looping through all of the Exceptions in the group but it was really slow (i.e. 15 seconds :-( ) so I picked the most important exceptions for my project.
I was unsuccessful finding a away to toggle the parent Common Language Runtime Exceptions, but if you find it, please leave a comment.
using EnvDTE;
using EnvDTE80; // DTE2 type
using EnvDTE90; // Debugger3
public class M : VisualCommanderExt.ICommand
{
public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
var lDebugger = DTE.Debugger as Debugger3;
var lExceptionSettings = lDebugger.ExceptionGroups.Item("Common Language Runtime Exceptions");
// Use this Exception as the master toggle
bool lExceptionsEnabledToSet = !lExceptionSettings.Item("System.ArgumentException").BreakWhenThrown;
// 2 examples
lExceptionSettings.SetBreakWhenThrown(lExceptionsEnabledToSet, lExceptionSettings.Item("System.ArgumentException"));
lExceptionSettings.SetBreakWhenThrown(lExceptionsEnabledToSet, lExceptionSettings.Item("System.OutOfMemoryException"));
// This does not work to set the whole group on/off:
//lExceptionSettings.SetBreakWhenThrown(true, lExceptionSettings.Item("<All Common Language Runtime Exceptions not in this list>"));
// This is really slow
//foreach (var lExceptionSetting in lExceptionSettings)
//{
// lExceptionSettings.SetBreakWhenThrown(lExceptionsEnabledToSet, lExceptionSetting as ExceptionSetting);
//}
}
}

Visual Studio debugger - Displaying integer values in Binary

I'm using Visual Studio 2017 and I need to look at the binary representation of integer variables.
How can this be achieved from the Visual Studio debugger?
Type 'var, b' in the watch, for example:
According to the Visual Studio debugger documentation:
You can change the format in which a value is displayed in the Watch, Autos, and Locals windows by using format specifiers.
This note on debugging engine updates and compatibility is also worth noting:
When the Visual Studio native debugger changed to a new debugging engine, some new format specifiers were added and some old ones were removed. The older debugger is still used when you do interop (mixed native and managed) debugging with C++/CLI.
Although it mentions it can be applied to Autos and Locals windows, it is unclear how it is done as the variable names cannot be edited in those windows.
A <variable>, <format> syntax may be used in Watch and Immediate windows, like so:
Here is a direct link to the complete list of format specifiers.
Right-click the value it’ll show a menu list, but it only give us the option of Hexadecimal Display.
To display the variable with binary value in watch window, I suggest you write function to covert it :
The function that in my code is:
public static string ToBinaryString(uint num)
{
return Convert.ToString(num, 2).PadLeft(32, '0');
}

Search Value in VS2010 Debug Locals and/or expand all Nodes

does someone might know how to search for a value in the locals
in visual studio 2010
or at least how can I expand all nodes, subnodes?
if you record a macro on activating locals tools window on VS2010 it will generated this line of code,
DTE.Windows.Item(EnvDTE.Constants.vsWindowKindLocals).Activate()
after debugging this code and inspecting DTE.Windows'ActiveWindow when the active window is local I unfortunately couldn't find anything helpful, but give it a try and you may find sth helpful
if you just need parameters of a method you can use MethodBase.GetCurrentMethod() in System.Reflection namespace and it will serve you well by this private memeber
((System.Reflection.RuntimeMethodInfo)(currentMethod)).m_parameters
that you can read programmatically by reflection or just quick watch it
There are several items here that would let you do what you need, but you'll likely have to tweak the code first:
http://www.codeproject.com/info/search.aspx?artkw=quickwatch&sbo=kw

Debugging in Dynamics AX

I'm facing some troubles still while learning, so I guess it tends to get worse once I play with the big kids: warnings in dynamics aren't as precise and informative as VS's, there are no mouse-over tips, and exceptions to show me exactly where I've got it wrong.
I'm just too used to Visual Studio, it's intellisense and all the tools (dynamics is quite new when compared to Visual Studio)
More than solving simple code issues, i'd like to learn how to solve upcomming ones i might have in code not written by me or anything else i'd solve in 3 minutes in Visual Studio, as well as tips on how to survive in dynamics ax without all the Visual Studio tools.
The code editor in Dynamics AX has some intellisense, typing the name of a table or class variable followed by . or :: will give you a list of fields or methods available for that item. After you type the ( to start a method call, a tooltip pops up with parameters available on that method. When starting a new line, you can right click and List Tables, List Classes, List Types, etc. Most of those commands are also available via Shortcut Keys. Note that the intellisense only works if all the code in the method up to the location of your cursor is syntactically correct.
Make sure you have updated the cross reference in your development environment (Tools/Development tools/Cross-reference/Periodic/Update). With an updated cross reference, you can right click an any table, field, class, method, extended data type, or enum in the AOT and choose Add-Ins/Cross-reference/Used by to see where that item is used in the system.
You can also use Tools/Development tools/Code explorer to view the source to the application with all types, variables, and methods turned into hyperlinks so you can click to go right to the definition of that item.
Another useful tool is Application hierarchy tree, available either under Tools/Development tools, or on the right click Add-Ins menu. This will show you the class hierarchy, so you can easily see, for example, that SalesFormLetter derives from FormLetter, which derives from RunBaseBatch.
In the editor, you can highlight text and right click to Lookup Properties/Methods or Lookup Definition.
If you are trying to track down where in the system a particular infolog message is generated there are two strategies to use:
Set a breakpoint on the first line
of the method Info.add(). Then when
you run the code generating the
message, you will pop into the
debugger as soon as the infolog is
generated. You can then look at the stack
trace in the debugger to see where the code is that
generated the message.
Run Tools/Development
tools/Label/Label editor and search
for the text of the message. Select
the Label ID of the message, then
click Used by to see where that
message is used in the system.
There is also http://www.axassist.com/ which extends intellisense and many other extensions
What these guys said already is very interesting and helpful.
I'd like to add that within AX in real life you are probably working with multiple contexts. e.g. Code running in the client, code running in server, code running in p-code and in IL, COM integrations, Enterprise portal and so on.
My point is, if you want to figure something out through debugging, you must first understand where the code(s) you'd like to debug is running.
Knowing that is important because you might have to allow debugging or give permissions in multiple places.
Examples:
Windows AD debugging users (add yourself)
Allow debugging on client
Allow it on server
Disable IL if you want to use MorphX, otherwise attach the process in VS.
Allow World Wide Web Publishing Service to interact with desktop for EP.
One last thing, you are starting to work with ax right now, perhaps you will need to work with AX7(Dynamics 365 for Operations). This version of the system works only with visual studio. It is still x++, but you have a lot of the things VS provides you.
Take a look on EditorScripts Class,On AX Editor you can use it by right click and choose "Scripts". It is a kind of intellisense that can make by your self, for example: here is my in-line comment whenever I type "mycom" and press "tab"
public void template_flow_mycom(Editor editor)
{
xppSource xppSource = new xppSource(editor.columnNo());
int currentline = editor.currentLineNo();
int currentcol = editor.columnNo();
Source template = "//Partner comment "+date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll )+" at "+time2str(timenow(), 1, 1)+" by MAX - Begin\n";
template+=strRep(" ", currentcol)+ "\n";
template+=strRep(" ", currentcol)+ "//Partner comment "+date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll )+" at "+time2str(timenow(), 1, 1)+" by MAX - End\n";
editor.insertLines(template);
//move cursor to the empty line between the comments
editor.gotoLine(currentline+2);
editor.gotoCol(currentcol+4);
}

Is there something like Emacs' toggle-read-only in Visual Studio?

The subject says it all. Is there an easy way to toggle the editability of a buffer in Visual Studio? This would be similar to the toggle-read-only command in Emacs.
I am not looking to change the file attribute ... just whether I can edit the file while it is open in Visual Studio. I am using 2008 and 2005.
Why would I want to do this? I tend to have several files open at the same time .... for days at a time sometimes (perhaps a bad habit) and I have +/- a char or few here and there without meaning to or noticing ... also worried about "the cat walking across the keyboard"
Besides ... an "ancient" code editor like emacs has it :) and I grew to expect the feature.
TIA!
There is an extension for Visual Studio called CodeMaid that will give you a Read-Only Toggle per file.
http://www.codemaid.net/documentation/#andmore
You can download it at http://visualstudiogallery.msdn.microsoft.com/76293c4d-8c16-4f4a-aee6-21f83a571496
You can use this piece of vba
Public Sub ToggleReadOnly()
Dim doc As Document
doc = DTE.ActiveDocument
If (doc.ReadOnly) Then
doc.ReadOnly = False
Else
doc.ReadOnly = True
End If
End Sub
Note: the msdn documentation specifically mentions that the property ReadOnly shouldn't' be used explicit but I verified that this works for me on vs.net 2005.
I also verified that the actual file attribute isn't changed.
I'm not aware of anything that will quickly achieve what you're looking for. Furthermore, I'm not really sure why you would need such a thing. Typically I use subversion to tell me which files have been changed and where they have been modified that way I can revert anything that doesn't belong.
Can you expand on your question a little to let us know what your usecase is?
If you really need to toggle readonly....perhaps you can:
Right click on the file
Select Open Containing Folder
Right click on the file and choose properties
Check the readonly checkbox
Start Tools->Macros->Macro IDE. Add new module (described here in details) and define there procedure as follows:
Imports EnvDTE
Public Sub SwitchReadOnly()
DTE.ActiveDocument.ReadOnly = Not DTE.ActiveDocument.ReadOnly
End Sub
Assign macro to keyboard key(described here in details). That's all.

Resources