Skip to content
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

Quick Watch shows wrong value on variables with same name #3141

Closed
Dolfik1 opened this issue May 27, 2017 · 2 comments
Closed

Quick Watch shows wrong value on variables with same name #3141

Dolfik1 opened this issue May 27, 2017 · 2 comments
Labels
Area-Debug stepping, debug points, stacks and more Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Ready
Milestone

Comments

@Dolfik1
Copy link

Dolfik1 commented May 27, 2017

Quick Watch shows wrong value on variables with same name

Repro steps

Provide the steps required to reproduce the problem

  1. Paste the following:
let testNullA x =
    let x = // quick watch 1
        if isNull(x) then printf "value is null" // quick watch 2
        else 
            printf "value is not null" // breakpoint 1
    ()

let testNullB x =
    let x = // quick watch 3
        if isNull(x) then null // quick watch 4
        else 
            null // breakpoint 2
    ()

[<EntryPoint>]
let main argv = 
    testNullA "123"
    testNullB "123"
    0
  1. Set breakpoints on line with // breakpoint 1 and // breakpoint 2 comments.
  2. Start debug
  3. Quick watch x on lines with // quick watch n comment

Expected behavior

quick watch 1: x = null
quick watch 2: x = "123"
quick watch 3: x = null
quick watch 4: x = "123"

Actual behavior

quick watch 1: x = "123"
quick watch 2: x = "123"
quick watch 3: x = null
quick watch 4: x = null

Known workarounds

Use different names of variables. For example:

let testNullA x =
    let a = // quick watch 1
        if isNull(x) then printf "value is null" // quick watch 2
        else 
            printf "value is not null" // breakpoint 1
    ()

Related information

Bug reproduced in Visual Studio 2017 with Visual F# Tools Extension 15.4.17051701 and Visual Studio Code with Ionide extension 2.25.13

@Dolfik1 Dolfik1 closed this as completed May 27, 2017
@Dolfik1 Dolfik1 changed the title Quick Watch shows wrong value on Quick Watch shows wrong value on variables with same name May 27, 2017
@Dolfik1 Dolfik1 reopened this May 27, 2017
@cartermp cartermp added the Area-Debug stepping, debug points, stacks and more label Jun 3, 2017
@cartermp cartermp added this to the VS 2017 Updates milestone Jun 3, 2017
@cartermp cartermp added the Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. label Jun 3, 2017
@dsyme dsyme added the Bug label Jun 5, 2017
@dsyme
Copy link
Contributor

dsyme commented Jun 5, 2017

I suspect that this is an off-by-one issue in emitting the range information for local variable names in the debug info. I'm not sure though.

So it might be very easy to fix, particularly if some tools are available for dumping the debug information produced

@dsyme
Copy link
Contributor

dsyme commented Sep 7, 2017

Fixed

@dsyme dsyme closed this as completed Sep 7, 2017
@cartermp cartermp modified the milestones: VS 2017 Updates, 15.5 Jun 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Debug stepping, debug points, stacks and more Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Ready
Projects
None yet
Development

No branches or pull requests

3 participants