-
Notifications
You must be signed in to change notification settings - Fork 725
Description
Adding using statements for namespaces using ctrl-. seems really hit and miss. Sometimes it works. Sometimes it only suggests fully qualifying the type name. Sometimes it doesn’t work at all.
Environment data
dotnet --info
output:
.NET Command Line Tools (1.0.0-preview2-003121)
Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64
VS Code version: 1.3.0
C# Extension version: 1.2.1
Repro setup steps
Create a new .NET Core project and open in VS Code:
dotnet new
code .
Issue 1
Add the ASP.NET Core Kestrel package in project.json
in the dependencies node:
"dependencies": {
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0"
}
Open Program.cs
and start adding code to create a WebHostBuilder
:
var host = new WebHostBuilder
Hit ctrl-. to try to resolve the namespace for WebHostBuilder
or click on the lightbulb.
Expected behavior
Quick fix option to add a using statement for Microsoft.AspNetCore.Hosting
.
Actual behavior
While typing you only get the option to fully qualify the type name:
Issue 2
Add the following additional code to Program.cs
that uses the Run extension method that lives in a different namespace:
var host = new WebHostBuilder()
.UseKestrel()
.Configure(app => {
app.Run
Hit ctrl-. to try to resolve the namespace for the Run extension method
Expected behavior
Quick fix option to add a using statement for Microsoft.AspNetCore.Builder
.
Actual behavior
Issue 3
Create a Startup.cs file and add the following code:
namespace ConsoleApplication
{
public class Startup
{
public void Configure(IApplicationBuilder)
}
}
Hit ctrl-. to try to resolve the namespace for IApplicationBuilder.
Expected behavior
Quick fix option to add a using statement for Microsoft.AspNetCore.Builder
.