Title: Get-ChieldItem fails with "Cannot find a provider ..." on version 6.2.1 · Issue #9840 · PowerShell/PowerShell · GitHub
Open Graph Title: Get-ChieldItem fails with "Cannot find a provider ..." on version 6.2.1 · Issue #9840 · PowerShell/PowerShell
X Title: Get-ChieldItem fails with "Cannot find a provider ..." on version 6.2.1 · Issue #9840 · PowerShell/PowerShell
Description: I have a module that loads a nested binary module (due to support for desktop and core editions). The binary module defines a provider that has a default PSDrive. When calling Get-ChieldItem
Open Graph Description: I have a module that loads a nested binary module (due to support for desktop and core editions). The binary module defines a provider that has a default PSDrive. When calling Get-ChieldItem X Description: I have a module that loads a nested binary module (due to support for desktop and core editions). The binary module defines a provider that has a default PSDrive. When calling Get-ChieldItem <qu...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/9840
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get-ChieldItem fails with \"Cannot find a provider ...\" on version 6.2.1","articleBody":"I have a module that loads a nested binary module (due to support for desktop and core editions). The binary module defines a provider that has a default PSDrive.\r\nWhen calling `Get-ChieldItem \u003cqualified path\u003e` it fails with \"Cannot find a provider with the name '...'\". This has changed since 6.0 when it used to work.\r\n\r\nI have created a sample repro module:\r\n\r\n[ReproProviderNameMismatch.zip](https://github.com/PowerShell/PowerShell/files/3261220/ReproProviderNameMismatch.zip)\r\n\r\nSummary:\r\n- The module must be nested to get this to reproduce\r\n- The provider must do something at initialization time that triggers a capture of the Provider.FullName (or something like that). In my case this is the PSDriveInfo constructor probably:\r\n```c#\r\n protected override Collection\u003cPSDriveInfo\u003e InitializeDefaultDrives() {\r\n var drive = new PSDriveInfo(\r\n \"defaultSampleDrive\",\r\n ProviderInfo,\r\n \"/\",\r\n \"Sample default drive\",\r\n null);\r\n var result = new Collection\u003cPSDriveInfo\u003e {drive};\r\n return result;\r\n }\r\n```\r\n\r\n**If the InitializeDefaultDrives in the sample is removed, then the issue would not be reproduced.**\r\n\r\n# Steps to reproduce\r\n1. Build the sample module with `dotnet build`\r\n2. Load the module from the build output and run the following:\r\n```powershell\r\nimport-module \"...ReproModule.psd1\"\r\n\r\nNew-PSDrive -Name \"prv1\" -Root \"/\" -PSProvider \"SamplePrv\"\r\n\r\n$item = get-item \"prv1:\\test.txt\"\r\n$item | fl *\r\n\r\nGet-ChildItem $item.PSPath\r\n```\r\n3. Observe the PSPath value\r\n\r\n# Expected behavior\r\nThe command to return the item like this:\r\n\r\n```none\r\nPSPath PSProvider PSIsContainer Name\r\n------ ---------- ------------- ----\r\nReproModule\\SamplePrv::test.txt ReproModule\\SamplePrv False test.txt\r\n```\r\nProbably the PSPath value should be:\r\n```\r\nPSPath : ReproModule\\SamplePrv::test.txt\r\n```\r\n\r\n# Actual behavior\r\nPSPath value is:\r\n```\r\nPSPath : module\\SamplePrv::test.txt\r\n```\r\n\r\nThe command fails with:\r\n\r\n```none\r\nGet-ChildItem : Cannot find a provider with the name 'module\\SamplePrv'.\r\nAt line:1 char:1\r\n+ Get-ChildItem $item.PSPath\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n+ CategoryInfo : ObjectNotFound: (module\\SamplePrv:String) [Get-ChildItem], ProviderNotFoundException\r\n+ FullyQualifiedErrorId : ProviderNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand\r\n```\r\n\r\n# Environment data\r\n\r\n```none\r\nName Value\r\n---- -----\r\nPSVersion 6.2.1\r\nPSEdition Core\r\nGitCommitId 6.2.1\r\nOS Microsoft Windows 10.0.17763\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n","author":{"url":"https://github.com/atanasa","@type":"Person","name":"atanasa"},"datePublished":"2019-06-06T11:05:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/9840/PowerShell/issues/9840"}
route-pattern /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) route-controller voltron_issues_fragments route-action issue_layout fetch-nonce v2:28de121d-10de-a503-06cc-c97dfad54f01 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id CAE8:17F098:7AE01:A875A:6A5256C8 html-safe-nonce a0b8248cfce8ad9842a96a8881325e3a0045be9691acdd08d4101099975e5c52 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUU4OjE3RjA5ODo3QUUwMTpBODc1QTo2QTUyNTZDOCIsInZpc2l0b3JfaWQiOiI2ODg1ODQyMTI2NTE0NTc1MDQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= visitor-hmac 3e5a222a588a0cb191d85f371ea665363a5881aed80f322433fb5814775c0d08 hovercard-subject-tag issue:452969053 github-keyboard-shortcuts repository,issues,copilot google-site-verification Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I octolytics-url https://collector.github.com/github/collect analytics-location / fb:app_id 1401488693436528 apple-itunes-app app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/9840/issue_layout twitter:image https://opengraph.githubassets.com/132c133d430ac38170531393fdfef4dea5b850365f115d0e9ee2f9191bfdf84d/PowerShell/PowerShell/issues/9840 twitter:card summary_large_image og:image https://opengraph.githubassets.com/132c133d430ac38170531393fdfef4dea5b850365f115d0e9ee2f9191bfdf84d/PowerShell/PowerShell/issues/9840 og:image:alt I have a module that loads a nested binary module (due to support for desktop and core editions). The binary module defines a provider that has a default PSDrive. When calling Get-ChieldItem og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username atanasa hostname github.com expected-hostname github.com None b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb turbo-cache-control no-preview go-import github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git octolytics-dimension-user_id 11524380 octolytics-dimension-user_login PowerShell octolytics-dimension-repository_id 49609581 octolytics-dimension-repository_nwo PowerShell/PowerShell octolytics-dimension-repository_public true octolytics-dimension-repository_is_fork false octolytics-dimension-repository_network_root_id 49609581 octolytics-dimension-repository_network_root_nwo PowerShell/PowerShell turbo-body-classes logged-out env-production page-responsive disable-turbo false browser-stats-url https://api.github.com/_private/browser/stats browser-errors-url https://api.github.com/_private/browser/errors release 7aed05249554b889eb33d002851a973eebcc7e91 ui-target full theme-color #1e2327 color-scheme light dark
URLs of crawlers that visited me.