Skip to content

Find a way to bring back AstVisitor2 usage #276

Closed

Description

@daviwil

After the recent design of the PSES host to be loaded as a module inside of powershell.exe, it appears that one of our multi-version PowerShell support tricks don't work any longer. When a user running PSv3 or PSv4 loads up Microsoft.PowerShell.EditorServices.dll it crashes due to the use of AstVisitor2 in the FindSymbolsVisitor2 class. For now I'm just going to comment out this class so that I can get a fix out for those impacted by the 0.7.0 release.

In the near future we may have to split out features that only work in specific PS versions into separate DLLs that are loaded and registered dynamically depending on the PS version present.

Activity

  1. added this to the milestone on Aug 23, 2016
  2. rkeithhill commented on Feb 21, 2017

    @rkeithhill
    Contributor

    I was looking at adding support for class and enum symbols but it requires AstVisitor2. I ran across your comment in the commented out FindSymbolsVisitor2 class.

        // TODO: Restore this when we figure out how to support multiple
        //       PS versions in the new PSES-as-a-module world (issue #276)

    If we are already selectively loaded assemblies based on the platform e.g.:

    if (!$PSVersionTable.PSEdition -or $PSVersionTable.PSEdition -eq "Desktop") {
        Add-Type -Path "$PSScriptRoot/bin/Desktop/Microsoft.PowerShell.EditorServices.dll"
        Add-Type -Path "$PSScriptRoot/bin/Desktop/Microsoft.PowerShell.EditorServices.Host.dll"
    }
    else {
        Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.dll"
        Add-Type -Path "$PSScriptRoot/bin/Core/Microsoft.PowerShell.EditorServices.Host.dll"
    }

    Why not continue to build different assemblies for v3, v4 and v5 and load those depending on the PSVersion?

  3. daviwil commented on Feb 21, 2017

    @daviwil
    ContributorAuthor

    That's what I'll end up doing. I'm going to be doing a big refactoring of the PSES codebase once I get 0.10.0 out, part of that will be restructuring the assemblies to enable some version-specific features without causing the assembly loader to throw exceptions.

  4. TylerLeonhardt commented on Jan 16, 2018

    @TylerLeonhardt
    Member

    Looks like this one might be bundled into the whole "support for v3 and v4 or not" debate.

  5. removed this from the milestone on Aug 17, 2021
  6. fflaten commented on Aug 15, 2022

    @fflaten
    Contributor

    Fixed by PowerShell/vscode-powershell#1310, right?
    Will move 4 of 6 visitors to AstVisitor2 in #1886

  7. fflaten commented on Feb 7, 2023

    @fflaten
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions