PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.7k stars 488 forks source link

Unexpected module reload #1533

Closed PrzemyslawKlys closed 5 years ago

PrzemyslawKlys commented 6 years ago

System Details

PS C:\Users\pklys\OneDrive - Evotec\Support\GitHub\PSWinDocumentation\Ignore> $pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      8      4      0

PS C:\Users\pklys\OneDrive - Evotec\Support\GitHub\PSWinDocumentation\Ignore> code --list-extensions --show-versions
[createInstance] extensionManagementService depends on downloadService which is NOT registered.
aaron-bond.better-comments@1.3.0
abusaidm.html-snippets@0.2.1
AlanWalk.markdown-toc@1.5.6
alefragnani.Bookmarks@9.1.0
azemoh.one-monokai@0.3.7
ban.spellright@2.5.32
batisteo.vscode-django@0.17.0
bierner.markdown-preview-github-styles@0.1.3
daiyy.quick-html-previewer@0.3.0
DavidAnson.vscode-markdownlint@0.20.0
DavidWang.ini-for-vscode@0.0.4
donjayamanne.githistory@0.4.2
donjayamanne.jupyter@1.1.4
donjayamanne.python-extension-pack@1.4.0
DotJoshJohnson.xml@2.3.2
eamodio.gitlens@8.5.6
emilast.LogFileHighlighter@2.4.1
emmanuelbeziat.vscode-great-icons@2.1.41
Equinusocio.vsc-material-theme@2.4.2
felixfbecker.php-debug@1.12.5
formulahendry.code-runner@0.9.4
gerane.Theme-dimmed-monokai@0.0.2
gharveymn.nightswitch@1.1.0
GitHub.vscode-pull-request-github@0.1.5
GrapeCity.gc-excelviewer@2.1.26
hdg.live-html-previewer@0.3.0
hnw.vscode-auto-open-markdown-preview@0.0.4
HookyQR.beautify@1.4.3
IBM.output-colorizer@0.1.2
ikappas.phpcs@1.0.5
ionutvmi.reg@0.0.2
JerryHong.autofilename@0.1.3
joaompinto.asciidoctor-vscode@0.15.1
johnpapa.winteriscoming@0.7.1
Kelvin.vscode-sshfs@1.9.2
kisstkondoros.vscode-codemetrics@1.17.1
KnisterPeter.vscode-github@0.30.0
magicstack.MagicPython@1.0.12
mariorodeghiero.vue-theme@1.1.0
mechatroner.rainbow-csv@0.5.0
mkloubert.vs-deploy@14.0.0
mkloubert.vscode-remote-workspace@0.32.1
ms-mssql.mssql@1.4.0
ms-python.python@2018.8.0
ms-vscode.csharp@1.16.1
ms-vscode.PowerShell@1.8.4
ms-vsliveshare.vsliveshare@0.3.666
ms-vsts.team@1.136.0
quicktype.quicktype@12.0.42
redhat.java@0.30.0
robertohuertasm.vscode-icons@7.26.0
Shan.code-settings-sync@3.1.2
stkb.rewrap@1.9.1
streetsidesoftware.code-spell-checker@1.6.10
streetsidesoftware.code-spell-checker-polish@1.0.0
TomasHubelbauer.zip-file-system@1.0.0
vangware.dark-plus-material@1.4.0
VisualStudioExptTeam.vscodeintellicode@1.0.3
vscjava.vscode-java-debug@0.12.2
vscjava.vscode-java-pack@0.3.0
vscjava.vscode-java-test@0.8.0
vscjava.vscode-maven@0.10.0
WakaTime.vscode-wakatime@1.2.3
wayou.vscode-todo-highlight@1.0.4
whizkydee.material-palenight-theme@1.9.3
wholroyd.jinja@0.0.8
xaver.clang-format@1.6.2
yzhang.markdown-all-in-one@1.6.0
zhuangtongfa.Material-theme@2.16.5
Zignd.html-css-class-completion@1.11.0
openssl config failed: error:02001003:system library:fopen:No such process
PS C:\Users\pklys\OneDrive - Evotec\Support\GitHub\PSWinDocumentation\Ignore> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17754.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17754.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

So I'm working on a script when suddenly VSCode starts loading / reloading all modules

image

I've seen that happen few times already. Any reason it does that?

Attached Logs

Follow the instructions in the README about capturing and sending logs.

TylerLeonhardt commented 6 years ago

@PrzemyslawKlys I think I've seen similar behavior with Pester. Occasionally I'll get a little warning that says:

WARNING: OS Information retrieval is not possible, reports will contain only partial system data

This could be an issue with Pester. Were you doing anything with Pester when you were seeing this?

Also, can you please attach the logs?

PrzemyslawKlys commented 6 years ago

No. Not doing pester. I've seen this multiple times. I often hit an invisible version of it (or at least i think so) when F5 does nothing and VS Code says debug sessions is in progress. Something is triggering this. I would say it's more related to Formatting on Save or something similar.

Don't have logs thou. Or I have so many of them that I can't find this one you need. I'll try to see next time what I can provide. I have lots of logs for crashes on delete but that's on another issue.

TylerLeonhardt commented 6 years ago

Would you mind sharing which debug config you are using?

PrzemyslawKlys commented 6 years ago

Is that what you mean?

