Closed amorpheus closed 5 years ago
Can you confirm what is your version of Visual Studio, and if you're using other extensions?
If the issue is consistent, it'd be good if you can temporarily try removing [tfsBranchName] from the pattern to see if this is related to this tag (which does take some time to resolve, though normally it should be asynchronous).
Microsoft Visual Studio Professional 2017 Version 15.9.11 VisualStudio.15.Release/15.9.11+28307.586 Microsoft .NET Framework Version 4.7.03190
Extension use is relatively minor, one internal one that has a few helpful shortcuts, ReSharper, and a few of the Power Tools.
I'll try removing the branch tag and see how it goes.
Hum, it is very much possible that [tfsBranchName] is causing the slowness, as it is the only tag that needs to run on the UI thread for the resolution:
Globals.InvokeOnUIThread(() => name = TfsHelper.GetBranchNameFromLocalFile(Path.GetDirectoryName(sn)));
I need to check if there is a way to run it outside the UI thread, but I remember I added this invoke because it was otherwise throwing exceptions.
Thanks for the updates. Is resolving the branch name something that needs to ping the TFS server, or where could the slowness happen?
Yes, apparently with TFS it needs to ping the server, which is slow. But this alone is not a problem. The problem is if we have to run this on the UI thread.
Do you think I could cache the result of the branch name for a particular solution file?
Is it guaranteed to not change (my instinct tells me that it can change if the branch is switched while the solution is still open in Visual Studio)?
Personally, I don't think I would ever need my VS title to adapt to a new branch name after opening a solution. Maybe checking the branch name could depend on other variables that trigger it?
I prefer to be safe and always recheck if it can change (otherwise it can cause bad surprises for users). Since the branch name change could be triggered outside of VS, I'm afraid there is no event we can hook to to refresh only when strictly needed. But anyway it shouldn't be a problem if we can run this asynchronously.
Can you try the following release 4.3.1, where I am running the offending line on the threadpool thread, and let me know if you see any error in the debug or notice any slowness, or crash?
CustomizeVSWindowTitle (4.3.1).vsix.zip
Just extract the vsix file (GitHub doesn't allow to upload vsix files) and install it, it should overwrite the existing version (and keep the link with the auto update if I push a new version on the gallery).
Got it running now and it seems to work just fine. :) Thanks!
I've seen the "this extension has caused X seconds of unresponsiveness" warning multiple times today, for version 4.3.0. First time was 5, just a few minutes ago it was 6.
The only settings I've changed from defaults were the "solution in X mode" ones: [solutionName] [[tfsBranchName]] (Debugging) - [ideName] [solutionName] [[tfsBranchName]] - [ideName] [solutionName] [[tfsBranchName]] (Running) - [ideName]
I've turned on the Debug option and can hopefully contribute something more substantial when this happens again.