ionide / proj-info

Parse and evaluate MsBuild project files
MIT License
64 stars 37 forks source link

Fix: Retrieving dotnet runtimes hangs when there are too many runtimes installed #119

Closed Booksbaum closed 3 years ago

Booksbaum commented 3 years ago

Test Main tests.can get runtimes hangs on my PC.

Reason: ProjInfo calls dotnet --list-runtimes by executing dotnet, waiting for it to finish, and then reading the output:
https://github.com/ionide/proj-info/blob/1c9317b851571d2b53df93250e1b4491a84152af/src/Ionide.ProjInfo/Library.fs#L25-L40

Important: First Waiting for exit, Then reading output

But: The executing Process blocks when its output buffer is full and not read (see Remarks for Process.StandardOutput).
-> When there are too many runtimes installed (-> too many lines from --list-runtimes), calling dotnet --list-runtimes hangs.

I installed at least one new dotnet version over the last days (-> several additional runtimes). Which seems to just crossed the line between "working" and "buffer full"
(there are more runtimes than sdks -> happend with --list-runtimes, not (yet) with --list-sdks)




Fix: Read lines while executing

baronfel commented 3 years ago

This makes good sense :thumbsup: Thanks for this change.