GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Enable discovering modules that have names same as a culture (e.g. Az) by SteveL-MSFT · Pull Request #8777 · PowerShell/PowerShell

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Jan 29, 2019 •
edited by daxian-dbw
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

PR Summary

The suggested fix by Jason Shirk (@lzybkr) is to not do this additional culture name check for the first set of folders (which should be the module name). This PR fixes a few things:

  • Add logic to skip checking for possible resource directories for the first set of sub directories from the top level.
  • There was an additional skip if the folder is hidden, rather than doing an explicit attribute check, change the EnumerationOption to skip hidden folders.
  • Since the IsPossibleModuleDirectory() helper now only checks to see if the name matches a culture, renamed to IsPossibleResourceDirectory()
  • When getting the default modules, we don't search recursively into individual module folders, so removed additional check for possible resource directory.

PR Context

The current code always checks if a potential module folder is named after a culture and assumes it contains resources files as an optimization to avoid looking in that folder. This results in the new Az module not being found as Az is also the name of a culture.

Fix #8125

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Change is not breaking
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: or [ WIP ] to the beginning of the title (the WIP bot will keep its status check at Pending while the prefix is present) and remove the prefix when the PR is ready.
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed
      • Issue filed:
  • Testing - New and feature
    • N/A or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed
      • Add [feature] to your commit messages if the change is significant or affects feature tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SteveL-MSFT
[feature] enable discoverying modules that have names same as a culture
69cb998
@SteveL-MSFT Steve Lee (SteveL-MSFT) assigned Dongbo Wang (daxian-dbw) Jan 29, 2019
@SteveL-MSFT
Steve Lee (SteveL-MSFT) requested review from Dongbo Wang (daxian-dbw) and Rob Holt (rjmholt) January 29, 2019 02:39
@SteveL-MSFT
Steve Lee (SteveL-MSFT) requested review from Bruce Payette (BrucePay), Francisco Gamino (Francisco-Gamino) and Aditya Patwardhan (adityapatwardhan) as code owners January 29, 2019 02:39
@SteveL-MSFT
[feature] fix CodeFactor issues
907bf2d
@SteveL-MSFT Steve Lee (SteveL-MSFT) mentioned this pull request Jan 29, 2019
Test-ModuleManifest fails if RequiredModules in module manifest contains entry 'Az' #8703
Closed
rjmholt
Rob Holt (rjmholt) approved these changes Jan 29, 2019
View reviewed changes

@rjmholt Rob Holt (rjmholt) left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/System.Management.Automation/engine/Modules/ModuleUtils.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT
address Rob's feedback
3ed7768
@SteveL-MSFT
Steve Lee (SteveL-MSFT) force-pushed the az-module-discovery branch from 4314122 to 3ed7768 Compare January 29, 2019 04:09
iSazonov
Ilya (iSazonov) reviewed Jan 29, 2019
View reviewed changes
Comment thread src/System.Management.Automation/engine/Modules/ModuleUtils.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/System.Management.Automation/engine/Modules/ModuleUtils.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT
address Ilya's feedback
50d501f
iSazonov
Ilya (iSazonov) reviewed Jan 29, 2019
View reviewed changes
Comment thread src/System.Management.Automation/engine/Modules/ModuleUtils.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT
change use of System.IO.Path to just Path
60ea02c
daxian-dbw
Dongbo Wang (daxian-dbw) requested changes Feb 19, 2019
View reviewed changes
Comment thread src/System.Management.Automation/engine/Modules/ModuleUtils.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT
[feature] address Dongbo's feedback
4e1541c
daxian-dbw
Dongbo Wang (daxian-dbw) approved these changes Feb 20, 2019
View reviewed changes

@daxian-dbw Dongbo Wang (daxian-dbw) left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SteveL-MSFT

Steve Lee (SteveL-MSFT) commented Feb 20, 2019

Copy link
Copy Markdown
Member Author

The static analysis failure is not related to this PR. I'll submit a fix for it in a separate PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit b06ad6a into PowerShell:master Feb 20, 2019
@daxian-dbw

Dongbo Wang (daxian-dbw) commented Feb 20, 2019

Copy link
Copy Markdown
Member

The PR description is updated as we are not using recursion when searching for modules.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw Dongbo Wang (daxian-dbw) added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Feb 20, 2019
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the az-module-discovery branch February 20, 2019 20:54
@ronhowe

Ron Howe (ronhowe) commented Feb 28, 2019

Copy link
Copy Markdown

Could someone help me understand the delivery vehicle and timing for this fix? Is this a fix for Windows PowerShell 5.1 or for PowerShell Core (6.0)? If Windows PowerShell 5.1, would that mean delivery would be part of a 5.2 type release? Are consumers today completely blocked from building module dependencies on the new Az module until this is resolved?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Feb 28, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Ron Howe (@ronhowe) The fix is only for PowerShell Core. You'll get it in PowerShell Core 6.2 RC in hours and in release PowerShell Core 6.2 in weeks.

Windows PowerShell 5.2 is not expected. Although MSFT may port this fix to 5.1.

Are consumers today completely blocked from building module dependencies on the new Az module until this is resolved?

The problem is only for auto discovering. You could use full path to explicitly load the module.

lukeb1961 reacted with thumbs down emoji
All reactions
  • 👎 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joeyaiello

Joey Aiello (joeyaiello) commented Feb 28, 2019 •
edited by daxian-dbw
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Ron Howe (@ronhowe): to reiterate what Ilya (@iSazonov) said, our bar for servicing Windows PowerShell is very high now, and we do not plan to do a 5.2 release. This has resulted in a small handful of security and accessibility fixes, and some bug fixes to fix regressions associated with those two.

