Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using statements not showing up for ctrl-. #1785

Closed
danroth27 opened this issue Oct 9, 2017 · 8 comments
Closed

Using statements not showing up for ctrl-. #1785

danroth27 opened this issue Oct 9, 2017 · 8 comments

Comments

@danroth27
Copy link
Member

I'm still seeing issues with using statements not showing up in the lightbulb menu for new .NET Core projects

Steps to reproduce:

  1. Install .NET Core 2.0 SDK
  2. dotnet new console
  3. dotnet add package Microsoft.AspNetCore.All
  4. In Program.Main type WebHost and try to resolve the using statement for WebHost.

Expected result

  • Lightbulb to add using Microsoft.AspNetCore

Actual result

  • No helpful lightbulb to add the using statement
  • Waiting doesn't help

Workaround:

  • Closing and reopening the folder causes the using statements to start to show up
@DustinCampbell
Copy link
Member

Could you clarify your repro steps for me?

  • What OS are you running?
  • At what point did you open your project in VS Code? Between #2 and #3 or between #3 and #4?
  • Did you type the commands at a command project or using VS Code's integrated terminal?

@danroth27
Copy link
Member Author

OS: Windows10

I opened the project in VS Code after step 3

I typed all commands at the command prompt.

@DustinCampbell
Copy link
Member

When I performed the repro steps, I get a slightly different experience.

  1. After opening the project in VS Code, I get a message stating that there are unresolved dependencies from 'test.csproj'. Do you see this as well?

    image

    I went ahead and clicked restore.

  2. I typed "WebHost" in Main, and I did get a light bulb, but it did not have a suggestion to add a using statement. Are you seeing the same thing? From your repro steps, it seemed like you weren't seeing a light bulb at all.

    image

  3. After restarting VS Code, I see the add using statement lightbulb as you described.

Is this the same experience that you're seeing?

If so, I believe there are two things happening here:

  1. dotnet add package does not do a package restore (by design), and you should perform one after adding a package in order for MSBuild (via OmniSharp) to resolve references to defined in the package.
  2. There's a bug where OmniSharp doesn't update references with the project.assets.json file changes after a dotnet restore. This is After i add some nuget package, I can not the code intelicense immediately unless i restart the Visual Stuido Code  #1583.

If I'm correct, I think this might be a dupe of #2 above.

@DustinCampbell
Copy link
Member

Also: #1661

@danroth27
Copy link
Member Author

Yup, your experience accurately describes what I am seeing. Sorry for the lack of clarity on my part!

@DustinCampbell
Copy link
Member

No problem. Thanks for taking the time to report the issue.

@DustinCampbell
Copy link
Member

This issue has been fixed in the 1.14 milestone. We just released our first beta of 1.14 if you're interested in giving it a spin. Follow these instructions to a beta release of C# for VS Code.

@Thaina
Copy link
Contributor

Thaina commented Jan 5, 2018

Still got this issue in beta2. vscode 1.19.1

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants