szehetner / InliningAnalyzer

Inlining Analyzer is a Visual Studio Extension that shows in the source code if a method call will be inlined by the JIT compiler.
MIT License
151 stars 9 forks source link

Idea: Expression tree highlighter #14

Open olmobrutall opened 5 years ago

olmobrutall commented 5 years ago

I’ve landed today in this repository after reading https://mattwarren.org/2019/03/01/Is-CSharp-a-low-level-language/

Both the post and this tool look like excellent ways of getting more insights in the performance of an application.

Unfortunately I’m not getting paid to build cool raytracers in c#, but to write boring c# database applications.

I typically use a my own framework to do this (Signum Framework) that has, just as entity framework, a LINQ provider.

When training people, very often they have problems knowing if a query is going to be resolved in the database or in memory. Will be awesome to have a VS extension that highlights any lambda that will be converted to an expression tree, and any method that returns IQueryable.

I’m thinking in starting a new VS extension based on this one.

Can I ask you questions if I have any problem?

Thanks

szehetner commented 5 years ago

Sure, you can ask questions here or tag me in issues in your repository. There is probably not too much you can reuse directly from the Inlining Analyzer, but at least it should give you an idea on how to highlight methods and navigate the roslyn syntax tree.

Your idea sounds useful though. Having worked with various ORMs I remember how intransparent this database vs. in-memory distinction can be.

olmobrutall commented 5 years ago

I installed you extension but doesn't work... VS 2017 x64 using and .Net Core 2.2. Any idea?

You think will be better to start from your project and remove stuff, of there is some VS Extension template you started from that will be a better starting point?

szehetner commented 5 years ago

Do you get any errors in the Inlining Analyzer Output Window?

I took a simple highlighting extension as a starting point, but I can't find the link now. There is also this blog series: https://michaelscodingspot.com/visual-studio-2017-extension-development-tutorial-highlight-code-in-editor that has some useful explanations and a lot of sample code. That might be a better starting point.