dnSpyEx/dnSpy

Edit IL Instructions (kinda) ignores selection

Symbai opened this issue · 5 comments

Symbai commented

Problem Description

In the classic version of dnSpy when editing a method using C# fails (which happens extremely often) a workaround was to select the code I want to edit and then right click -> edit IL instructions. In the new dialog dnSpy then has pre-selected all the IL instructions from the C# code I've selected. Now im using dnSpyEx version 6.4.1 and it doesn't pre-selected all of the IL instructions, only part of it.

See example below where I select a whole loop but it only preselects the first line of the inner loop.

Proposal

Preselect all instructions from the selected C# code in main window.

Alternatives

No response

Additional Context

bandicam.2023-11-05.08-05-15-979.mp4

Could you provide additional images/video of how it looks like in old dnSpy versions? If you could also provide the file you are working with, I'd be thankful too as that would make reproducing the issue on my end easier!

IIRC it selects instructions of the only one line wich was right clicked and not respect text selection

Symbai commented

Would it be possible to respect whole text selection? If it gets the IL instructions from the one line it was right clicked at it should also be able to get all IL instructions from all selected lines.

@ElektroKill I was using BitArray constructor from .NET runtime. You can basically use any assembly for repro.

Hi, are you sure that the non-Ex version selects the code for the entire selection? I downloaded dnSpy 6.1.8 and tried and it behaves the same as the current dnSpyEx version.

Symbai commented

I was sure but now I'm not. I cannot reproduce it with non-Ex either. Maybe it worked in the past... dnSpy got heavily rewritten at some point but that was several years ago.

Its always a pain in the butt if you don't know IL that much to identify and delete the lines of code you want. So even if this is not a bug, then please consider it as a feature request.