Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
pkruk2
@pkruk2
I'm getting performance warning from VS 2019 about a window. Performance Manager says the window adds 6-7s on average. But when I profile it according to https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-diagnose-extension-performance?view=vs-2019 I only see around 3s spent in Startup Thread in my code. Why I don't see the full 6-7s? (The window is not an async window, and the warning is shown only in some cases - when I open VS without a solution and then choose a solution in the start screen)
Could it be spent in BLOCKED_TIME, where there is no my code in stack trace, so it's filtered out by IncPats?
pkruk2
@pkruk2
I've dropped my code time to around 1s, but VS still shows performance warning with around 5s ...
sean echevarria
@sean-e
@pkruk2 have you changed the version number in your vsix manifest? I wonder if that resets the record...
briank237
@briank237
hello - I'm implementing IDeployProvider and need access to the output path of the project. How can I get that?
briank237
@briank237
Ok - I got the path now. Next, I created a general project property (through XAML) and I have a VSIX custom command that needs to set that property. Is that possible?
pkruk2
@pkruk2
@sean-e record was reset because I was resetting VS experimental instance
Bruno Colaço
@bcolaco
Hi all! I'm writing an extension that uses VS Project System and works as expected for .Net Framework C# projects. However, for .Net Standard C# projects, even though they are listed as Solution children all their properties are empty (Name, Type, etc).
Does the VS Project System support .Net Standard C# projects? Any tip on how to use it?
Thanks
Matt Lacey
@mrlacey
Is there a way to know when an Options page (inheriting from DialogPage so it as the Grid layout) is changed? Or failing that when the options dialog is closed (so I can check for, or just assume, changes)?
Also, is there a simple way for an adornment to know when a package has finished loading?
For reference, I have a configurable adornment and the configuration is done through an options page tied to the package. I want to ensure the adornment displays when the package finishes initializing and automatically updates when any options are changed.
Jialong Cheng
@jialongcheng
@pkruk2. There are two ways to mitigate: 1. Investigate the BLOCKED_TIME issue. For that, you can first find the start and end time of the BLOCKED_TIME, then take a look at CPU_TIME for threads other than the startup thread. 2. You could try to migrate your tool window to async tool window. Sample code here: https://github.com/Microsoft/VSSDK-Extensibility-Samples/tree/master/AsyncToolWindow
fsnick
@fsnick
Is there an API for requesting workload installs from within VS?
From the code itself, not a VSIX
Matt Lacey
@mrlacey
@fsnick YOu can detect which workloads are installed but I don't think there's a way to directly request that something which isn't installed be installed. This would require looking up what's available and its source path. That information is available in the updater (which I don't think has any exposed automation APIs) but not in VS itself.
Milan Mikuš
@Mylan719
Hi,
What is the best way to subscribe to document open event in VS2017/VS2017?
Is there like new command system command for it or something?
fsnick
@fsnick
Opening of the editor? Can be handled by MEF export of ITextViewConnectionListener for a specific content type, or more generally through RDT events
Milan Mikuš
@Mylan719
RDT as in IVsRunningDocTableEvents ?
fsnick
@fsnick
Yep
But MEF can listen for the less specific content types also, such as text or any as far as I know
All depends on what your integration's all about
Milan Mikuš
@Mylan719
whats the difference between ITextViewConnectionListener and IVsTextViewCreationListener?
Milan Mikuš
@Mylan719
Sorry another question. Visualstudio is balming my extension for 1600 milisecond writing slowdown. Can I see somewhere where (which command/code) was mesured and caused the delay?
Mads Kristensen
@madskristensen
@Rishabh-V the two .json files are for the Marketplace and the VSIXInstaller.exe
@mrlacey Yes, you'll find method to override on the DialogPage base class that are called when settings are saved etc.
benji
@epicabsol
How is the VS 'Format Document' command linked to the current language being edited, and how could I add support for a custom language?
Cameron
@cameron314
@epicabsol Not sure if this is the correct way, but you can intercept the command using an IOleCommandTarget registered from a text view creation listener via IVsTextView.AddCommandFilter
if (pguidCmdGroup == VSConstants.VSStd2K && nCmdID == (uint)VSConstants.VSStd2KCmdID.FORMATDOCUMENT) ...
Ed Dore
@EdDore
@epicabsol You'll need to handle the CMDSETID_StandardCommandSet2K::ECMD_FORMATDOCUMENT command from your language services' command filter. If you're language service leverages a custom Microsoft.VisualStudio.Package.ViewFilter class, you'll want to ensure it's CanReformat returns true, and then implement the ReformatDocument and ReformatSelection methods according to your language type.
Richard Khoury
@rkhoury

Hey all,
I have some questions regarding solution/project iteration. I'm trying to create a list of all the files in all my projects using IVsSolution's GetProjectEnum, and then for each IVsProject using the IVsHierarchy interface to iterate all item ids. Unfortunately this appears to iterate every item including 'External Dependencies' which is HUGE in the solution I'm testing with. Realistically I want all files excluding anything in 'External Dependecies', so what's the correct way to generate this list?

I've also noticed that the same information could possibly be obtained using EnvDTE.Solution/Project etc. If this is actually possible, is either way preferable, more correct, better performing, ...?

Richard Khoury
@rkhoury
(I've just tried using the EnvDTE approach and can't quite work it out... )
fsnick
@fsnick
@rkhoury use EnvDTE.DTE.Solution.Projects. Or even better, CPS if that's available for you
Richard Khoury
@rkhoury
Thanks for the headsup, @fsnick . Is there an example of how to do this? I couldn't seem to get all the information I wanted from the Project.ProjectItems.ProjectItem iteration.
I also tried to step through the structures during iteration but ... COM.
Richard Khoury
@rkhoury
Looks like I'm not in the right timezone as most of the people on this channel. If anyone can point me to an example of how to use the EnvDTE approach, or perhaps answer how it might be possible to filter out the External Dependencies from the IVsHierarchy iteration, I would be very grateful.
Sam Harwell
@sharwell
@rkhoury When determining whether DTE is a good approach, ask yourself if it's acceptable to the experience of the extension have a 1-5 second delay on every call that needs to use DTE. If the operations occur frequently enough or at large enough scale where this would be a problem, you'll save yourself a bunch of time by eliminating DTE as an option early and focusing exclusively on other approaches.
Sam Harwell
@sharwell
From your comments, it sounds like you're working on a C++ project. Is that the only type of project you need to examine? If so, ideally we can get someone familiar with that integration specifically to help identify the most efficient way to get information about files in the project.
Richard Khoury
@rkhoury
For the most part they are c++ projects, but ideally the plugin I'm developing would be agnostic. I'm assuming, based on your comments, that this is not trivial to use the IVsHierarchy approach in a generic way?
Richard Khoury
@rkhoury
So I'll definitely stop looking that the DTE approach if that's going to be particularly horrible for performance. The current iteration through a solution ( that I'm considering is a near-worst-case one) using the IVsHierarchy method yields around 80,000+ elements although ~65,000 are duplicates. This iteration is already 15+ seconds long so i'd hate for it to be getting worse.
I'm hoping that removing the duplicates during the iteration process (by excluding directories like References and External Dependencies) will speed things up.
Richard Khoury
@rkhoury
I just now discovered the ProjectCollection.GlobalProjectCollection mechanism which looked quite hopeful despite it being yet another way to iterate projects (why are there so many!?). It looked so hopeful until it didn't do anything for my solution full of c++ projects. :(
Anyway, so now I'm back trying to figure out how I can get group names from the IVsHierarchy so I can specifically exclude References and External Dependencies.
Alex Lorimer
@aodl
Does anyone know which nuget package the IDebugProfileLaunchTargetsProvider2 interface is defined in? It's not in the obvious places unfortunately, but I need to export an implementation of it :/
Robert van der Hulst
@RobertvanderHulst
The C# project system sorts the "Properties" and "Reference" items under the project item before all the normal source items. In our (custom) project system "Properties" is sorted between "O" and "R". Does anybody know what "trick" they have used to sort these 2 at the start of the list of items? (Our project system is based on MPF).
Bert Huijben
@rhuijben
@rkhoury, @sharwell The IVsHierarchy is the way to go. The way to filter the items is via the VSHPropID properties on the items. (And in some cases via the IVsScc interfaces if the things you want are similar to what a Source Control provider would do). I wrote a lot of code for AnkhSVN that way... And as far as I can tell it is the only properly supported route where you don't have to implement support for each project type yourself.
Bert Huijben
@rhuijben
(The IVsScc route exposes some hidden files that are not shown in the tree... while it hides those external files. So it might work for you)
https://ctf.open.collab.net/svn/repos/ankhsvn/trunk/src/Ankh.VS/Selection/ contains the most relevant code. (Username: guest, no password. Location is a Subversion repository, but you can just access it via the web)
Richard Khoury
@rkhoury
Many many thanks, @rhuijben . I'll try that tomorrow and let you know how it went.
Richard Khoury
@rkhoury
I didn't get much of a chance to look through all the Ankh.VS/Selection code, but it does look slightly more hopeful that the IVsSccProject2 interface could kinda solve my problem.
I'm still amazed at just how difficult it is to get knowledge that a particular IVsHierarchy element is the "External Dependencies". For my application I would be more than happy to hardcode that (and References) in so I don't traverse those trees.
Bert Huijben
@rhuijben
@rkhoury you can check the VSHPROPID_ExternalItem property on the IVsHierarchyItem. That should work for the standard project types. But there are a lot of strange/uncommon project types out there that just implement enough for them to work properly in their usecase. (As SCC provider you are usually outside those tested boundaries... and need fixups in quite some places. Websites (without project files) are a particular nasty case as just walking the hierarchy of those projects changes the projects hierarchy. See the side effects check in that AnkhSVN code as the most generic workaround for that)
Cameron
@cameron314
@aodl Check out the SortPriority property on HierarchyNode. Typically it is overridden for the various special node types