Skip to content

Unable to resolve namespace imports defined at project level (vbproj). #9

Description

@ElektroStudios

When opening a VB.NET project in VS Code using the VB.NET language server extension, namespace imports defined at the project level inside the .vbproj file are not properly recognized by the language server.

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="..." />
...
  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
  </ItemGroup>
...
</Project>

As a result, symbols from these namespaces are reported as unresolved even though the project builds successfully (on Visual Studio). In this case I need to write Imports System at file level (on the loaded .vb file in VS Code) to get rid of half of the 300 errors in the PROBLEMS window:

Image

But there is also other related problem with assembly references, I don't exactly understand why, but for example it can't recognize any defined member in the code that depends on the imported namespace System.Windows.Forms (from assembly: System.Windows.Forms.dll), however, this code makes calls to class: System.Windows.Forms.Clipboard() and method: System.Windows.Forms.SendKeys(), but the namespace it is underlined with this yellow-orange color:

Image

Neither it can't resolve other namespaces like DevCase.Runtime.TypeComparers:

Image

Maybe this last is because the file have 8 "errors" and since the language server can't compile it, then it can't resolve the namespace. But why it can't compile it at first?. It works perfect on Visual Studio.

The compiler errors marked in that StringNaturalComparer.vb file points to another file that does NOT have errors:

Image

And it is sharing the SAME namespace so it should resolve it:

Image

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions