VisualStudio IntelliSense suggestion failure - visual-studio

I have a problem with IntelliSense and it is driving me crazy, I kept calm for 1 month but I can't stand it anymore.
IntelliSense keeps on suggesting things that are obviously incorrect suggestions.
Let's say I have a class called "PlayerModel" and a field/parameter of that type called "playerModel".
When I start typing "player" I somehow expect that the suggestions list will start with the field/parameter and not with the class, also given that the class obviously does not contain public constants or anything I might be using.
But this is not the case, IntelliSense gives me this every time:
Obviously I want to refer to the parameter and not the class.
This doesn't work also if I need to assign a value to a field.
PlayerModel anotherPlayerModel = player...
will also suggest the class instead of that parameter. So every time I need to manually select the second (and proper) suggestion.
Please help, I think this should be common sense. Thank you!
These are my installation package details:
Microsoft Visual Studio Community 2017
Version 15.8.5
VisualStudio.15.Release/15.8.5+28010.2036
Microsoft .NET Framework
Version 4.7.02556
Installed Version: Community
C# Tools 2.9.0-beta8-63208-01
FormatDocumentOnSave 1.0
NuGet Package Manager 4.6.0
ProjectServicesPackage Extension 1.0
Visual Basic Tools 2.9.0-beta8-63208-01
Visual Studio Code Debug Adapter Host Package 1.0
Visual Studio Tools for Unity 3.8.0.7
And this is my PlayerModel class: (ignore the Unity related stuff it is not relevant to the structure of the class)
using UnityEngine;
using static Constants;
public class PlayerModel : ObjectModel {
public int userId;
public int activeItemIndex;
public int kills;
public PlayerModel(int id, Vector3 position, Quaternion rotation, float hitpoints, int userId, int activeItemIndex) : base(id, ObjectType.PLAYER, position, rotation, hitpoints) {
this.userId = userId;
this.activeItemIndex = activeItemIndex;
}
}

Please try switching your locale--as a test--from 1026 bg-BG to 1033 en-US. So, first close all instances of Visual Studio, apply the locale change, then restart Visual Studio. I suspect that this might fix the issue. If it does then you can decide which international setting you want to continue to use...

Related

Unable to create Step Definition file from Specflow feature file on Mac