{
    "vsicons.dontShowNewVersionMessage": true,
    "html.format.wrapLineLength": 0,
    "sync.gist": "private",
    "sync.lastUpload": "2018-05-03T08:43:52.422Z",
    "sync.autoDownload": false,
    "sync.autoUpload": false,
    "sync.lastDownload": "",
    "sync.forceDownload": false,
    "sync.host": "",
    "sync.pathPrefix": "",
    "sync.quietSync": false,
    "sync.askGistName": false,
    "workbench.activityBar.visible": true,
    "workbench.statusBar.visible": true,
    "window.menuBarVisibility": "default",
    "window.zoomLevel": 0,
    "powershell.powerShellExePath": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "editor.formatOnSave": true,
    "editor.formatOnType": false,
    "editor.fontSize": 13,
    "editor.minimap.enabled": false,
    "files.trimFinalNewlines": true,
    "files.trimTrailingWhitespace": true,
    "powershell.codeFormatting.newLineAfterCloseBrace": false,
    "powershell.integratedConsole.showOnStartup": false,
    "powershell.debugging.createTemporaryIntegratedConsole": false,
    "powershell.codeFormatting.preset": "OTBS",
    "git.autofetch": false,
    "gitlens.advanced.messages": {
        "suppressShowKeyBindingsNotice": true
    },
    "sync.removeExtensions": true,
    "sync.syncExtensions": true,
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/.vs": true
    },
    "workbench.colorTheme": "Monokai",
    "workbench.iconTheme": "vscode-icons",
    "bookmarks.navigateThroughAllFiles": true,
    "workbench.sideBar.location": "left",
    "debug.internalConsoleOptions": "neverOpen",
    "debug.openDebug": "neverOpen",
    "debug.openExplorerOnEnd": false,
    "debug.showInStatusBar": "never",
    "powershell.developer.editorServicesLogLevel": "Diagnostic",
    "terminal.integrated.rendererType": "dom",
    "extensions.autoUpdate": true,
    "powershell.scriptAnalysis.enable": false,
    "gitlens.defaultDateFormat": "Do, MMMM, YYYY, HH:mm:ss",
    "gitlens.settings.mode": "advanced",
    "gitlens.menus": {
        "editor": {
            "blame": false,
            "clipboard": true,
            "compare": true,
            "details": true,
            "history": false,
            "remote": true
        },
        "editorGroup": {
            "blame": true,
            "compare": true,
            "history": false,
            "remote": true
        },
        "editorTab": {
            "compare": true,
            "history": false,
            "remote": true
        },
        "explorer": {
            "compare": true,
            "history": true,
            "remote": true
        }
    },
    "gitlens.codeLens.scopes": [
        "document",
        "containers"
    ],
    "gitlens.statusBar.reduceFlicker": true,
    "sshfs.configs": [
        {
            "label": "EvoServices",
            "root": "/",
            "host": "192.168.240.198",
            "port": 22,
            "username": "pklys",
            "password": true,
            "name": "EvoServices"
        },
        {
            "label": "EvoServices",
            "root": "/",
            "host": "192.168.240.198",
            "port": 22,
            "username": "pklys",
            "password": true,
            "name": "evoservices"
        }
    ],
    "extensions.showRecommendationsOnlyOnDemand": true,
    "debug.toolBarLocation": "docked",
    "window.title": "${rootName}",
    "breadcrumbs.enabled": true,
    "github.hosts": [
        {
            "host": "https://github.com",
            "username": "oauth",
            "token": "system"
        }
    ],
    "workbench.statusBar.feedback.visible": false
}
// Empty
[
    {
        "key": "ctrl+f5",
        "command": "workbench.action.debug.start",
        "when": "!inDebugMode"
    },
    {
        "key": "f5",
        "command": "-workbench.action.debug.start",
        "when": "!inDebugMode"
    },
    {
        "key": "f5",
        "command": "workbench.action.debug.run",
        "when": "!inDebugMode"
    },
    {
        "key": "ctrl+f5",
        "command": "-workbench.action.debug.run",
        "when": "!inDebugMode"
    },
    {
        "key": "f5",
        "command": "-workbench.action.debug.continue",
        "when": "inDebugMode"
    }
]

image

Or you need something else? I am pretty open to deliver anything :-) Rest of the settings is defaults of VsCode. And I use F5 to run my scripts. Not Ctrl+F5.

TylerLeonhardt commented 6 years ago

Not quite. If you have one, it would be in .vscode/launch.json otherwise you're using the default.

PrzemyslawKlys commented 6 years ago

I've not touched anything outside of settings/keymaps so default.

TylerLeonhardt commented 6 years ago

I know you said you weren't using Pester but do you have any Pester scripts in the workspace you're working with?

This might be the extension reloading Pester due to you debugging.

PrzemyslawKlys commented 6 years ago

Not really no. PSWinDocumentation doesn't have pester. However it uses PSWriteWord/PSWriteExcel which both have pester tests but those are not loaded in the same VSCode. I often keep 3 or more VSCode open with different project. But I'm guessing it shouldn't interfere one another.

SeeminglyScience commented 6 years ago

What is more than likely happening is module autoloading. If intellisense is triggered for a command that isn't currently loaded, but would be automatically loaded if invoked directly, then the module is imported. That's done for the syntax message and parameter intellisense.

Since Pester uses some pretty common short words for it's commands (in/it/should/and/but/given/then/when/etc) it's pretty likely you didn't notice you were typing the start of a Pester command.

PrzemyslawKlys commented 6 years ago

That's a very good idea. So prevent this and any potential reloads in the middle of me working I should do import-module for all common modules, including Pester? I get quite a lot where I have VSCode claiming something is happening in background and yet I can't see anything.