Skip to content

Casing of drive letter differs between ${workspaceRoot} and setBreakpointRequest #43959

Closed

Description

@DanTup

I'm not really sure you'll consider this a bug in Code, but it's causing bugs for me and I'm not sure if I can easily fix it.

When a user sets a launch config using ${workspaceRoot}, the path comes through with an uppercase drive letter:

C:\Users\danny\Desktop\DartHelloWorld\bin\main.dart

However if I place breakpoint in that file then the setBreakpointRequest comes through with a lowercase drive letter:

c:\Users\danny\Desktop\DartHelloWorld\bin\main.dart

These paths get converted to file:/// URIs by two different applications for my extension (the breakpoints are converted to URIs by my debug adapter, whereas the source file is being converted to a URI inside the VM). These URIs therefore don't match and are being compared case-sensitively and my breakpoint doesn't get hit.

I'm going to ask whether the VM can do case-insensitive comparisons but suspect it's a big job. I'm going to try and put a workaround in my DA for now; but I wonder if having these consistent in Code is an easy change?

Activity

  1. weinand commented on Feb 19, 2018

    @weinand
    Contributor

    Yes, drive-letter casing is a mess.
    Different casing should not make a difference on Windows but for node.js it makes a difference and in our node-debugger we register breakpoints via a regular expression that ignores the casing.

    IIRC VS Code does not try to normalise the drive letter to either upper or lower case because this doesn't help a lot for the following reason:

    There is always the case that you launch a debuggee from the integrated terminal (or even an external terminal): In this case VS Code has no influence on the drive letter case and there is still the possibility that a (normalized) VS Code path would be compared to an un-normalized native path coming from the debuggee.

    So my only recommendation is to deal with drive letter case mismatches yourself.

    Isidor Nikolic (@isidorn) please chime in if I misspoke.

  2. added
    debug
    on Feb 19, 2018
  3. DanTup commented on Feb 19, 2018

    @DanTup
    ContributorAuthor

    Andre Weinand (@weinand) It actually seems like this has affected a bunch of things and there have already been some fixes in Code that now uppercase the drive letter:

    a2ebd67
    0d66fa0

    Would it make sense to be consistent with them and do the same in the debugger?

  4. weinand commented on Feb 19, 2018

    @weinand
    Contributor

    Isidor Nikolic (@isidorn) what's your take?

    But as I tried to explain above, normalising "some" paths in VS Code cannot fix the fundamental issue. If you launch your a program in a command shell that results in lower case drive letters, these will not match the upper case drive letters paths received from VS Code.

  5. DanTup commented on Feb 19, 2018

    @DanTup
    ContributorAuthor

    Understood; but in this case both paths come from Code (cwd and setBreakpointRequest) so if Code was consistent with itself, this issue at least would be solved (it's possible it used to be consistent before cwd was changed).

    Ofc I'm perfectly happy to field any issues resulting from paths that didn't origin from Code.

  6. weinand commented on Feb 19, 2018

    @weinand
    Contributor

    The path received in "setBreakpointRequest" does not necessarily originates from VS Code.
    If you set a breakpoint in a (readonly) source received from the DA, the subsequent "setBreakpointRequest" will use this source path without modification. So in this case the drive letter has the case that your DA returned previously.

  7. DanTup commented on Feb 19, 2018

    @DanTup
    ContributorAuthor

    Andre Weinand (@weinand) Understood; though those paths will match the VM already. The breakpoint sending lowercase paths here is one I'm adding on a normal source file that I've opened from the explorer and just pressed F9 on.

    I've put a workaround in for now; but I do think Code should be try to be consistent with the paths that originate from it since it looks like this is a bit of a minefield.

  8. isidorn commented on Feb 19, 2018

    @isidorn

    Reopening to investigate

  9. 2 remaining items

  10. weinand commented on Feb 19, 2018

    @weinand
    Contributor

    Isidor Nikolic (@isidorn) If our (new?) strategy is to normalise drive letter casing to upper case, then reverting your change seems to be the wrong approach. Instead we should normalise drive letters everywhere where a path leaves VS Code, e.g. when sending paths to a DA.

  11. DanTup commented on Feb 19, 2018

    @DanTup
    ContributorAuthor

    Yeah, my preference would also be that drive letters are just always normalised to uppercase everywhere rather than reverting. And hopefully you can agree that any time something new comes up (like this one) the same fix is applied (I appreciate you shouldn't need to be messing with casing of drive letters; it's as annoying to me as it is to you; but we're all relying on other peoples coed we can't neceesarily easily influence/fix!).

  12. added
    bug
    and removed on Feb 21, 2018
  13. added
    verified
    on Mar 2, 2018
  14. felixfbecker commented on Mar 8, 2018

    @felixfbecker
    Contributor

    A lot of people are reporting that VS Code 1.20 broke their PHP debugging: xdebug/vscode-php-debug#239
    XDebug always uses lowercase drive letters.

  15. DanTup commented on Mar 8, 2018

    @DanTup
    ContributorAuthor

    cries

  16. isidorn commented on Mar 9, 2018

    @isidorn

    Felix Becker (@felixfbecker) can you fix this on the php debug side?
    If not, we can consider this as a candidate to revert this change

  17. DanTup commented on Mar 9, 2018

    @DanTup
    ContributorAuthor

    If this change is reverted without 0d66fa0 also being reverted (and my fix in Dart Code removed and published), it'll break Dart and Flutter :(

    Whatever way you choose to present the drive letters, it really has to be consistent between the path we get given for workspaceRoot and in breakpointRequest (it won't if you just revert this one change).

  18. isidorn commented on Mar 9, 2018

    @isidorn

    Danny Tuppeny (@DanTup) you are correct.
    We just discussed this in the meeting and we should have made an anouncment about this change, however we feel like this should not be reverted and php debug should not rely on drive letters being small case.
    So it would be great if Felix Becker (@felixfbecker) could fix it on the php side. If you do not have time please let us know and we can provide a PR in your extension.

  19. isidorn commented on Mar 14, 2018

    @isidorn

    Felix Becker (@felixfbecker) just a gentle reminder if we should help with the PR for PHP?

  20. felixfbecker commented on Mar 15, 2018

    @felixfbecker
    Contributor

    Should be fixed in v1.12.2

  21. locked and limited conversation to collaborators on Apr 15, 2018
  22. added a commit that references this issue on Sep 6, 2026
    825d6a1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugdebugverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions