Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
error CS1579: foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public instance or extension definition for 'GetEnumerator'

I'm getting this error when trying to update my extension to VS2022

public VCFile FindFile(VCProject project, string name)
            foreach (VCFile file in project.Files)

The code works fine with previous versions, not clear to me why these dynamic properties are not working here

I'm referencing the latest SDK and ProjectSystem packages
    <PackageReference Include="Microsoft.VisualStudio.Sdk" Version="17.0.31902.203" />
    <PackageReference Include="Microsoft.VisualStudio.ProjectSystem" Version="17.0.1313-pre" />
Mike Hershberg
I'm using the Community Toolkit to create a command. My command needs to use the ITextSearchService but if I add a property with the [Import] attribute the property is always null. Why doesn't this work?
internal sealed class MyCommand : BaseCommand<MyCommand>
    internal ITextSearchService TextSearchService { get; set; }
5 replies
Vyacheslav Egorov
Hello there, I'm updating my custom debugger extension for VS 2022 and tool tips that I return from GetQuickInfoItemAsync are no longer displayed.It seems like they are now being overriden by debugger data tips, but even in cases when debugger can't display its own data tip, my QuickInfoItem is still not visible.
Did the API around GetQuickInfoItemAsync change in the new version?
Vyacheslav Egorov
I'm developing a debugger extension for a language that is not natively supported (Lua) and I quite like that VS 2022 now calls 'IDkmLanguageExpressionEvaluator.EvaluateExpression' with the word under the cursor, but sadly VS doesn't know about other language rules and if you hover the 'prop' in an expression like 'obj.prop', EvaluateExpression is called with "prop" and not "obj.prop". My custom GetQuickInfoItemAsync handler was used to handle this.
Venkat A
How to get output dll path
i am using Community.VisualStudio.Toolkit
Ben Medina-Orton
I'm trying to write an extension that runs an external tool when a readonly file is attempted to be edited. I don't really know where to start. Would I be able to achieve this somehow via the IWpfTextView instance for each document?
The overall flow I want to enable is:
1 - User opens readonly file in Visual Studio.
2 - They attempt to make an edit to the file.
3 - My extension detects this and runs an external tool to make the file editable.
4 - The user's edit from step 2 is applied.
Thanks in advance for any help!
2 replies
Mike Hershberg
Hello. Really stuck without the TextSearchService. Still haven't figured out why I can't [Import] it in my Community Toolkit-based project. Any help is appreciated.
Hello. I started developing a project type with CPS WindowsScript sample. I use Visual Studio 2022. A new project can be created from the project template and is loaded. But my export class in the package that applies to the capability is not called. Why?
Hey, Description: Method not found: &apos;System.String EnvDTE._DTE.get_Version()&apos;.&#x000D;&#x000A;System.MissingMethodException any idea about this error, trying to upgrade my extension to vs 2022
found the issue, I have two VSIX projects in the same solution, one for VS 2022 and another one for previous versions, here the old VSIX was deployed to the exp hive..., things started working again once Ice clean the exp hive and deploy the correct VSIX.
Hi does anyone know where SSMS 18.10 keeps track of extensions to load -mine is trying to load something that doesn't exist and so I can't open a new editor window and I am having no luck finding out how to remove the bad entry. I know the name of the pkgdef it is trying (And failing) to load.
1 reply

Hey, I have a custom project page registered with

    internal class ProjectDesignerPageProvider : IVsProjectDesignerPageProvider
        public Task<IReadOnlyCollection<IPageMetadata>> GetPagesAsync() =>
            Task.FromResult((IReadOnlyCollection<IPageMetadata>)ImmutableArray.Create(new SliceCompilePageMetadata()));

But GetPageAsync is not called by Visual Studio 2022, did anything changes on how these property pages work? so far the same works fine with 2017 and 2019, and I cannot figure why this doesn't work with vs 2022

Jan Bartholomäus-Jung
Hey guys. Is it possible to update content of toolwindow from within package class? are there any resources for things like that?
hi all... I created my own debugging extension for our webserver (this works) but I try to start Chrome at the same time and attach the JavaScript debugger to it. I need to fill the IDebugLaunchSettings for it and... I've no idea how to do it. What's the value for LaunchDebugEngineGuid to set? I tried {74c8030c-83da-48ab-63ff-d814e06202f8} and {8c52fb37-f184-4444-abba-fc22bf7d4106} (I got them from the private registry hive of VS 2017) but it cannot start because of an "invalid pointer" (a popup says that)... can someone tell me how to do this? Or how to find all the possible debugger engines registered in the system?
Is it possible to publish two VSIX packages for the same extension? one targets VS 2022, and the other targets all previous versions
3 replies
just a little question... do the interfaces and the way the extension system is implemented make sense to you? ... I mean... is this really understandable for you? so...really logic? ... I've always a problem understanding the idea behind all this... without examples I'm completely lost
Aleksandr Danchenko

Hey 👋

I'm testing my extension on VS2015, VS2017 and VS2019. On 2019 version all works fine, but for 2015 and 2017 it throw an error

