josephwoodward / VSCodeILViewer

A Visual Studio Code C# IL (Intermediate Language) Viewer
MIT License
98 stars 18 forks source link

No IL output #11

Closed pawlos closed 7 years ago

pawlos commented 7 years ago

I've installed the extension both on macOS and Windows but can't get the extension to produce IL. On macOS there's no output when selecting Inspect IL

zrzut ekranu 2017-02-08 o 21 28 57

on Windows it holds on "Inspecting IL, hold onto your seat belts! ..."

hackpad com_ag2zhmaw2dj_p 102670_1486585881928_undefined

Is there any log I can check to see what's going on and why I can't get the IL code to appear?

josephwoodward commented 7 years ago

Hi Pawlos, thanks for reporting this.

A couple of questions, first is your C# project using the old project.json format or the new .csproj format? Also, if you navigate to http://localhost:65530/api/il/ do you get a response (you should see the message "pong").

If you go to Help / Toggle Developer Tools then you should see some basic log output, though I'm in the process of improving the logging for the next version.

pawlos commented 7 years ago

@JosephWoodward project.json as it's stated in the issues and also in the description that's the only supported now. The code is actually copied from your blog post (http://josephwoodward.co.uk/2016/12/in-memory-c-sharp-compilation-using-roslyn)

If I navigate to the address I do get the pong response.

In the developer tools I can see that the server is listening ([Extension Host] Server output: Now listening on: http://localhost:65530) but the network tab does not actually have any requests - I assume there should be one to that address. That's from macOS - I can later check on Windows.

josephwoodward commented 7 years ago

I think I see what the problem is, can you rename your class's filename to Hello (so it matches your type name) and try again please? I ran into this issue the other day where there's a problem if the filename is different to a class in the file.

pawlos commented 7 years ago

@JosephWoodward yup. It works if I rename the .cs file to match the type. Is this a requirement/limitation or it's just a bug needed to be resolved?

josephwoodward commented 7 years ago

It's a bug that I found the other day that needs to be resolved.

What's happening is, because VS Code is a text editor it has no concept of a type (just a file), VS Code IL Viewer sends the filename to the background service which locates the type by the filename. I'm going to have to look to see if I can load the file, and parse the type, or use OmniSharp to get the type.

The difficulty/question comes, when there's more than one type in a file - which one do we pick (all of them I suppose)?

josephwoodward commented 7 years ago

I've created an issue for this (https://github.com/JosephWoodward/VSCodeILViewer/issues/12), thanks for reporting it 👍

pawlos commented 7 years ago

@JosephWoodward ok, understand now. Thanks for looking into this.

josephwoodward commented 7 years ago

Not a problem @pawlos