I successfully installed Visual Studio 2019 for Mac (community edition, version 8.10.14) and managed to install few other required extensions/packages for my work. These are Specflow, Specflow.NUnit, Selenium WebDriver & Server.
I added one feature file and unable to create step def for that feature file as there is no option i can see to create step def. I try and added a separate file (template is called 'specflow step definition' from right click on folder then add>new file) and it's like added sample step def for calculator sample feature. When i right click on steps in feature file it doesn't show an option to generate step defs.
This issue is only on Mac OS. The same project works perfectly fine on windows machine.
A cursory search for specflow visual studio mac seems to conclude that this is not yet available for MacOS versions of Visual Studio. On Windows, the SpecFlow extension for Visual Studio allows you to auto generate step definitions from a feature file. This does not appear to be supported on MacOs, but there is a feature request to add support.
In the meantime, stubbing out a step definition class isn't too bad. The basic shell is:
using TechTalk.SpecFlow;
[Binding]
public sealed class YourStepDefinitions
{
[Given(#"...")]
public void GivenX(...)
{
ScenarioContext.Current.Pending();
}
[When(#"...")]
public void WhenX(...)
{
ScenarioContext.Current.Pending();
}
[Then(#"...")]
public void ThenX(...)
{
ScenarioContext.Current.Pending();
}
}
The challenge is getting the regular expression right. Unfortunately, that requires knowing the step before creating the step definition.
See Step Definitions for more information.

Problems with running Xamarin for Visual Studio 2017

Okay, I've been searching and searching and it seems that people have somewhat similar scenarios concerning my problem, however, none of the solutions presented even offer a sound solution. I've recently installed Visual Studio 2017. I went on to test the Xamarin Android Emulator by creating an app (named "Try") with absolutely nothing on it. Mind you, this is a fresh install of Visual Studio 2017 with JDK 1.8.0_152 and Android 7.1.1 (25). Right off the bat, the build failed. I cleaned the solution and tried to build again. Fail.
I kept getting these errors:
Severity Code Description Project File Line Suppression State
Error error: <identifier> expected
package try.try; Try C:\Users\User\source\repos\Try\Try\obj\Debug\android\src\try\try\R.java 8
_______________________________________________________________________
Severity Code Description Project File Line Suppression State
Error error: class, interface, or enum expected
package try.try; Try C:\Users\User\source\repos\Try\Try\obj\Debug\android\src\try\try\R.java 8
_______________________________________________________________________
Severity Code Description Project File Line Suppression State
Error error: class, interface, or enum expected
package try.try; Try C:\Users\User\source\repos\Try\Try\obj\Debug\android\src\try\try\R.java 8
Great, so this has to have something to do with R.java 8? I go to the source and get this:
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package try.try;
public final class R {
public static final class attr {
}
public static final class id {
public static final int textureView1=0x7f040000;
}
public static final class layout {
public static final int main=0x7f020000;
}
public static final class string {
public static final int app_name=0x7f030000;
}
}
What is wrong here? I haven't even began to start coding or tinkering with Xamarin yet. Can someone please explain?
Figured it out. I don't know why, but Visual Studio 2017 put those project files in a completely different location unlike previous versions. Usually, it would have been put here: Documents>Visual Studio 2017>Projects>[Project Name]. It seems that the place you put your project is conflicting with Xamarin somehow. My suggestion would be to change the project location to what I mentioned above and then build the solution again. If that doesn't work, make a new project with the specified location and test it out. I had a similar problem and that fixed it for me.

VSIX doesn't register itself to Help/About window in VS2013

I'm trying to develop a VS extension using the Visual Adornment project template.
The extension is working on the experimental instance of VS (it simply adds a text layer on the editor window), but now I'm trying to add 2 features, with no luck:
Help/About entry for the extension
Settings page for some basic configurations
So I started to study some other extension to understand how they do that, taking as example this from Phil Haack Encourage.
No way I can get it to work. I created a class that inherits from Microsoft.VisualStudio.Shell.Package and I've decorated it with all the needed attribute to have the Help/About entry, without any success.
[PackageRegistration(UseManagedResourcesOnly = true)]
[ComVisible(true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[Guid("665d2c8c-0d47-42b6-ae34-e1db4ac2ed0f")]
public sealed class MyPackage : Package
{
public MyPackage()
{
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
}
protected override void Initialize()
{
base.Initialize();
Debug.WriteLine("Initialize MyPackage");
}
}
Not only the package is not registering, but the debug lines are not written at all, I cannot even step in with the debugger.
I took a look around the web, and any article I found sounds like this one, even following any single step, my package is not registering itself BUT, and it is the strange thing, the viewport adornment it's working as expected...
UPDATE:
I can add some details: it seems that during the build the .pkgdef file is not created at all in the debug folder, and it's not added to the VSIX file (if I open it with 7zip there's no .pkgdef)
No way I can get it to work. I created a class that inherits from Microsoft.VisualStudio.Shell.Package and I've decorated it with all the needed attribute to have the Help/About entry, without any success.
I didn't understand that part quite. You're supposed to use Visual Studio "project template" for "Visual Studio packages". That will create all the stuff necessary to build VSIX file. Start with that, if you already haven't.
By default, Visual Studio extensions(>=2013) don't load automatically. This took me few hours of debugging, but you're supposed to decorate your package with an attribute if you'd like to load when Visual Studio starts up. Alternatively, there's an option to load your VSPackage once a solution is loaded.
This is a peek of my package definition:
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[Guid(Guids.GuidMyStudioPackageString)]
[ProvideAutoLoad(UIContextGuids.NoSolution)]
[ProvideMenuResource("Menus.ctmenu", 1)]
public sealed class MyPackage : CommonPackage
Notice the [ProvideAutoLoad(...)] option. It says that load the package once visual studio starts.

Any FREE plug-in for VisualStudio that has partial code completion?

VS2010: one thing Resharper has is that in Intellisence when we are typing the name of a method it shows all suggestions that have the words we are typing somewhere in their name so for example if method name is DoSomethingReallyCool() and I am not aware of this exact name but I just type "Really" then the its intelliseinse is also showing DoSomethingReallyCool() as a suggestion. this help me A LOT for coding. I was wondering if there is any FREE plug-in with this capability?
Visual Studio 2010 does this now without a plug in.
Take the following excerpt:
class Program {
static void Main( string[] args ) {
}
static void ReallyCoolFunction() { };
static void SuperCoolFunction() { };
}
If I type Cool inside the main body, both functions show up in the intellisense list.
Doesn't VS2010 already do this? My copy seems to.
If not then The Productivity Power tools may be what does it on my version. If not then it's still a jolly fine add-in anyway.

Creating a Visual Studio Tool Window - VsAddin or VsPackage

Simple question - I found two ways to add a tool window to Visual Studio (2008): create an addin or create a package.
(Addin: http://www.codeproject.com/KB/dotnet/vstoolwindow.aspx)
(Package: http://msdn.microsoft.com/en-us/library/bb165051.aspx)
What's the "right" way?
You can do either, and I've done both. In some ways, addins are a bit easier, but they suffer from some annoying drawbacks.
Add-in:
+No requirement to install the Visual Studio SDK
+No requirement to use a Package Load Key (PLK) or sign your distributed binaries
+Easier development process when you use the Extensibility API (simplified code in many ways)
+Easier installation process (no wacky registry stuff)
-Doesn't seem to behave as well as VSPackage-based tool panes
-I've run into performance issues which prompted me to use the VS SDK COM interfaces instead of the Extensibility ones, leading to a significant performance bump. In other words, my "add-in" is now based on the VS SDK and is only really an add-in because it loads via an XML file instead of the registry. (Also, from everything I can tell, the Extensibility interfaces are just a large utility wrapper around the SDK.)
VSPackages:
+You can harness the full power of the VS SDK, both its feature set and (potentially, when carefully used) performance advantage
+Seems to behave more reliably than add-ins
-Requires signed binaries, a PLK, and a complicated installation procedure
-Steep learning curve, and many seemingly simple actions are nasty/convoluted. I now have an assembly providing extension methods to perform "obvious (to me)" actions on the COM interfaces. Between that and experience things have improved over time. There are similar options available to the community, which you should seriously consider if you go this route.
I think 280Z28 was perfectly correct prior VS2010. But now VS2010 and VS012:
Do not require officially signed packages (may only those that go to the Gallery have to);
Thanks to VSIX it can very easily install VSPackages that can also be deployed to the Gallery.
Moreover VS2010 supports another kind of extensibility: those are MEF extensions, that are lightweight plugins that trigger only at specific events of the IDE, like text editor events. An example is FixMixedTabs extension.
Just a create a VSPackage empty package (no menus, commands, ...) and copy this in the main class to create a VSPackage that basically loads when there's an active solution and just get a reference to the DTE2. In this way you can just use it as an Add-in.
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
// a package.
[PackageRegistration(UseManagedResourcesOnly = true)]
// This attribute is used to register the informations needed to show the this package
// in the Help/About dialog of Visual Studio.
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[Guid(GuidList.guidVSPackage1PkgString)]
// Load this package when a solution is loaded (VSConstants.UICONTEXT_SolutionExists)
[ProvideAutoLoad("{f1536ef8-92ec-443c-9ed7-fdadf150da82}")]
public sealed class VSPackage1Package : Package
{
/// <summary>
/// Default constructor of the package.
/// Inside this method you can place any initialization code that does not require
/// any Visual Studio service because at this point the package object is created but
/// not sited yet inside Visual Studio environment. The place to do all the other
/// initialization is the Initialize method.
/// </summary>
public VSPackage1Package()
{
Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
}
/// <summary>
/// Initialization of the package; this method is called right after the package is sited, so this is the place
/// where you can put all the initilaization code that rely on services provided by VisualStudio.
/// </summary>
protected override void Initialize()
{
Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
base.Initialize();
IVsExtensibility extensibility =
GetService(typeof(EnvDTE.IVsExtensibility)) as
IVsExtensibility;
DTE2 dte = extensibility.GetGlobalsObject(null).DTE as DTE2;
}
}
If you are just creating a simple tool window then I suggest going the Add-in route.
Both Packages and Add-Ins are ways of extending Visual Studio. Generally speaking they have the same functionality. Packages are a bit more powerful and allow deeper integration into Visual Studio. But that deeper integration comes with a cost including bigger ramp up times and installation procedures.
Add-ins are designed to be a more light weight extension mechanism. Smaller ramp up time and easier installation.
If all you are doing is tool window with basic interaction of the editor our code model then add-in is the best route.

Resources