-
Notifications
You must be signed in to change notification settings - Fork 348
Description
Describe the bug
When starting a launch configuration in Windows, in some cases parts of the code fail to execute.
As reported in an older Eclipse Theia community post,
this is caused by inconsistencies with the case of the drive letter in paths, e.g., c: vs C:.
@mikael-desharnais (or @MikaelDesharnais-ST, not sure which is active) was kind enough to explain his investigations back then and share his insights in the linked community post above.
For sake of self-containedness of this issue, to briefly summarize his findings, the problem is:
- NodeJS being case sensitive (even on Windows)
- VSCode sometimes using lower case variants
- the rest of the system using upper case variants
In some cases this might lead to situations where things cannot be resolved at runtime.
I created a minimum project example with a yeoman generator and a minimum backend contribution to reproduce the exact issue we are facing.
In this case, the case of the drive letter of the executed main.js as well as the cwd is not correctly adjusted before starting the debug session.
Fortunately you already have an existing utility function urlUtils.platformPathToPreferredCase() that just does the job!
I have prepared a patch that resolves the issue at least in the scenarios that I am aware of and opened a respective PR.
To Reproduce
Steps to reproduce the behavior:
- Assure you are running on Windows
- Clone the minimal project example to reproduce the bug:
git clone https://github.com/xai/theia-hello-world-extension.git && cd theia-hello-world-extension - Build the example project:
yarn - Start vscode:
code . - Launch
Start Browser Backendin the debug launcher - Observe that the
console.log()statement from https://github.com/xai/theia-hello-world-extension/blob/336b8c510ce2d9eb134467aa18f64e876400bacf/hello-world/src/node/hello-backend-contribution.ts#L8 is not executed, i.e., there is no such output as 'Hello backend!' present in the debug console
Log File
Verbose logs are written to:
c:\Users\user\AppData\Roaming\Code\logs\20221117T083845\window1\exthost\ms-vscode.js-debug\vscode-debugadapter-214d5da9.json.gz
C:\Program Files\nodejs\node.exe .\browser-app\src-gen\backend\main.js --loglevel=debug --port=3000 --no-cluster
runtime.launch Bootloader imported {
env: {
inspectorIpc: '\\\\.\\pipe\\node-cdp.9592-2.sock',
deferredMode: false,
waitForDebugger: '',
execPath: 'C:\\Program Files\\nodejs\\node.exe',
onlyEntrypoint: false,
verbose: true,
autoAttachMode: 'always',
fileCallback: 'C:\\Users\\user\\AppData\\Local\\Temp\\node-debug-callback-6216b92fbfc3fc4a'
},
args: [
'C:\\Program Files\\nodejs\\node.exe',
'c:\\Users\\user\\Git\\sandbox\\theia-hello-world-extension\\browser-app\\src-gen\\backend\\main.js',
'--loglevel=debug',
'--port=3000',
'--no-cluster'
]
}
runtime Set debug mode { mode: 0 }
Debugger attached.
Configuration directory URI: 'file:///c%3A/Users/user/.theia'
2022-11-17T16:47:11.530Z root INFO Backend Object.initialize: 12.0 ms [Finished 2.145 s after backend start]
2022-11-17T16:47:11.530Z root INFO Backend Object.configure: 11.0 ms [Finished 2.145 s after backend start]
2022-11-17T16:47:11.530Z root INFO Backend MessagingContribution.onStart: 2.3 ms [Finished 2.146 s after backend start]
2022-11-17T16:47:11.531Z root INFO Backend OSBackendApplicationContribution.configure: 0.9 ms [Finished 2.169 s after backend start]
2022-11-17T16:47:11.532Z root INFO Backend LocalizationBackendContribution.initialize: 23.2 ms [Finished 2.169 s after backend start]
2022-11-17T16:47:11.532Z root INFO Backend LocalizationBackendContribution.configure: 0.3 ms [Finished 2.170 s after backend start]
2022-11-17T16:47:11.533Z root INFO Backend NodeFileUploadService.configure: 1.6 ms [Finished 2.172 s after backend start]
2022-11-17T16:47:11.533Z root INFO Backend FileDownloadEndpoint.configure: 0.6 ms [Finished 2.173 s after backend start]
2022-11-17T16:47:11.538Z root INFO Theia app listening on http://localhost:3000.
2022-11-17T16:47:11.544Z root INFO Backend DefaultWorkspaceServer.onStart: 15.7 ms [Finished 2.184 s after backend start]
2022-11-17T16:47:11.545Z root INFO Finished starting backend application: 0.1 ms [Finished 2.184 s after backend start]
I can share the detailled log on demand if it becomes necessary.
VS Code Version: 1.73.1
Additional context
See this community post by @mikael-desharnais in the Eclipse Theia project that details the casing issue.
The workaround discussed in the community post (NODE_PRESERVE_SYMLINKS) leads to a situation where the code runs but breakpoints in those parts do no longer bind.