Skip to content

Review all if/def and Unix specific code after moving to .NET Core 2.0 #3565

Closed

Description

PowerShell Core is moving to .NET Core 2.0 with PR #3556. Once that PR is merged, we need to review all if/def and Unix specific code to:

  • Clean up the code
  • Make sure the code make sense and is not a temporary hack

An Example (Please remove when fixed)

Platform.InternalGetFolderPath in src/System.Management.Automation/CoreCLR/CorePsPlatform.cs has the following code:

                case System.Environment.SpecialFolder.ProgramFiles:
                    folderPath = "/bin";
                    if (!System.IO.Directory.Exists(folderPath)) { folderPath = null; }
                    break;
                case System.Environment.SpecialFolder.ProgramFilesX86:
                    folderPath = "/usr/bin";
                    if (!System.IO.Directory.Exists(folderPath)) { folderPath = null; }
                    break;
                case System.Environment.SpecialFolder.System:
                case System.Environment.SpecialFolder.SystemX86:
                    folderPath = "/sbin";
                    if (!System.IO.Directory.Exists(folderPath)) { folderPath = null; }
                    break;

It use /bin for ProgramFiles, /usr/bin for ProgramFilesX86 and /sbin for System and SystemX86. It's not clear if this is appropriate, so code like this should be reviewed.

Activity

  1. iSazonov commented on Apr 14, 2017

    @iSazonov
    Collaborator

    Dongbo Wang (@daxian-dbw) If this does not require a lot of time please create a sln file - without it IntelliSense does not work in VS Code (after json files was removed) properly.

  2. daxian-dbw commented on Apr 14, 2017

    @daxian-dbw
    MemberAuthor

    Ilya (@iSazonov) IntelliSense doesn't work for you? It works for me in VS Code after moving to .csproj file. Just run Start-PSBuild -publish, then open the .csproj file in VS Code, and if you see a prompt on top of VS Code asking to restore, just click Close, and things like reference resolution and IntelliSense should just work.
    I thought creating a sln file would be just as simple as opening powershell-win-core.csproj in VS2017 and then saving a solution file, but it turned out the .csproj doesn't work properly within VS2017. I haven't got the chance to figure out why and fix it.

  3. added this to the milestone on Apr 14, 2017
  4. jeffbi commented on Apr 15, 2017

    @jeffbi

    Dongbo Wang (@daxian-dbw), Ilya (@iSazonov) IntelliSense doesn't work for me either. I tried following the steps above, but no joy.

  5. iSazonov commented on Apr 15, 2017

    @iSazonov
    Collaborator

    As mentioned in #3356 there is a limitation dotnet/vscode-csharp#1156
    So we need sln file in repo root folder.
    I suggest to continue the discussion in #3356.

  6. iSazonov commented on Apr 27, 2017

    @iSazonov
    Collaborator
  7. modified the milestones: , on May 15, 2017
  8. andyleejordan commented on Aug 7, 2017

    @andyleejordan
    Member

    These hacks are finally being cleaned up? Huzzah!

  9. iSazonov commented on Nov 26, 2018

    @iSazonov
    Collaborator

    I created 3 PRs to address #if CORECLR.
    There are still 75 places left but they are too complicated for me. Leave them to MSFT team.

    /cc Steve Lee (@SteveL-MSFT)

  10. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  11. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  12. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  13. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalityResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions