Visual Studio Debug Intellisense Not Working - visual-studio-2017

I've just updated to Visual Studio 2017 (15.8.2) - after the update, intellisense when debugging isn't working. For example, if I hover over abc (screen shot) I get the same summary as shown in the Locals (abc count=7), however I can't expand the tooltip to show the property's of the object - as shown in the Locals.
Also when I hit a breakpoint and the scroll to another part of the file, I automatically get taken back to the breakpoint after a few seconds.
These could be settings that were turned on as part of the update, however I haven't been able to find any info on this. I've also reset all settings however I still experience the same issues.
Update:
After some further searching I came across this https://developercommunity.visualstudio.com/content/problem/321198/variable-datatips-dont-expand.html
Looks like an issue introduced in 15.8.1

Related

VS2022 Community crashes when adding Class to MFC Dialog

I am facing a very consistent and persistent problem with Visual Studio 2022 Community Edition.
In an MFC project I open the Resource File and add a new Dialog. Then I place some standard controls and rename the dialog resource from its default name to a new ID.
Then I save and try to assign a Class to the dialog by right-clicking on the dialog and choosing 'Add Class'. Then the 'Add MFC Class' window appears, I enter the Class Name and click [OK].
It appears it creates the class on the File System and then VS2022 crashes completely!
I have disabled all addins in case an addin could be causing the problem but it happens every (almost) every time even without plugins. The only time I manage to get it to work is if I save, close all code editors, exit VS2022, restart it and immediately try to add the class. Another piece of information is that I have changed the MFC dialog template with a different one but it does not seem to bother it when I get it to work. Also intelliSense is completely disabled.
How can I debug this and identify the root cause of this crash?
There's a fair chance that you can't do anything in an effective fashion. VS2022 isn't an open source project, where you can easily pinpoint a crash to a specific line of code and fix it yourself.
But the good thing is that you don't need to. Just use the feedback channel VS2022 provides:
Usually a Microsoft employee will reply within a few days and maybe a fix will be included in the next preview version. Only now and then it can take some month to get a bug resolved.

How to enable all suggestions in intellisense all the time?

I am quite new to Microsoft Visual Studio. I am using VS Community 2019. I want to enable all suggestions in intellisense all the time, how can I do that?
For example, I have a vector variable v2qPenLine which is a QVector<QVector<QPen>>. The vector variable is named in such a way so that I have easy access to it through intellisense. When I try to use it inside setPen() method (which is expecting a QPen but not a vector of QPen I guess) the intellisense does not suggest this vector:
To have it suggested, I need to click on the + button at the bottom and then it suggests the correct variable immediately:
This behaviour is not convenient at all. How can I change this behaviour of the intellisense so that it suggests only based on the name and do it all the time so that I don't have to click the + button at the bottom of the suggestion list? I think there should be a setting for this and so I tried to look up the settings of intellisense but I was unable to change this behaviour. I also couldn't find any reference to this on the internet.
I think it is a problem of your VS IDE Intellisense. And you can see that the Intellisense of your environment does have any info about variables, functions, classes ....on the first time. It should show all types on the first time. In your side, it only has the type of methods, quite strange.
Try the following suggestions:
1) disable any third party extensions under Extensions--> Manage Extensions-->Installed to check if there is an extension which caused that.
2) close VS, delete all files under C:\Users\xxx\AppData\Local\Microsoft\VisualStudio\16.0_xxx\ComponentModelCache
3) reset all vs settings under Tools-->Import and Export Settings-->Reset all settings
4) close Vs, delete .vs hidden folder under the solution folder and then restart your project to test again.
5) repair vs or update it if there is a new release version

Visual Studio's bug: editor tabs (code tabs) appear->hide->appear forever => non-responsive

I love to open many tabs (10-30) of .cpp and .h, so the tab are overflowed to the right, i.e. Visual Studio can't show named of all opened tabs at the same time. (which is ok)
When I pin a new tab or change Visual Studio resolution (resize its window), Visual Studio will try to determine which one should be shown and which one should not (that is what I think).
In rare cases (1%), Visual Studio fail to do so. After I pin a new code tab (e.g. .cpp), it loops forever. For example, in the image, it is possible that the last of the four tabs will appear -> hide -> appear -> ... so on (forever).
Visual Studio would try to update other GUI to match the appearance/disappearance of the tab (e.g. width of console pane ?).
Within about 1-3 seconds, if I don't resize the window, Visual Studio will become unresponsive.
I will have to terminate it, lose some of my work.
It is like a mini-game.
I am sure that is a bug of Visual Studio. Have anyone faced it?
(Please comment if you faced the same problem!)
I don't think it is related to plugin "Visual Assist" or "Resharper".
I always set my monitor to low-resolution (1280 x 720), but I don't think it is a problem.
Question: How to solve this swappy bug, or at least avoid/alleviate it?