System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Не удается найти указанный файл. File name: 'System.Runtime.CompilerServices.Unsafe, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at System.Span1..ctor(T[] array)
at System.Text.Json.JsonSerializer.DeserializeTValue
at System.Text.Json.JsonSerializer.DeserializeTValue
at Common.Json.DeserializeT
at Extension.Service.ApiService.<GetSastSettingsAsync>d5.MoveNext() in C:\Projects\VisualStudio.Extension\ApiService.cs:line 50
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Extension.Service.ApiService.<IsCodeEnabledAsync>d
6.MoveNext() in C:\Projects\VisualStudio\Extension\Service\ApiService.cs:line 69`

I tried to add this in my app.config file

<bindingRedirect oldVersion="" newVersion=""/>

But it doesnt help.

Maybe some one can suggest solution/fix?


Sajal Verma

Is anybody else having trouble with the VsixPublisher.exe tool shipped with VS2022? I am using the windows-2022 image in my Github Actions to publish my extension, but the tool ALWAYS throws an exception from the command line, even though it returns a success message. This happens NO MATTER how to invoke the tool from the command line. For reference, the VS2022 version of this tool is found here: C:\Program Files\Microsoft Visual Studio\2022\Professional\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe.

Unhandled Exception: System.MissingMethodException: Method not found: 'Void Microsoft.VisualStudio.RemoteControl.RemoteControlClient..ctor(Microsoft.VisualStudio.Utilities.Internal.IRegistryTools, System.String, System.String, System.String, Int32, Int32, Int32)'.
at Microsoft.VisualStudio.Telemetry.TelemetryManifestManager.Start(String hostName, Boolean isDisposing)
at Microsoft.VisualStudio.Telemetry.TelemetrySession.Start(Boolean checkPendingAsimovEvents)
at Microsoft.VisualStudio.Sdk.VsixPublisher.TelemetryLogger.CreateTelemetrySession()
at Microsoft.VisualStudio.Sdk.VsixPublisher.TelemetryLogger.get_TelemetrySession()
at Microsoft.VisualStudio.Sdk.VsixPublisher.Program.Main(String[] args)
VSSDK: information VsixPub0041 : Publisher 'SajalVerma' is now logged-in.
Error: Process completed with exit code 1.

If you see the logs, the tool does log me in from the command line, but also throws an exception leading to my publish pipeline failing. If I try logging in from the VS2019-shipped version of it, it works fine.

Trying to invoke the help option also throws this exception from command line, leading me to believe this is a bug: C:\Program Files\Microsoft Visual Studio\2022\Professional\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe --help

Is this community having a Discord? If not, the Discord and this here could be connected with each receiving the messages of the other. Anyone else would be interested? As a full time extension developer, it'd be cool to hangout with other extension devs, helping each others live etc. This gitter is treated like a forum more than a live chat.
You load code into an editor you hide (I guess could be an invisible one), take a VISUAL snapshot then rince/repeat: with the same editor, you load lines of code to 'screenshot' them. In some scenarios, this is smarter than opening a bunch of editors. BUT ...
Did that and it's great but the coloring is partial and doesn't include semantic coloring... so for example, if you have "Console.Writeline(..." the word Console isn't colored as a type.
I guess I would have to wait for all the classifiers/taggers to have their turn on the code before visually capturing, but how? Any idea would be greatly appreciate as I already lost days on this problem....
I tried increasing the priority of the pertinent classifier without avail. I tried implementing my own semantic classifier to get better control. Didn't worked. I tried triggering the classifiers to make them do their job before the screenshoting (i.e. passing through one of my tagger/classifier to mark the code as having changed . event "tagchanged' etc).. also didn't worked.
Kaveesh Dashora
In VS2022, the interfaces IVsSolutionLoadManager and IVsSolutionLoadManagerSupport have been removed. What is the recommended way now to handle solution load?
1 reply
I was using WPF windows in my extension made with VS2017, then used with VS2019.
With VS2022 I am not able to add a WPF window ! if I try to add a WPF user control I have an error on missing reference to Microsoft.VisualStudio.Shell.15.0.
I haven't found anything on adding WPF window or on not adding WPF window.
Someone can help me ?
8 replies
Aleksey Nikolaev
Hello, guyz. Can i ask a question? Is it possible to use DB connection in the VS extension?
Paul Schroeder

I believe so, @leksycode:matrix.org - are you familiar with the IWizard interface? https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-wizards-with-project-templates Visual Studio provides the IWizard interface that, when implemented, enables you to run custom code when a user creates a project from a template.

Project template customization can be used to display custom UI that collects user input to customize the template, add additional files to the template, or any other action allowed on a project.

So, @leksycode:matrix.org, my answer above has to do with using a DB connection during installation. If your extension either has the user provide/configure a connection string (through user input), then, yes, your extension can use a database connection during regular operation.
Kunjahamed P
Hi, how to add new menu in solution expolrer > add menu
SolutionFolder.AddGroup.AddMenu is not working
Hello! I'm trying to figure out how you have a task/thread act as a 'background task' in the VS toolbar
I've been going over the docs but haven't figured that one out yet
what do you mean by "VS toolbar" @ameisen ?
at the bottom left of visual studio, there's a 'background tasks' indicator
How do you create your own 'background tasks' that can be put there?
ah. that's easy
one sec
sorry, was pulled away
y9ou want to look at IVsTaskStatusCenterService
Ah, fantastic, thank you
Is this community having a Discord? If not, the Discord and this here could be connected with each receiving the messages of the other. Anyone else would be interested? As a full time extension developer, it'd be cool to hangout with other extension devs, helping each others live etc. This gitter is treated like a forum more than a live chat.
To use Discord as a community would be better.!:)
Anyone interested in a future Discord for this community, reply to this message and we'll write you if it becomes a thing.
3 replies
Added you to the list/thread @Meda97