Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
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.
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?