-
Notifications
You must be signed in to change notification settings - Fork 511
DesiredStateConfiguration module not found #3971
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
DesiredStateConfiguration module not found #3971
Comments
I am experiencing this issue also on version 1.59.0: |
I have found that in every case I've tried so far, if I run into this problem in a folder it goes away if I restart the terminal in vscode and then remove all the breakpoints. This is easier than finding and deleting the session directory. |
Thanks so much for the detailed bug report-- it is very helpful for us! We are looking into this issue, but as a temporary workaround using a different $ErrorActionPreference may help since it sounds like this only reproduces with "Inquire", let us know if you hit this with other variables (it may with any preference that causes termination) |
This hasn't happened to me for a long while, and I don't find anyone else on the web with the same problem. I'm glad this issue is posted since anyone with the problem will be able to search and find the solution, but it's probably not worth anyone's time to debug at this point. |
Thanks for the follow up! |
I am re-opening this since it turns out I continue to have the problem. I don't know what prompts it, and I'm having a hard time figuring out how I'm fixing it. However, I think I've found where the problem is in the source code. The error I see is: The specified module 'C:\Program Files\DesiredStateConfiguration\1.0.0.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psd1' was The PSDesiredStateConfigure module does not exist in C:\Program Files, it exists in C:\Windows\system32\WindowsPowerShell\v1.0\Modules on my system. The wrong path is hardcoded in line 96 of https://github.com/PowerShell/PowerShellEditorServices/blob/main/src/PowerShellEditorServices/Services/PowerShell/Debugging/DscBreakpointCapability.cs Seems like the $env:PSModulePath should be searched instead of hard-coding a path? Looks like the intent was for errors to be ignored here, but in some situations they aren't, it seems. I was led to this looking at a similar bug report at #575 |
@EdCallahan heh, yeah I agree that's wonky. I'll try to fix it. For what it's worth, we also silenced the warning when DSC isn't found, can you try the pre-release extension and let me know if it's still noisy when the module isn't found? |
Using the steps in the first post in the issue report, I was able to reproduce the error in Powershell module 2023.6.0. (I had to set a breakpoint in the script before step 5 to get the error). When I updated to the preview version 2023.9.1 I was not able to reproduce the bug. I saw the updates that you did yesterday on this section of code, @andyleejordan. Makes a ton of sense to my inexperienced eye, thanks much for the quick action on that. I'll test again once that code is released as a preview version. |
Awesome, thanks for confirming! Looks like it's loading correctly (finally). |
@andyleejordan This is very disruptive when using interactive session with PowerShell 5.1:
|
Oh I see...ok I guess one of three things needs to happen:
@SeeminglyScience do you know the history behind the "DSC Breakpoints" stuff? |
@kborowinski FWIW when I try to repro this I do see the progress bar, but then it disappears automatically. |
Anyway I silenced it completely in PowerShell/PowerShellEditorServices#2068. |
@andyleejordan Thanks Andy! It is a good compromise. It's strange that the progress bar disappears for you. I have tried it on 3 different computers, and it stays on in every case. Anyways thanks a lot for a quick fix! |
Prerequisites
Summary
In some PowerShell project folders, when I use F5 to run debugging, the second time I get the error:
The specified module 'C:\Program Files\DesiredStateConfiguration\1.0.0.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psd1' was
not loaded because no valid module file was found in any module directory.
(Note that that is not the directory that module exists in)
The simples powershell program I have to replicate the problem is:
It only happens when the error action is set to Inquire, it will not happen when set to Stop.
This does not happen to all Powershell project folders. The problem popped up just this week. It has hit me and a coworker. I have been able to replicate the problem on my corporate network and on a laptop off the domain at home.
The problem seems to be related to bad session files. If I find the session file for the folder in C:\Users<username>\AppData\Roaming\Code\User\workspaceStorage and delete it, the problem disappears.
PowerShell Version
Visual Studio Code Version
Extension Version
Steps to Reproduce
statefiles.zip
Visuals
DSC_Debug.mp4
Logs
No response
The text was updated successfully, but these errors were encountered: