microsoft / CsWin32

A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project.
MIT License
2.07k stars 87 forks source link

Failed to open generated code in Visual Studio Code #1128

Closed altamkp closed 8 months ago

altamkp commented 8 months ago

Actual behavior

Hi there,

I have recently started using this library to generate Win32 APIs for my projects. As my go-to IDE is Visual Studio Code, I would like to also view the generated code in VS Code, but it fails to do so currently. I have provided a minimal reproducible example project below.

image

I have also tried to open the project in Visual Studio and it works fine.

image

Expected behavior

Being able to open generated source code in VS Code.

Repro steps

  1. NativeMethods.txt content:

    GetVersion
  2. NativeMethods.json content (if present): Not configured.

  3. Any of your own code that should be shared?

CsWin32Test.zip

Context

AArnott commented 8 months ago

There is nothing CsWin32 can do to improve the VS Code visualization story. Please file an issue with the VS Code folks, possibly targeting the C# extension.