microsoft / microsoft/vscode-cpptools

Go To Definition on a managed function should not attempt to open a DLL as a text file

Open
#8,539 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Feature: Go to Definition Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: Feature Request

Once I want to code a tool for .net I found that I have few supports.Intellisence doesn't recognise the code concerning CLR.

//a.cpp
#using<system.dll>
using namespace System;
int main(void){
    Console::WriteLine("Hello World");
    return 0;
}

This code surely passes the compilation with cl a.cpp /clr ,but I got these Intellisence errors:

name followed by '::' must be a class or namespace name
"#using" requires C++/CLI mode

I think it it because intellisence can't find a file declaring these namespaces and function.So I build a header.

//tips.h
namespace System{
class Console final{
public:
	static void WriteLine(...);
	static void Write(...);
private:
};
}//namespace System

However, this will trigger a redefination error at compile time.

system.h(4): error C2011: redefination of “System::Console”:“class”

Is there a way to get tips and Intellisence check without coming into compile time errors? Can this problem be solved by extra features? or by manually making headers?,or other snippet options? I wish there is a method.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the a.cpp example with cl /clr and observe the IntelliSense errors for #using and System::Console. Review the tips.h and system.h workaround described in the issue, then determine how Go To Definition should handle managed functions without opening a DLL as text. Done means C++/CLI code receives useful IntelliSense without requiring headers that cause compile-time redefinitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.