IL Viewer for VS Code
Are you one of those Dev's that like to see how the engine actually works? Likes to see the underlying details? One that wants to know what really happens when you compile your C# code?
In short, you want your IL?
Joseph Woodward has written a very cool VS Code extension that quickly and easily takes your C# and provides you a glimpse at the resulting IL.
His post is also a lesson in how to create a like extension. He had to jump through a number of hoops to make it happen, and now you can learn from his journey...
"For the past couple of weeks I've been working on an IL (Intermediate Language) Viewer for Visual Studio Code. As someone that develops on a Mac, I spend a lot of time doing C# in VS Code or JetBrains' Rider editor - however neither of them have the ability to view the IL generated (I know JetBrains are working on this for Rider) so I set out to fix this problem as a side project.
As someone that's never written a Visual Studio Code extension before it was a bit of an ambitious first extension, but enjoyable none the less.
Today I released the first version of the IL Viewer (0.0.1) to the Visual Studio Code Marketplace so it's available to download and try via the link below:
Download IL Viewer for Visual Studio Code
The source code is all up on GitHub so feel free to take a look, but be warned - it's a little messy right now as it was hacked together to get it working.
How does it work?
Visual Studio Code and HTTP Service
At its heart, Visual Studio Code is a glorified text editor. C# support is added via the hard work of the OmniSharp developers, which itself is backed by Roslyn. This means that in order to add any IL inspection capabilities I needed to either hook into OmniSharp or build my own external service that gets bundled within the extension. In the end I decided to go with the later.
Inspecting the Intermediate Language ...
Including external dependencies ...