Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go to definition #506

Closed
christophwille opened this issue Nov 11, 2014 · 14 comments
Closed

Go to definition #506

christophwille opened this issue Nov 11, 2014 · 14 comments

Comments

@christophwille
Copy link
Member

(ALT+)F12 Go to definition

Navigate to a temporary tab inside VS (opening ILSpy.exe is not a good idea here).
Make sure to support scenarios where people have tools on their box that rewrite F12 too (think Resharper)

@SLaks
Copy link
Contributor

SLaks commented Nov 12, 2014

I can easily implement this to open ILSpy.

Implementing this in a new tab is better done with Roslyn (so we can provide standard language services in the new tab); that will only work on Dev14.

@SLaks
Copy link
Contributor

SLaks commented Nov 12, 2014

More details:

There are three ways to display decompiled code in VS:

  1. Embed the ILSpy UI (AvalonEdit & associated hyperlink code) in a blank document tab (or tool window) in VS.
    This is the simplest approach, but would look horribly out-of-place compared to the rest of the VS UI.
  2. Dump the source to a (readonly) file, then open that file as a regular C# file (not associated with any project).
    This is even easier, and would look perfectly normal. However, the file would not have any semantic information, so you wouldn't be able to navigate from it.
  3. Open the source as a C# file, and use Roslyn to bind it to a custom Workspace which references the original assembly.
    This would look perfectly normal, but would also have full semantic information; we could easily hook F12 in that file to open definitions in other decompiled files. It would also natively support Find All References within the current actual solution (I think).
    However, this would only work in Dev14.

These three options are all completely independent of other decompiler UI, including how the decompiler would be invoked (F12, new command, Expand reference nodes to ILSpy-like assembly tree, new tool window, etc)
/cc @sharwell

@christophwille
Copy link
Member Author

One more thing I'd like document for consideration for gotodef: http://www.symbolsource.org/Public
This could be a useful addition (although not strictly decompilation) for assemblies that originated from Nuget and have related symbols. This was you could navigate to the "real" source code instead of the decompiled approximation.

@SLaks
Copy link
Contributor

SLaks commented Nov 14, 2014

@christophwille
Copy link
Member Author

Can we make both ilspy and ref12 play nicely together?

@ctaggart
Copy link

A better alternative to SymbolSource is just using SourceLink. I just created and blogged about SourceLink.SymbolStore which could be used. If a more C# friendly interface is needed, but open an issue, propose an interface, and I'll implement it.

@BBI-YggyKing
Copy link
Contributor

Note that "Go to definition" is similar to the "Open code in ILSpy" feature I'm working on. See #696 and friends. However I am not working on support for display inside Visual Studio (along the lines of the standard "Peek Definition"), just for launching ILSpy externally and navigating to the selected code.

@sharwell
Copy link
Contributor

sharwell commented May 4, 2016

@SLaks For a feature inside Visual Studio, I think the Roslyn custom workspace approach is the one to go with. "Only works with dev14" will quickly turn to "works with dev14 and newer"... plus you would still have the external viewer for other cases.

@BBI-YggyKing
Copy link
Contributor

For the record, in case anyone on this thread is interested, pull request #706 (not yet merged as of May 4th) resolves the final issues I am aware of with my new "Open code in ILSpy" feature. Would appreciate feedback from anyone who has time to try it out.

@atemate
Copy link

atemate commented Jul 28, 2016

Go to definition in full version ILSpy.exe version 2.4.0.1963 not working with constructors, it refers to the start of decompiled class instead of constructor code. Is it hard to fix this?

@BBI-YggyKing
Copy link
Contributor

I did test constructors extensively, including a wide variety of generic constructors, see ILSpy.AddIn/Samples/ILSpyAddInSamples.cs for my test cases. How can I determine the state of the code in version 2.4.0.1963? Does it match the current v2.4 tag?

If it's not working with my latest changes (which aren't recent, it was back in May) then I will investigate why and the fixes should be straightforward. Unfortunately I won't have time to investigate until the middle of next week, August 3rd or so. If you can provide a test case that doesn't work that could be helpful.

For what it's worth, I just retested with the ILSpy add-in I built locally while working on the feature, and navigate to constructor is working fine.

@atemate
Copy link

atemate commented Jul 31, 2016

Does it match the current v2.4 tag?

Yes, unfortunately the current full version I built (version 2.4.0.1972, matched v2.4 tag, built on July 31) has this bug.

Unfortunately I won't have time to investigate until the middle of next week

I don't think this is a high-level bug, just a little inconvinience :)

@BBI-YggyKing
Copy link
Contributor

Hmm, OK. Please attach sample code -- my testing of constructors is working fine.

@siegfriedpammer
Copy link
Member

Closing as ILSpy is now part of Visual Studio.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants