Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Jakub Míšek
@jakubmisek

Another info for anyone providing extension for VS2017; once you have AllUsers="true" in your vsixmanifest, vsixinstaller gets to the point where it wants to install (not repair, not update) Microsoft.NET.Core.Sdk.2.1 which fails (because the user has usually a slightly different version of this package already installed - seems more like a version mismatch in Visual Studio 2017 catalog itself). Your extension gets installed, but VSIXInstaller reports a failure.

This can be replicated with @madskristensen 's Extensibility Tools (https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ExtensibilityTools) .
Once the user runs Visual Studio Installer and repairs their installation, things will work well (but just once).

liors619
@liors619
thanks :)
Jakub Míšek
@jakubmisek
I was actually poking Mads to make it working :))
Sajal Verma
@sajalverma17
@yannduran Really appreciate the pointers. Thanks! I checked out FileIcons On first look, it seems to be updating registry for each file extensions. I guess I will have to see if this is feasible for my plugin as I am trying to dynamically mark/unmark .cs files in solution explorer based on a button provided by my plugin.
Robert van der Hulst
@RobertvanderHulst
Is there any news about what this means for extension developers?
2 replies
Wh0DKnee
@Wh0DKnee
Theres built-in functionality to pin a watch window when you hover over a variable when debugging - is there any way I can invoke this behavior from code?
1 reply
example.png
That little watch window that shows x = 5 and the little pin next to it. Ideally, I want to open the window and click the pin programatically.
Yann Duran
@yannduran
@sajalverma17 Ah yes, that makes sense I guess. I hope you find a way to do it dynamically.
@kaveeshd I'm glad to hear that you got it working!
Yann Duran
@yannduran
@kaveeshd here's your chance to let Microsoft know about the pain you had with WinForms and HighDPI If you faced HighDPI issues with #WinForms, please tell me what they were
Kaveesh Dashora
@kaveeshd
@yannduran thanks, i will respond to this.
Matt Lacey
@mrlacey
Is there a way to have a SingleFileGenerator not run when the generated code has been manually modified? I'm looking for ways to jumpstart writing code and am wondering if a custom, very terse syntax could be used in a file and then use a SFG to create a more standard version that can then be modified and extended if needed.
Yacoub Massad
@yacoubmassad_gitlab

Hello. Based on https://github.com/microsoft/VSSDK-Extensibility-Samples/blob/master/OperationProgress/OperationProgress/OperationProgressPackage.cs:

The comments suggest we should use a different piece of code to get IVsOperationProgressStatusService based on VS version: V16.1 or "Post Visual Studio 2019 Update 2".

Does this mean that one has to create two VSIX packages? Or is there a way at runtime to detect the VS version?

Yann Duran
@yannduran
@mrlacey what about a Source Generator instead?
Yann Duran
@yannduran
@yacoubmassad_gitlab have a look at how the Visual Studio Community Toolkit handles multiple versions of VS
Christopher Christou
@awschristou
Are there any issues for an extension that supports VS 2017 (15.0, 16.0] to target .NET Framework 4.6.1, or is it a requirement to target .NET Framework 4.6?
1 reply
Авдеев Вячеслав
@lsoft
yesterday Mads explained we will need to transfer the code of VSIX to a shared lib and add that files as a links to support both 2019+2022; if you have hundreds files you will probably need a few antidepressants to do that manually)) looks like we need a new VSIX to automate a working with shared libs + "linked" files))
Neil Henderson
@bluetarpmedia
@lsoft You don't need to add links to code files (e.g. .cs). Just drag your code files into the shared lib to copy/move it there, and remove from the original VSIX project. Then add a reference to the shared project from your VSIX project(s). Mads demo'd adding links to resource (Icon.png) files that are in the shared lib, but if you prefer you could also duplicate those files in each VSIX project.
Yacoub Massad
@yacoubmassad_gitlab
Thanks @yannduran

Based on this: https://devblogs.microsoft.com/visualstudio/async-loaded-net-projects-may-impact-visual-studio-extensions/

For some VS versions, Workspace.CurrentSolution will return an incomplete code model. (Partial Load Mode (PLM))

This is a new feature to enable faster loading of solutions.

In such versions, if we want to wait for the solution to "really load", we have to use IVsOperationProgressStatusService.

Also, based on this: https://github.com/microsoft/VSSDK-Extensibility-Samples/blob/master/OperationProgress/OperationProgress/OperationProgressPackage.cs

The API to get a IVsOperationProgressStatusService differs between VS 16.1 and "Post Visual Studio 2019 Update 2".

If I am to create a VS extension that targets VS 2017 and VS 2019 (multiple versions), how can I have a single VSIX for all versions?

If VS version > some version, I need to use IVsOperationProgressStatusService. And to get IVsOperationProgressStatusService I need to use different codes based on the version.

Or should I have three VSIX projects:

  1. For all VS versions before Partial Load Mode (PLM).
  2. For VS 16.1.
  3. For "Post Visual Studio 2019 Update 2".

?

@yannduran , the solution you suggested is based on compile time constants, does that mean I need multiple VSIX packages?
Yacoub Massad
@yacoubmassad_gitlab
Hello. Is IAsyncQuickInfoSource.GetQuickInfoItemAsync allowed to return null? This is not documented.
Авдеев Вячеслав
@lsoft
I am wondering what's the reason to support 16.1 if the user can updates to 16.latest with no costs?
Yacoub Massad
@yacoubmassad_gitlab
@lsoft , do you mean I shouldn't support 16.1?
Авдеев Вячеслав
@lsoft
it's your choice, I decided not to support VS older than 16.8 for example.
(and I also use IVsOperationProgressStatusService)
Авдеев Вячеслав
@lsoft
if I understand correctly supporting < 16.0 and >= 16.8 will make your VSIX easier. so I was wondering is there a real reason (real scenario may be) to support >= 16.0?..
Yann Duran
@yannduran
@yacoubmassad_gitlab no I don't believe so. the reason I mentioned the Community Toolkit was to show how it managed to provide the appropriate code based on VS version, the same scenario as you've described. You should be able to use that technique in a single VSIX as well, with multiple DLL's in a single VSIX, similar to what the Toolkit Nuget package is doing. I've also seen extensions dynamically load DLL's that are based on different VS versions
Andy Hippo
@werat

Hi everyone!

I'm working on an extension that provides a custom debug engine for Visual Studio -- https://github.com/googlestadia/vsi-lldb. The debug engine is similar to MIEngine (https://github.com/microsoft/MIEngine). The underlying debugger is LLDB and the extension provides all the necessary integrations (attach, stepping, natvis and expression evaluation, etc).

My question is about implementing custom code-completion in the Immediate Window.

The expressions in the Immediate Window are handled by IDebugExpressionContext2 [1] and IDebugExpression2. This works fine, when the user enters the expressions and hits Enter IDebugExpressionContext2::ParseText is invoked, IDebugExpression2 object is created and the expression is eventually evaluated [2].

Now I want to implement basic code-completion for the expressions in the Immediate Window. For example, to show a list of members when the user types foo-> and such. I can easily do this using my expression evaluation engine (https://github.com/google/lldb-eval), but I can't figure out how to implement it in Visual Studio.

I have found an interface IVsImmediateStatementCompletion2 [3]. Looking at the name, this seems like exactly what I want :) However I'm not sure how what is the proper way to impement this interface. The documentation says this interface should be implemented on the same object that implements IVsLanguageInfo -- this matches what I see in Roslyn [4].

My extension currently doesn't provide a language service implementation, only the debug engine. I've tried adding a dummy implementation like class MyLanguageService : IVsLanguageInfo, IVsImmediateStatementCompletion2 and registering it via [ProvideLanguageService] and [ProvideService]. After I registered it for ".cpp" files, I can see that methods for IVsLanguageInfo are being called (namely GetColorizer and GetCodeWindowManager), but IVsImmediateStatementCompletion2 is never triggered.

So here's the big question, how do I implement a custom completion for the Immediate Window in my DebugEngine? :) Thanks!

[1] https://docs.microsoft.com/en-us/visualstudio/extensibility/debugger/reference/idebugexpressioncontext2?view=vs-2019
[2] https://github.com/googlestadia/vsi-lldb/blob/121d52b74564a51dc7e860c7c1eb9729b20627b3/YetiVSI/DebugEngine/DebugStackFrame.cs#L222
[3] https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.textmanager.interop.ivsimmediatestatementcompletion2?view=visualstudiosdk-2017
[4] https://github.com/dotnet/roslyn/blob/dd21600f51cf5464b4721b69ab1c8e86bfa0c101/src/VisualStudio/Core/Def/Implementation/LanguageService/AbstractLanguageService%602.IVsImmediateStatementCompletion2.cs#L20

vasantha-kumar25
@vasantha-kumar25
If We want to deploy a VS extension project via a custom Installer (such as NSIS) instead of distributing via VSIX, Under what directory we might need to deploy the output files so that VS will detect them?
Erik Ejlskov Jensen
@ErikEJ
Can we publish 2 packages to the same Marketplace Id with an extension for VS 2019 and VS 2022 (as we now need to build two VSIX files) ???
Yann Duran
@yannduran
@ErikEJ no each extension would have to have its own id if it's not just a one package is installable on both 2017/2019
Robert van der Hulst
@RobertvanderHulst
@vasantha-kumar25 We deploy our extensions directly to the Common7\Ide\Extensions\OurProduct subfolder inside VS and then run VS with the /updateconfiguration command line option so it can detect our extension.
vasantha-kumar25
@vasantha-kumar25
@RobertvanderHulst Thank you :)
Andy Hippo
@werat
@RobertvanderHulst Does the "uninstall" flow work properly for you with this setup? I'm also deploying my extension by directly copying the files to the "Extensions" dir, but I also update the configs in "ProgramData\VisualStudio\Packages..." (writing path from memory, might not be exactly it). Without it, the "uninstall" button from Visual Studio (on vsixinstaller) doesn't work -- I get an error and the extension stays. I also noticed that this happens only if deploying the extension to the VS installation (i.e. "admin" mode). When deploying to "AppData..." (i.e. "user" extension), the uninstall works fine.
Sajal Verma
@sajalverma17
Can anyone suggest an approach for tagging a EnvDTE.ProjectItem in such a way that the tag value is not exposed, but private to my plugin. I am trying to classify some C# class files in SolutionExplorer, such that I can set a tag "MyFileTypeTag", with value: "GoodFile"/"BadFile"/etc..., then later get the same tag's value when user selects that EnvDTE.ProjectItem in SolutionExplorer.
CyrusNajmabadi
@CyrusNajmabadi
use a ConditionalWeakTable?
Sajal Verma
@sajalverma17
Ok thanks, I'll check out usages of ConditionalWeakTable, never used it before.
Robert van der Hulst
@RobertvanderHulst
@werat We do not use the uninstall button inside VS. The uninstaller for our setup clears the subfolder inside the Extensions folder, clears the ComponentModelCache and VTC folders in the users local appdata Microsoft\VisualStudio\15_uniqueId (and 16_uniqueid) folder and runs VS with /updateconfiguration again. That works for VS2017 and VS2019 at least.
This may not be the recommended way to do it, but it most certainly works for us
Robert van der Hulst
@RobertvanderHulst
I am wondering how others are handling the situation where the user splits the editor window, in relation to the Navigationbar. Are you creating your own VsCodeWindowManager and creating a single Dropdownbar for all textviews for the codewindow. Or are you creating a dropdown bar per textview in response to the VsTextViewCreated event. And how do you make sure that the right dropdown is shown when the focus switches between the 2 halves of the splitted file ?
vasantha-kumar25
@vasantha-kumar25

@werat Regarding the Uninstall Button in VS Extension and updates:

@RobertvanderHulst Does the "uninstall" flow work properly for you with this setup? I'm also deploying my extension by directly copying the files to the "Extensions" dir, but I also update the configs in "ProgramData\VisualStudio\Packages..." (writing path from memory, might not be exactly it). Without it, the "uninstall" button from Visual Studio (on vsixinstaller) doesn't work -- I get an error and the extension stays. I also noticed that this happens only if deploying the extension to the VS installation (i.e. "admin" mode). When deploying to "AppData..." (i.e. "user" extension), the uninstall works fine.

When We deploy the Extension directly to Common7\Ide\Extensions\OurProduct Location the Uninstall button is disabled by default. Can I kindly know What configs did you add to"ProgramData\VisualStudio\Packages..." to make Uninstall button work?

1 reply
Chris Varone
@Vero1010110_twitter
Hello all, I'm having a real compatibility issue. I'm developing in VS2019 and I need things to work in VS2017.
 private async Task LoadDataGridAsync()
        {
            try
            {
                // if we are not executing in the main thread then we need to go to the main thread and alter the UI so we can update the data grid. 
                if (thisControl.Dispatcher.Thread != System.Threading.Thread.CurrentThread)
                {
                    await Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
When I have this API in my code VS2017 just has a conniption.
The SwitchToMainThreadAsync()
I need a way to get to the main thread an modify the GUI.
Chris Varone
@Vero1010110_twitter
SO experimentation so far has shown that a synchronous command to update the GUI thread seems to be the only way to get this to work.
i.e. ThreadHelper.Generic.BeginInvoke(() =>
{