Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Neil Henderson
@bluetarpmedia
@pascalgyger Did you switch to the main/UI thread in your InitializeAsync method before making that call?
Casey Banner
@kcbanner_twitter

@jialongcheng I tested with your dialog test case, and in both cases it was fine (DispatcherPriority.Normal vs VsTaskRunContext.UIThreadBackgroundPriority). However, I don't think the dialog exercises the actual bug, as it's more to do with the UI redraw path.

Here are two example videos. In both cases I show a dialog right after my search completes, this dialog is shown as follows:

                //var priorityJTF = ThreadHelper.JoinableTaskFactory.WithPriority(Dispatcher.CurrentDispatcher, DispatcherPriority.Normal);
                //priorityJTF.RunAsync(async delegate
                ThreadHelper.JoinableTaskFactory.RunAsync(VsTaskRunContext.UIThreadBackgroundPriority, async () => 
                {                
                    // Show the tool window (creates one and initializes state if it's not open)
                    ToolWindowPane toolWindowPane = await ShowToolWindowAsync(typeof(TurboSearchToolWindow), 0, true, DisposalToken);
                    await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();                 

                    await RunSearchAsync();

                    VsShellUtilities.ShowMessageBox(this,
                    "Search complete",
                    "Debug Dialog",
                    OLEMSGICON.OLEMSGICON_INFO,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);

                }).FileAndForget("turbosearch/search");

Note the commented out DispatcherPriority.Normal line, this is what is enabled in the following video: https://drive.google.com/file/d/1_VZQWb-EhA4iSfYPiq-J4KfsvOJVOPrd/view?usp=sharing
This video is using VsTaskRunContext.UIThreadBackgroundPriority: https://drive.google.com/file/d/12VJVwMa7WFZ_A0J7Nk6zYMqeSvzeC5fE/view?usp=sharing

Note how in the 1st video, there is a large delay between the dialog signaling the end of the async task, and the actual xaml redraw. Using UIThreadBackgroundPriority it doesn't happen. This seems to be the bug.

Specifically note the unreliable timing as well - the first couple are slow and then some following it are fast. It's random whether or not there will be a delay there when using normal priority.
Casey Banner
@kcbanner_twitter

However, the dialog itself is affecting the behavior. If I don't show that dialog, we get the following instead:

Normal priority: https://drive.google.com/file/d/18WNA_vf3_ihsA36QV-RqBVXn2Zs1RSOA/view?usp=sharing
UIThreadBackgroundPriority: https://drive.google.com/file/d/1cn4qB8HwdzUFcZA2eHsiKAczdQSqWn0W/view?usp=sharing

Note that in the normal priority video, there is again a large lag, and it updates once I move the mouse around over my tool window. In the UIThreadBackgroundPriority, things seem to update.

However, there is a difference in responsiveness of the progress bar (simply enabled if the async task is running or not, by a boolean toggled on in RunSearchAsync and off again in a finally block inside RunSearchAsync after it awaits the actual search process). The normal priority version has better progress bar and status update responsiveness, but much worse treeview updates. The UIThreadBackgroundPriority version has a progress bar update that lags behind the treeview instead.

Casey Banner
@kcbanner_twitter
For reference, here is the RunSearchAsync source: https://gist.github.com/kcbanner/d747152a35caeba7a68d117170606c1c
Casey Banner
@kcbanner_twitter

Here is a version displaying the latency of the stopwatch surrounding the task running the search:

Normal (task takes ~110ms to search, note how sometimes the treeview won't update until a mouse event on the tool window): https://drive.google.com/file/d/1QxL4J-IzmvnFq7nvZimGORKLx1_eLzqb/view?usp=sharing
UIThreadBackgroundPriority (task takes ~340ms to search): https://drive.google.com/file/d/1vuadQH0wT77dCzR99ho_r860Z-ixfKH3/view?usp=sharing

So, using normal I can run the actual search 3x as fast (as shown in the timer, and visually seeing the progressbar update much quicker), but the TreeView can arbitrarily just not update until a mouse event comes in. Unfortunately this means I have to pick the slower UIThreadBackgroundPriority, in order to avoid the random failures

I also experimented with TaskCreationOptions.RunContinuationsAsynchronously for the Ag.RunAgAsync call (seen inside the gist), however this made things much slower, only in the UIThreadBackgroundPriority case (800ms - 1500ms), presumably because it needs to schedule it on a different thread?
Casey Banner
@kcbanner_twitter
Thanks for looking into this and apologies for my delayed response, I had missed the ping until now
pascalgyger
@pascalgyger
@bluetarpmedia Yes, I did switch to the main thread before the call. I reproduced the situation now with a new package, without the Community toolkit, and observed the same behavior. So it doesn't seem to be related to the toolkit.
Casey Banner
@kcbanner_twitter
Actually - an update - I had to roll back the UIThreadBackgroundPriority change because I was getting 20 second+ delays on task completion during testing today.
Robert van der Hulst
@RobertvanderHulst
I have created a package that inherits from AsyncPackage and set
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
Which context do I set for the ProvideAutoLoad attribute to make sure that my package is loaded before the first solution is opened, so I can register a OnBeforeOpenSolution event, so I can receive this event for the first solution that is opened ?
Robert van der Hulst
@RobertvanderHulst
To answer myself: this seems not possible. Inside the InitializeAsync() you need to check if a solution is open, and when there is an open solution you need to call the OnBeforeOpenSolution event manually.
bit7
@bit7
Can I access visual studio from within a t4 template? I'd like to add a progress indicator that displays as I generate code.
bit7
@bit7
This template will be a design-time template that calls a library that generates code from run-time templates.
jobskamlesh
@jobskamlesh
While scrolling through a solution/project in visual studio 2019 , we see slowness in the files getting loaded.
The solution/project is a part of source control extension ( using deprecated API's), and has around 400 cpp and header files
Let me know any inputs to check on the slowness
Kirk Fertitta
@kfertitta
@RobertvanderHulst You are correct. You can't. We have a similar need in some of our packages and we've taken a couple of different approaches -- both aimed at minimizing the amount of code that is always resident in VS, so that we're good citizens. One is to simply have a very minimal "sentinel" package that loads on the NoSolution context and then registers for the events of interested. The second approach we use is to leverage the Solution Explorer extensibility, which is completely independent of VSPackage loading. Export an IAttachedCollectionSourceProvider and Solution Explorer will call your component quite early. In our case, we actually do want to show a custom virtual node in Solution Explorer, so we're going to implement that interface in such a way that it selectively emits new nodes. In your case, you'd just be using it as a hook to do other work.
Jakub Míšek
@jakubmisek
Quick question about the new project properties - with Sdk-based CPS project system - anyone know how to add those searchable neat project property pages? :) thank you
Jim Wright
@keyoti
So if we split our extension into a pre 2022 and a 2022+ version, then that means a new entry in the Marketplace for the 2022+ version. Is there anyway to avoid that? Starting from scratch with 0 reviews etc is not ideal.
Robert van der Hulst
@RobertvanderHulst
@kfertitta Do you know if there is an example somewhere of how to work with IAttachedCollectionSourceProvider?
Kirk Fertitta
@kfertitta
@RobertvanderHulst The .NET project system and Roslyn and, to a lesser degree, NuGet.Client repos on Github all implement IAttachedCollectionSourceProvider. It's used to populate nodes under the Dependencies tree.
arikstudy1
@arikstudy1
does sdk for ver 8 is avalivle for code to transfer site of word press like https://www.lychee-fruits.co.il/ to code in java ? there is plug in that do it? i see in this site of news https://bignews.co.il/ that it is exist.
vik78
@vik78
Hi All! Is it possible to add item to Object Explorer Context Menu in SSMS using vsct? In code I can add items but due async loading items appears in context menu after extension loaded.
Kaveesh Dashora
@kaveeshd
I am looking to implement MSBuild in my custom project. Is there any place where I can start.
Yann Duran
@yannduran

Starting from scratch with 0 reviews etc is not ideal

I agree!

Thomas Zitzler
@ThomasZitzler

Hi, I'm trying to update one of my extensions to VS 2022, but it's crashing at the end when trying to open a help page:

dte.ItemOperations.Navigate("https://myhelppage", vsNavigateOptions.vsNavigateOptionsNewWindow);

The error message is: Method not found: 'EnvDTE.ItemOperations EnvDTE._DTE.get_ItemOperations()'.

Can I replace this with something else?

Авдеев Вячеслав
@lsoft
@ThomasZitzler what's the type of dte ? it should be DTE2
Thomas Zitzler
@ThomasZitzler
@lsoft I'm using it in ProjectFinishedGenerating(Project project) in an IWizard and just use project.DTE
Авдеев Вячеслав
@lsoft
did you watch Mads Kristensen's show episode about supporting vs2022?
Thomas Zitzler
@ThomasZitzler
Авдеев Вячеслав
@lsoft
the eldorado is here: https://www.youtube.com/playlist?list=PLReL099Y5nRdG2n1PrY_tbCsUznoYvqkS I think it will help you a lot if you watch at least some of that episodes. take a look specifically to https://www.youtube.com/watch?v=-PKIPTW6km0&list=PLReL099Y5nRdG2n1PrY_tbCsUznoYvqkS&index=5
Thomas Zitzler
@ThomasZitzler
@lsoft Thank you very much
Авдеев Вячеслав
@lsoft
I've converted all of my vsix with no problem after watching that.
come back if any difficulties arise))
Andy Hippo
@werat
@vasantha-kumar25 Hi, sorry it took me soooo long, but I finally got the time to describe the process of installing VSIX from MSI -- https://werat.dev/blog/installing-visual-studio-extensions-from-msi/
I hope it helps you!
takko
@takko
Hi, is there any way to add a separator or an unselectable item to a combobox?
www.software.tirol
@softwaretirol
Hey everyone, is it possible to disable the design time features for *.razor files in some way? Thanks!
Robert van der Hulst
@RobertvanderHulst
@werat Thanks for sharing this.
Nils Andresen
@nils-a
Hi People, I am working on an extension and I somehow "broke" the commands which means all of my commands/menus are gone (do not appear) is there some way of enabling verbose logging or debug what is happening?
4 replies
Robert van der Hulst
@RobertvanderHulst
Does anybody know or have a link to documentation about what a 3rd party development language has to do / has to implement to support Edit and Continue ( and in the future also Hot Reload) in Visual Studio.
I know that I can find some information by looking at what the Roslyn team has done, but some documentation would be helpful.
Aleksandr
@aldanchenko
Hi,
In my extension I need to get file text by file name (path), line and start/end columns. How can I get this information? Which VS classes can I use for this? Thank you!
Авдеев Вячеслав
@lsoft
@aldanchenko why do you need VS classes to operate with a file which path is known and the position inside it is also known... can you expand your question?
@aldanchenko also, if we are talking about c# source file, roslyn has such stuff (to get text by position)... what kind of file is? is the file is in solution or not?
8 replies
Crypties
@Crypties
What would be the different ways to change the Status bar colors dynamically? It has to be lite and not slow down VS, so I guess nothing like Reapplying a modified theme.
Авдеев Вячеслав
@lsoft
hello! does anyone know how to get solution filter name (name of slnf file) from vsix? dte.Solutioncannot help... VS show slnf on its main screen, but how to grab this info from vsix is completely unclear
baggiochen10
@baggiochen10
hi, does anyone know how to communicate with another vsix, or call?
and if we can use web controll in our vsix?
3 replies
Kaveesh Dashora
@kaveeshd
I have a toolbox where I am displaying custom search results, Everything works fine. I want to extend that functionality to support the Find Next and Find Previous options through hotkeys. Is there a way to do that?
John J. DeFalco
@YahtzeeJD
image.png
can I change these icons via an extension?
2 replies
Erik Ejlskov Jensen
@ErikEJ
Why would you want to use a Microsoft.VisuslStudio.SDK version higher than 16.0 in an extension targeting VS 2019?
1 reply
Brian
@astrohart
Hi all! Name's Brian, I am new.