That being said, I want to talk to the Azure PowerShell team about this (/cc Scott Phibbs (@sphibbs) and Mark Cowlishaw (@markcowl) for context), as I don't want us limiting the adoption of Az in any way.

In the meantime, using Import-Module Az explicitly (even without the full path, I believe), the module will load and you can use it.

Apparently, it may also be the case that RequiredModules will fail because it secretly uses Get-Module -ListAvailable under the hood (which is where we're doing the locale optimization).

But like I said, I'll follow up with the Azure PS to get their sense of the impact.

Pure curiosity and off-topic, but I'd also love to hear what's keeping you from using PowerShell Core. :)

lukeb1961 reacted with thumbs down emoji
All reactions
  • 👎 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joeyaiello

Joey Aiello (joeyaiello) commented Feb 28, 2019

Copy link
Copy Markdown
Contributor

Dove a little deeper on this...Ron Howe (@ronhowe): what exactly is the problem you're experiencing?

We've confirmed that RequiredModules doesn't work with Az, but Az is a phony module that exports nothing, and you shouldn't be pulling every single Az.* module into your RequiredModules, you should be explicitly specifying the Az.* modules that you need.

Additionally, because Az exports nothing and is the only module affected here, autoloading shouldn't actually be impacted for any of the cmdlets in Az.* modules.

So again, how are you actually being affected here?

lukeb1961 reacted with thumbs down emoji
All reactions
  • 👎 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ronhowe

Ron Howe (ronhowe) commented Feb 28, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Dove a little deeper on this...Ron Howe (@ronhowe): what exactly is the problem you're experiencing?

We've confirmed that RequiredModules doesn't work with Az, but Az is a phony module that exports nothing, and you shouldn't be pulling every single Az.* module into your RequiredModules, you should be explicitly specifying the Az.* modules that you need.

Additionally, because Az exports nothing and is the only module affected here, autoloading shouldn't actually be impacted for any of the cmdlets in Az.* modules.

So again, how are you actually being affected here?

I just read this and that's the exact problem. I can try to be more selective about what my module imports.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ronhowe

Ron Howe (ronhowe) commented Feb 28, 2019

Copy link
Copy Markdown

As to why we aren't using PowerShell Core? I'm all for that. It's a bit more difficult to spearhead that adoption across my company. I am at the frontline of that effort, but it's a much slower ship and we have more immediate needs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sphibbs Scott Phibbs (sphibbs) mentioned this pull request Mar 27, 2019
Get-Module Az -ListAvailable doe not work on Windows Powershell 5.1 Azure/azure-powershell#8880
Closed
@KevinMarquette

Kevin Marquette (KevinMarquette) commented Apr 1, 2019

Copy link
Copy Markdown
Contributor

The impact is that the user is given the AZ as an easy way to instal and manage the Azure module with all it's dependent modules. But the user cannot call Get-Module to see what version of the module they have.

With everyone writing their own module install\update logic, we have to walk the $env:psmodulepath just for this module to determine if we should install the module or update it. So we are leaving it on the end user to solve for this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vexx32

Rain Sallow (/u/ta11ow) (vexx32) commented Apr 1, 2019

Copy link
Copy Markdown
Collaborator

You'd think that the Azure team would be verifying that the module works as expected in a majority of use cases before finalizing a module structure that is actually broken on both the supposedly supported platforms.

I guess for whatever reason... these cases were overlooked. I don't know that I could fault the PS team for this behaviour moreso than the Azure team for not checking that the module functions as expected with the structure they chose. :/

KevinMarquette reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lukeb1961

lukeb1961 commented Oct 14, 2019

Copy link
Copy Markdown

Both teams are failing ME - the user.
by not fixing in 5.x and by the AZ name not being tested properly.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@SteveL-MSFT @daxian-dbw
Enable discovering modules that have names same as a culture (e.g. Az) (
443f4ce
PowerShell#8777)

Here are the major changes:
- Add logic to skip checking for possible resource directories for the first set of sub directories from the top level.
- There was an additional skip if the folder is hidden, rather than doing an explicit attribute check, change the `EnumerationOption` to skip hidden folders.
- Since the `IsPossibleModuleDirectory()` helper now only checks to see if the name matches a culture, renamed to `IsPossibleResourceDirectory()`
- When getting the default modules, we don't search recursively into individual module folders, so removed additional check for possible resource directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iSazonov Ilya (iSazonov) iSazonov left review comments
@daxian-dbw Dongbo Wang (daxian-dbw) daxian-dbw approved these changes
@adityapatwardhan Aditya Patwardhan (adityapatwardhan) Awaiting requested review from adityapatwardhan adityapatwardhan is a code owner
@BrucePay Bruce Payette (BrucePay) Awaiting requested review from BrucePay
@Francisco-Gamino Francisco Gamino (Francisco-Gamino) Awaiting requested review from Francisco-Gamino
+1 more reviewer
@rjmholt Rob Holt (rjmholt) rjmholt approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@daxian-dbw Dongbo Wang (daxian-dbw)

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Get-Module -ListAvailable skips module found in PSModulePath

Uh oh!

There was an error while loading. Please reload this page.

9 participants

@SteveL-MSFT @daxian-dbw @ronhowe @iSazonov @joeyaiello @KevinMarquette @vexx32 @lukeb1961 @rjmholt
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.