Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Авдеев Вячеслав
@lsoft
@SENya1990 no public plans for net5/net6 for VS internals. from general point of view, it's an inevitable, but no one knowns when this happens.
2 replies
Авдеев Вячеслав
@lsoft
@mrlacey thanks for the tip. I've updated everything related with VS to latest 16.x, codeanalysis to 3.10, but the same problem still exists. as a workaround, I've removed asset from vsixmanifest, looks like my vsix works fine without this node.
vasantha-kumar25
@vasantha-kumar25

Hi All!
How to check if any Instance of Visual Studio or related application is Running? Basically, I wanted to replicate the behaviour of the VSIX installer waiting, until all visual studio applications are closed.

alt

Eric M Mead
@ericmmead_twitter
Does or has anyone discovered if/where the VSSDK exposes the value of the ErrorList's "Build Only", "IntelliSense Only", or "Build + IntelliSense" filter? I thought maybe in the SettingsStore? First place I looked was the IErrorList, but didn't have luck there either.
Eric M Mead
@ericmmead_twitter
haha embarrassing. I found it. Right on the IErrorList.
Jialong Cheng
@jialongcheng

@kcbanner_twitter . I'm trying to get repro on the issue of the messagepump you mentioned earlier with the latest VS 2022 Preview. The following is the code snippet that I was using:

ThreadHelper.JoinableTaskFactory.RunAsync(VsTaskRunContext.UIThreadBackgroundPriority, async () =>
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                await Task.Delay(10000); // wait ten seconds
                VsShellUtilities.ShowMessageBox(this.package,
                "It worked!",
                "TestCommand",
                OLEMSGICON.OLEMSGICON_INFO,
                OLEMSGBUTTON.OLEMSGBUTTON_OK,
                OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            });

The entire code was inside a command's Execute() method. However, I wasn't able to see the behavior where we need a mouse focus for the message box to show up. The message box showed up after 10 seconds regardless.

Could you try to see if this repro on your box? Or could you modify it to get a simple repro?

I also looked at your earlier repro code snippet here but I didn't see you specify UIThreadBackgroundPriority specifically anywhere: https://gist.github.com/kcbanner/0da112634ef4a97f8c3b4389de031289

Thanks!

Minuri Rajapaksha
@Minuri-Rajapaksha

Hi All!

Q: Events of margin glyphs are not triggered when two different plugins(vsix) with glyphs are installed

Tooltip or popup on a margin glyph doesn’t show up when two glyphs from two different plugins are installed. I have noticed that the events like MouseEnter, MouseLeave do not trigger in this scenario.

Even though both Glyph-01 and Glyph-02 images are visible here, only the tooltip/popup of Glyph-02 is popped up for the MouseEnter event. MouseEnter event of the Glyph-01 is not get triggered.

Highly appreciate your support on fixing the issue. Samples are attached below.

classifier-todo.PNG
two-glyphs.PNG
Yann Duran
@yannduran

@Minuri-Rajapaksha if you're asking Microsoft to fix this issue, this isn't the right place to be asking. You'd need to add a bug issue (problem) on the Developer Community website.

If you're just asking fellow developers for help with solving it, then ignore what I've said, this would be the right place. StackOverflow can also be a good place to ask questions too.

Minuri Rajapaksha
@Minuri-Rajapaksha
@yannduran thanks for response. I have already posted in both Developer Community and StackOverflow.
Eugene Kiba
@eugene-kiba
Could not install package 'Microsoft.ServiceHub.Analyzers 2.8.2019'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.8', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Is there any solution for the error above? Thanks
Bert Huijben
@rhuijben
@eugene-kiba are you sure you are using the right target platform (x64 vs x86 vs Any put)
=Any put. That issue will get you that same error.
AnyCPU... Stupid android client
vasantha-kumar25
@vasantha-kumar25
Hi All! I am interested in Learning Visual Extension Development in a structured manner. Is there any Book or Course that is recommended?
Yann Duran
@yannduran
Yann Duran
@yannduran
The author: Rishabh Verma is a Microsoft certified professional and works at Microsoft as a senior development consultant, helping the customers to design, develop, and deploy enterprise-level applications. An electronic engineer by education, he has 12+ years of hardcore development experience on the .NET technology stack. He is passionate about creating tools, Visual Studio extensions, and utilities to increase developer productivity
3 replies
Nils Andresen
@nils-a
Hi people. Are there any guidelines on adding libraries to extensions? Like are some things are probably already baked into VS and should therefore always be referenced in a special version?
I was thinking of adding Reactive Extensions (Rx) into my extension but I'm a bit hesitant for fear of "collisions" with other extensions.
ganesanviji
@ganesanviji

Hi all,

Could you please anyone check the below issue and suggest the solution?

https://developercommunity.visualstudio.com/t/The-vstemplate-file-references-the-wizar/1469397?space=8&entry=problem

Robert van der Hulst
@RobertvanderHulst
Does anybody know if there is an Asynchronous version of ISignatureHelpSourceProvider ?
Arcanox
@ArcanoxDragon
I have a VSIX I'm writing that contains a good number of OleMenuCommands, both in the actual menus as well as ones for the context menu of the code window. For some reason, the "BeforeQueryStatus" event of my commands is never fired until I interact with at least one other command (such as my "About" command that's always visible). I set a breakpoint on the "InitializeAsync" of my package and saw it being called about 30 seconds after loading a solution, but "BeforeQueryStatus" was still not being called upon right clicking in the code window until I clicked on my "About" menu once, and then it was called normally. Anyone ever run into that before?
Авдеев Вячеслав
@lsoft
@ArcanoxDragon I only noticed that BeforeQueryStatus is not called unitl my package is loaded. after the package is loaded, BeforeQueryStatus works fine for me. did you try to make a minivsix for repro purposes?
Arcanox
@ArcanoxDragon
I haven't tried a repro project yet, no. It's weird, because I can see the breakpoint change from "unavailable" (red outline) to "normal" (filled red circle) as my package loads into the debug instance of Studio, but it still doesn't get called until I interact with another command. I don't notice the issue as much in production, so maybe it's a debug-only thing
Авдеев Вячеслав
@lsoft
from my point of view, it's unlikely that it's a debug only issue, due to my olecommands works fine. I guess the best way to investigate it is to start a new mini-vsix and so on.
Yacoub Massad
@yacoubmassad_gitlab
Based on the design of IAsyncQuickInfoSession, it seems like it is not tied to a specific snapshot of the corresponding ITextBuffer. For example, to get the trigger point you have to pass an ITextSnapshot to specify which snapshot to use. If you use the other overload which takes ITextBuffer, you get an ITrackingPoint which is snapshot independent. This all means that an IAsyncQuickInfoSession is snapshot independent. However, quick info is always (as far as I understand) requested for a specific snapshot of the buffer (when you hover the mouse over some text, that text is some version of the ITextBuffer). Why was it designed this way? Why isn't there a Snapshot property of IAsyncQuickInfoSession that specifies the snapshot that started the session. Can a session span multiple versions of the ITextBuffer?
Ed Dore
@EdDore
@ArcanoxDragon , does this particular assembly also have exported MEF components? I'm wondering if your InitializeAsync has been called, such that your BeforeQueryStatus events have been added to their respective OleMenuCommands. Typically, I've seen this where the package hasn't been loaded, but seeing as how you noticed breakpoints being resolved, my next best guess is your Package.Initialize, or AsyncPackage.InitializeAsync hasn't been invoked. Which means you should probably look into adding ProvideAutoLoad attributes to ensure your package is loaded for the particular project type(s) you want to support.
1 reply
Авдеев Вячеслав
@lsoft
Chris Bordeman
@cbordeman
So I tried making my extension run in VS2022. It installs OK, but at startup VS give this error:
image.png
Here are the 2 relevant log entries:

<entry>
<record>2355</record>
<time>2021/07/18 05:13:06.489</time>
<type>Information</type>
<source>VisualStudio</source>
<description>Begin package load [MvvmToolsPackage]</description>
<guid>{E4370A0B-2A09-437A-9D02-04B2D52DC044}</guid>
</entry>

[...]

<entry>
<record>2362</record>
<time>2021/07/18 05:13:06.517</time>
<type>Error</type>
<source>VisualStudio</source>
<description>CreateInstance failed for package [MvvmToolsPackage]Source: 'mscorlib' Description: Method 'GetItemContent' in type 'MvvmTools.MvvmToolsPackage' from assembly 'MvvmTools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.&#x000D;&#x000A;System.TypeLoadException: Method 'GetItemContent' in type 'MvvmTools.MvvmToolsPackage' from assembly 'MvvmTools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.&#x000D;&#x000A; at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)&#x000D;&#x000A; at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)&#x000D;&#x000A; at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&#x000D;&#x000A; at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)</description>
<guid>{E4370A0B-2A09-437A-9D02-04B2D52DC044}</guid>
<hr>80004005 - E_FAIL</hr>
<errorinfo></errorinfo>
</entry>

Chris Bordeman
@cbordeman
Running in the VS2022 debugger doesn't generate an exception and the exception from the log tells me nothing.
Can anyone say what might be going on? The source is at https://github.com/cbordeman/Mvvm-Tools
Minuri Rajapaksha
@Minuri-Rajapaksha
Hi, does anybody know how to add new selection margin and outline margin to vsix project. Like this: https://images.app.goo.gl/TV5ExMuxzjoz2QeW8
pascalgyger
@pascalgyger
I'm trying to register my custom UI Context. It seems to work fine, except when I call SetCmdUIContext from the InitializeAsync method of my package class, Visual Studio completely freezes. Is there a particular reason why you cannot set the context from the packages initializer or am I doing something wrong (I'm using the Community.VisualStudio.Toolkit)?
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.