VS 2017 Quick Actions and Refactoring Issue - refactoring

I'm using Visual Studio 2017 Professional v. 15.0.0-RTW.
And when press ctrl + . to show Quick actions and refactoring menu on any unknown type it is no longer show using [Namespace] like before..
Is there any solution to this problem ?

I had the same problem. I fixed it with the latest update for Visual Studio 2017 Professional (v15.2).

One reason a class will need a full namespace is if the class name is also part of a namespace. So, in your case, if you have a directory called DbCommand in your project VS will need to use the namespace when referencing the DbCommand class - it is ambiguous as to whether the identifier DbCommand is referring to the class or the namespace.

Related

How To Use IntelliCode In Visual Studio?

I create the simple Windows Forms Application project in vs 2019 version 16.3.1 with target .NetCore 3.0.
when I'm trying to use the SqlClient in System.Data.SqlClient and use the open Method, Appears two open() Methods.
one of this method has * chars, that is IntelliCode Suggestion.
this image:
how to use IntelliCode Suggestion?
IntelliCode appends suggestions based on context on top of the suggestion list (with a star). In your case it means that based on the context you are the most common used property/method is Open(). Both Open methods in the list are the same.

Visual Studio 2015 IntelliSense not displaying all methods

I recently upgraded to Visual Studio 2015 from 2013 because for some reason 2013 would not work on Windows 10 for me, even after multiple install attempts.
The only issue is IntelliSense is not displaying methods from other forms. For example, when I start typing one of the names of one of my forms, the only thing IntelliSense displays is:
However, the form has dozens of public methods, and the IntelliSense worked fine before in 2013.
Interestingly, I can still call the method if I remember the name by manually typing it, i.e. Form1.TestMethod().
Does anyone know the fix for this? I am using Visual Studio 2015 Update 1.
I have the exact same problem and opened a support incident with Microsoft. They have verified per their answer below, that this is a bug with VS 2015 Update-1. We have a few computers running with just VS 2015(no update 1) that work just fine. I will pass along any further information that I receive from Microsoft.
Response from Microsoft:
"Yes this happens only with Visual Studio 2015 update1. It seems to
be a bug in VS2015 Update1, I am discussing with product team to fix
this issue.
If you just avoid using default instance of forms. Creating a form instance, storing it in a local variable or field, and passing those
references around is easy enough. It's also a much better practice
that will make your code stronger overall.
Dim f As New Form2
f.TextBox1.Text = "Hi"

Is there a way to create an Interface from an existing class?

I know it was possible in older versions, but cannot find it in Visual Studio 2015 Community.
Any tips?
Select the class and go to menu Edit - Refactor - Extract Interface.

Automatically run extension code in Visual Studio on startup

Can I create an extension for Visual Studio that runs in the background as soon as the user opens the Visual Studio IDE? For example, I am building an extension that gets the current active file address in Visual Studio (with C#), but I would like this extension to always run in the background without having to be activated by the user clicking a button or pressing some key combination.
Is this possible, and if so, what is the best way of doing it?
Any help would be greatly appreciated! Regards, Erfan
Since you tagged your question with visual-studio-2010 I assume you are working on an "Add-in" rather than a "VSPackage Extensions".
In this case, you can use the OnConnection event handler.
If you are working on a VSPackage Extensions, you can use the attribute ProvideAutoLoad.
Just search for these, you will find sufficient information. Both ways are also described shortly here under "How can I run my add-in code in a VSPackage?"
For Extension add following attribute to Package class, this will load the extension when a solution is not open in visual studio. I have tested this with VS 2015 and 2017.
[ProvideAutoLoad(UIContextGuids80.NoSolution)]
For VS 2010 and higher the recommended extensibility approach is a package (VS 2015 won't allow add-ins).
To get the package loaded when Visual Studio is loaded see HOWTO: Autoload a Visual Studio package.
Once loaded, your package may be interested in two different kind of selection change events:
To get notified when the selection in the Solution Explorer changes, get the IVsMonitorSelection interface and call the AdviseSelectionEvents/UnadviseSelectionEvents and provide a class that implements the IVsSelectionEvents interface.
To get notified when the active window changes (which can be a document window or a toolwindow), implement the IVsWindowFrameNotify interface.

View Derived Types option missing in Object Browser Settings

This MSDN article about how to display inheritance graphs in Visual Studio 2010 says there should be an "Show Derived Types" option in the Object Browser Settings and the Class View Settings. However, the option shows up in neither location in my copy of Visual Studio 2010 SP1 Ultimate. Does anybody know why and how to resolve it?
Edit
The original link is broken. Here is a link to the same article but for Visual Studio 2008 instead of 2010 (perhaps Microsoft removed the article for 2010 given that it doesn't work).
The issue is caused by the object browsing scope I selected in the Browse box. If I select Custom Component Set in the Browser box, I cannot find the “Show Derived Types” in the Object Browser Settings. But if I select the .NET Framework 4 , I can find the “Show Derived Types” in the Object Browser Settings. Which leaves me with the question of how do I see derived types for classes in my project?
Update: I've used Telerik JustDecompile (a free tool) to find derived types. However, since upgrading to Visual Studio 2015 (problem still exists) I've been using the Find All References (Shift + F12) on class constructors to help find derived types. This works well for abstract classes as calls only come from derived types, and a little more messy for non abstract classes (depending on usage).
This is not really an answer, as I cannot resolve the problem, but it allows me to include an image.
I can see derived types for mscorlib 2.0 but not mscorlib 4.0 (VS2015) when I set the scope to "All Components"; however, I can see them when I set the scope to ".NET Framework 4.0". This confirms Ɖiamond ǤeezeƦ statement that the issue is caused by the object browsing scope.

Resources