How to disable autoclosing of a dialog-based MFC application in Visual Studio?

When I start the program, I get the dialog and everything. But it closes by itself after some 10 seconds. How do I disable that?
EDIT: This happens when I run "Debug -> Start Without Debugging". This is the only way I know how to run the program.
EDIT2: My dialog is inheriting from CDialogEx.
If your dialog is not modal, i.e. you are not firing it up using the DoModal() member function, it is possible that it is being created with the constructor, and deleted with the destructor as it goes out of scope. You see this type of behaviour with some implementations of splash screens. To figure out what is happening, put a breakpoint on your dialogs destructor, and look at the call stack that is leading to it. It is also worth turning on all exceptions in the debugger, as you could be getting hit with an uncaught exception that is terminating your app.
As others have already said, this is not normal behaviour for an MFC app.
Usually dialogs do not behave that way.
But in default, they close on OnOk (CDialog::OnOk) which is "Enter Key Pressed"
and OnCancel (CDialog::OnCancel()) which is "Esc Key Pressed"
Try overloading those two in your Dialog, to see if those get called and to handle
the behaviour there as you like it.
Perhaps the Close event should also be handled or watched.
here are lots of examples of what can be done with a Dialog (especially OnOk, OnCancel and Close) CDialog Examples
I was facing the same issue with Visual Studio 2013:
I was creating the most basic MFC application with the Visual Studio wizard (either dialog-based, Single/Multiple document based), and just recompiling the generated code. No modification to the code at all.
I just found out that the "restart" does not occur when I turn off my Anti-virus. :-)
This is not a bug in Visual Studio, it is an environment problem.
My anti-virus is Avast.
The solution for Avast is to turn-off the Deepscreen feature.
There, go to Settings / Active Protection / Deepscreen - and disable that.
More details could be found about this approach to the solution on Avast's forums, from this discussion:
https://forum.avast.com/index.php?topic=139935.0
Confirmed, this happens with Visual Studio 2010, and doesn't happen with Visual Studio 2008. That means all the negative votes were completely unnecessary. It's a default of Visual Studio 2010, I didn't change anything. Nor did I make any bug, because I explicitly said that I created a new application without changing anything.
Thanks for all the negative votes.
Just for the record, I tried this using Visual Studio 2010. I picked Dialog-based application and left all the other options at their default settings. Compiled both Debug and Release configurations, for x86 and x64. When launched using Start without Debugging none of the four executables terminated by themselves.
If this is happening for you I would assume you have some application running (in the background) that interferes with the expected behavior. Try setting up a virtual machine, install a clean Visual Studio and perform the same procedure again.

Visual Studio MFC Toolbar Editor icon order won't update

I've been trying to create a custom toolbar in a MFC project in Visual Studio 2010. I've been following the Sketcher tutorial in Ivan Horton's Beginning Visual C++ 2010. The problem I'm running into is that the toolbar doesn't update to reflect the order and spacing of icons I have created.
I've created a small screenshot to demonstrate the problem:
In the background is the visual studio toolbar editor with my desired toolbar configuration. In the foreground is the actual app, which does not reflect the spacing or order of icons I've designed. It does reflect NEW icons being added, and the icons work fine, but I just can't seem to get them to re-order or appropriately space themselves. They just append to the end in whatever order I create them.
I've tried the rudimentary techniques of restarting both VS and windows, but to no avail.
Any tips on getting it to play nicely? Lacking that, is there somewhere to manually view or edit the code generated by the toolbar editor?
For starters, if you create an MFC SDI/MDI project in VS.NET 2005, there is no such issue. It happens in VS.NET 2008 and 2010.
In fact, your rearrangement of the standard toolbar does takes effect. It's just not showing you the default state. To restore the state: click the small arrow button at the end of toolbar -> Add or Remove Buttons -> Standard -> Reset Toolbar.
Though I'm not 100% sure why it happens like this(design like this or a bug), there is a way to work around it and it works:
Add following code to the end of CMainFrame::LoadFrame(...)
BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
{
...
// Explicitly restore toolbar state
m_wndToolBar.RestoreOriginalstate();
return TRUE;
}
I recommend you to contact Microsoft support engineers as there's little resource on the web.
The reason could be that the toolbar state is already loaded from the registry whenever your application starts. So the framework reads the toolbar state and adds the new buttons to the end. Is there a Workspace key in your Registry and did you try to delete it anytime you make changes to the toolbar? The key should be at a location like HKEY_CURRENT_USER\Software\MyCompany\MyApp\Workspace
The values for MyCompany and MyApp are usually set in InitInstance. Always calling RestoreOriginalState() would break the code to allow user modifications to the toolbar.