-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-LocalizedData: Fails to find *.strings.psd1 when DefaultUICulture not specified #37
Comments
I propose we redesign this function to:
We should build the list of prioritized folders to scan like this:
|
@johlju - I'm going to get to work on this one over this weekend. Can you tell me if you think the logic above is OK? |
That looks okay to me. |
I have sent in a PR #51 that resolves issue #50, issue #11, and probably this too, ...but it is very much spagehetti-code at this point. @PlagueHO A refactor according to your suggestion above would be much better! So see the PR #51 as functionality that need to be supported in the refactor, rather than merge it. 🙂 |
To clarify my comment above, we keep this issue open to track the very needed refactor of Get-LocalizedData. 🙂 |
This comment was marked as off-topic.
This comment was marked as off-topic.
I'll add my current progress for documentation. Blue shell shows the execution of the deployment including the error record.
In the debug shell I executed Manually running the command is successful, from the module it fails. Error Record: DEBUG: GET-LOCALIZED: PSBoundParam is null : False
DEBUG: GET-LOCALIZED: PSBoundParam Keys:FileName BaseDirectory
DEBUG: PARAM: FileName = DscResource.Common.strings.psd1
DEBUG: PARAM: BaseDirectory = C:\Users\lb\Desktop\Dbg_Lability\DSCResources\HyperVDsc\Modules\DscResource.Common\0.16.0
Import-LocalizedData : Cannot find the Windows PowerShell data file 'DscResource.Common.strings.psd1' in directory
'C:\Users\lb\Desktop\Dbg_Lability\DSCResources\HyperVDsc\Modules\DscResource.Common\0.16.0\en\', or in any parent
culture directories.
At
C:\Users\lb\Desktop\Dbg_Lability\DSCResources\HyperVDsc\Modules\DscResource.Common\0.16.0\DscResource.Common.psm1:2616
char:13
+ Import-LocalizedData @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\lb\Des...on.strings.psd1:String) [Import-LocalizedData], PSInv
alidOperationException
+ FullyQualifiedErrorId : ImportLocalizedData,Microsoft.PowerShell.Commands.ImportLocalizedData |
This is very strange. I wonder if the Sysinternals tool DiskMon can show us more what happening in the background when accessing the file - if that can say why it can't import. I have made a refactor of |
@lbrauns can you please run the new built code in the PR to see if it does anything to help? You find the code in the artifact You should just need to replace the code inside your copy of HyperVDsc module. |
You fixed it :) Debug Output:
|
Details of the scenario you tried and the problem that is occurring
When using
Get-LocalizedData
without specifying the-DefaultUICulture
parameter an error occurs:Steps to reproduce the problem
Change any module to use:
when the localized data file is in the
en-US
folder and named*.strings.psd1
.Expected behavior
It to load the
*.strings.psd1
file into the$script:localizedData
variable.Current behavior
Exception is thrown.
Suggested solution to the issue
I'll submit a PR to fix this.
The operating system the target node is running
Windows Server (various versions).
Version and build of PowerShell the target node is running
PS 5.1
Version of the module that was used
Latest.
The text was updated successfully, but these errors were encountered: