Closed marabooy closed 1 month ago
@microsoft-github-policy-service agree company="Microsoft"
Could you please provide more information on the calls that you've had to reorder and the UI updates that have been more responsive because of this. Also, the benefits this change has added to what we had before.
Closing this as it has been broken down to smaller prs
Replaces Synchronous I/O with async I/O. ~Note that some calls had to be re-ordered as it seems having async calls then updating UI's afterwards for some components will always result in exceptions. The cause may be due to the threading model being quite different from the windows SDK in the tests.~
Seems this was not needed as ConfigureAwait(true) resolves these as it resumes the thread in the main thread. However the tests need to be updated to run using [STA mode]. (https://www.nuget.org/packages/Xunit.StaFact)
Note though this improve some of the UI updates to be more responsive. There is a performance penalty that lies within these lines here in ConnectedServiceFileHandler.
Benchmarking the code shows that this could end-up causing some freezes for when files are many some considerations should be past a certain threshold (e.g. 200 files) we switch ask the user to switch to a
Namespace
grouping for better performance or the CLI tool.~This
this.Context.HandlerHelper.AddFileAsync
API on multiple runs averaged 40 file additions per minute.~ I need to re-run this benchmark again as this seems to not be the case anymore Seems there are some random variations in the computer. I was running these tests that caused the slowdown earlierAnother alternative would be to switch to the MSBuild same as with the CLI project or Project items (https://learn.microsoft.com/en-us/dotnet/api/envdte.projectitems?view=visualstudiosdk-2022) which in theory could provide better and faster API's.
Some quick benefits from this are
Some future improvements will be:-