Skip to content

Highlight referenced element after jump from analyzer window #283

wants to merge 4 commits into from

2 participants

RKlier commented Oct 24, 2011

This extends highlighting in decompiler window for analyzed elements, e.g. having a method A in analyzer window a jump to a method listed under the UsedBy tree node will mark any reference to A.

To ensure this is also done when the jump changes the selection and asynchron decompilation starts, MainWindow.JumpToReference now takes an action which will be executed after decompilation finished (or immidiately if the selection did not change). There are other scenarios, that depend on this possibility: e.g. unfold and scroll to a specific line after JumpToReference.

ICSharpCode member

This will execute the one-shot action when the next decompilation finished - which might be a different one than the decompilation triggered by the jump. Decompilation runs can be cancelled, and a DecompiledFinished event is pretty much useless if it doesn't tell which decompilation has finished.
It would be better to pass the callback into the decompilation operation itself (so that it doesn't get called if the decompilation is cancelled), or provide a Task object that can be used to get notified when the decompilation completes.

RKlier commented Nov 1, 2011

You're right. I changed the code so that the callback is passed to the decompilation and only called if it succeeds (no exception occured). The DecompilationFinished event is now decorated with language and decompiled tree nodes.

By the way: The cancellation of the decompile process results in an exception stack trace being shown. I think there should be a special handling, perhaps like for OutputLengthExceededException or at least a simple message.

ICSharpCode member

Apart from the DecompilationFinished problems (which I just fixed by adding a JumpToReferenceAsync method), this PR has another problem: it does not necessarily highlight the correct references. For example, if the referenced symbol is in another assembly, it is not highlighted.
This is because the MarkReferences implementation was written only for local variables; and does see a type reference and a type definition as equal even if they point to the same type.

@dgrunwald dgrunwald closed this Jun 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.