question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quick Fix (Ctrl + . ) Issue - Doesn't show required namespaces

See original GitHub issue

Environment data

.NET Command Line Tools (2.0.0)

Product Information:
Version:            2.0.0
Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.1.7601
 OS Platform: Windows
 RID:         win7-x64

Base Path:   C:\Program Files\dotnet\sdk\2.0.0\
Microsoft .NET Core Shared Framework Host
Version  : 2.0.0
Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

VS Code version: 1.9.1 C# Extension version: 1.7.0

Steps to reproduce

Install NET Core SDK 2.0 Create angular project using dotnet core cli ( dotnet new angular ) Open project in Visual Studio Code 1.9.1 Install C# and C# extensions Start Omni sharp if not already started

C# Intelligence works in Visual Studio Code. Quck Fix (Ctrl + .) doesn’t work, It doesn’t show required namespaces after hitting (Ctrl + .)

Expected behavior

Quck Fix (Ctrl + .) should show required/missing namespaces after hitting (Ctrl + .) For ex.

public ICollection<Project> Projects { get; set; }

When cursor is on ICollection keyword, if you will press Ctrl + .
Quick Fix should show “using System.Collections”

Actual behavior

After hitting (Ctrl + .), Quck Fix doesn’t show required namespace suggestion. Build is successful. OmniSharp is also running fine. C# Intelligence is working fine. No error in problem pane

Note

I am behind the proxy.

OmniSharp Output

Starting OmniSharp server at 9/21/2017, 1:32:56 PM
    Target: d:\Development_Avecto\OneR\OneR.sln

OmniSharp server started
    Path: C:\Users\379212\.vscode\extensions\ms-vscode.csharp-1.7.0\bin\omnisharp\OmniSharp.exe
    PID: 7428

OmniSharp: -s d:\Development_Avecto\OneR\OneR.sln --hostPID 7228 --stdio DotNet:enablePackageRestore=false --encoding utf-8 --loglevel information formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
[info]: OmniSharp.Startup
        Omnisharp server running using Stdio at location 'd:\Development_Avecto\OneR' on host 7228.
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in d:\Development_Avecto\OneR
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBUILD_EXE_PATH environment variable set to C:\Users\379212\.vscode\extensions\ms-vscode.csharp-1.7.0\bin\omnisharp\msbuild\MSBuild.exe
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuildExtensionsPath environment variable set to C:\Users\379212\.vscode\extensions\ms-vscode.csharp-1.7.0\bin\omnisharp\msbuild
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuildSDKsPath environment variable set to C:\Users\379212\.vscode\extensions\ms-vscode.csharp-1.7.0\bin\omnisharp\msbuild\Sdks
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in 'd:\Development_Avecto\OneR\OneR.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project from 'd:\Development_Avecto\OneR\OneR.csproj'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Add project: d:\Development_Avecto\OneR\OneR.csproj
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Update project: OneR
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'd:\Development_Avecto\OneR'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Startup
        Configuration finished.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MaximumViciousDeercommented, Jan 18, 2019

Update: I have now also tested this on Fedora 28 with .Net Core SDK 2.2.103. Same problem persists, i.e. no suggestions for adding namespaces for missing types.

0reactions
TanvirArjelcommented, Nov 7, 2022

@cartermp The issue is still persisting in VSCode 1.73.0!

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How can I quickly add a missing namespace in VS Code?
Show activity on this post. Just use CTRL + . on the word with the red underline. No need to install other extensions....
Read more >
Resolve Missing Namespaces in Code Samples
In this case, Visual Studio can help us resolve the missing namespace. When you see the yellow bulb, click CTRL + . to...
Read more >
Visual studio not loading non-default namespaces - Unity Forum
So i ran into this problem with visual studio community where it can't find some namespaces. Game runs perfectly without console errors.
Read more >
Adjust Namespaces | JetBrains Rider Documentation
This command is a bulk fix that helps you synchronize namespaces with folder structure in any scope, which can be as large as...
Read more >
"The type or namespace name 'ClassName' does not exist ...
Fixes an issue in which an incorrect minimally qualified name is generated for a public control in a Windows Form solution in Microsoft...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found