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

Prevent multiple instances when "Allow multiple instances" is de-selected #2579

Closed
tamlin-mike opened this issue Dec 14, 2021 · 4 comments
Closed

Comments

@tamlin-mike
Copy link

Tested with 65792df.

Sometimes you might want to add multiple assemblies from command line. One might then use something like

for %i in (*.dll) do @ilspy "%i"

When ILSpy is already open that works (though the assemblies generally gets added in the wrong order).

Today I made the mistake of not having ILSpy running already when running such a mass-add. Ooops - umpteen instances of ILSpy started, leaving me frenetically closing a lot of instances. :-)

I suggest moving the check for an existing instance to way earlier in the startup sequence when "Allow multiple instances" is not selected, to prevent this.

It probably requires two synchronization objects. One to check for an already running instance, and one to check for "is the running instance ready to recieve the path of an additional assembly".

It's not a big problem, it can easily be deferred to the most rainy and boring day of the decade. :-)

@tamlin-mike tamlin-mike added the Enhancement Areas for improvement label Dec 14, 2021
@siegfriedpammer siegfriedpammer added Bug UI and removed Enhancement Areas for improvement labels Jan 5, 2022
@siegfriedpammer siegfriedpammer added this to the 7.2-preview4 milestone Jan 5, 2022
@siegfriedpammer
Copy link
Member

though the assemblies generally gets added in the wrong order

I don't think we will be able to do anything about this, because it depends on how explorer.exe launches the ILSpy processes and how WM_COPYDATA is then handled. I don't think the order can be made deterministic.

@tamlin-mike
Copy link
Author

it depends on how explorer.exe launches the ILSpy processes

Explorer.exe wasn't even part of the equation.

It might be the slowness and undeterministic behaviour of .NET process startup (-time) in combination with the general slowness of Windows process startup. Hundreds upon hundreds of DLL's, with thousands upon thousands of forced relocations each isn't exactly helping either. But that's Windows for ya: "Please Wait...(tm)". :-)

Anyway, thanks for the fix.

@siegfriedpammer
Copy link
Member

it depends on how explorer.exe launches the ILSpy processes

Explorer.exe wasn't even part of the equation.

My apologies. You are right of course. At the time of writing I was thinking about the "Open with ILSpy" shell extension. :-)

@tamlin-mike
Copy link
Author

About the reordering.
Without having looked at the code, my hypothesis of the reordering is that the initial decompilation is kicked off at WM_COPYDATA arrival (to a thread or pool, to keep UI responsive), but defers adding it to the list (TreeView) until it has "matured" enough. If so, it's dependent on not only the order of the incoming (by WM_ message) assembly names, but also the relative complexity of their initial processing and even OS thread scheduling.

So is that worth losing any sleep over? No. :-)

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

No branches or pull requests

2 participants