Skip to content

[From VSTS] FSharp emitting incorrect sequence point in debug info #3036

Closed

Description

@cartermp
  1. clone https://github.com/cartermp/15.2-E2E
  2. Open in VS, F5
  3. Set a breakpoint in PigLatin.fs, line 11
  4. Type 'banana' in textbox, click generate button
  5. You should now be stopped at a breakpoint
  6. F5 to continue

Expected: continue past breakpoint

Actual: Stop at same breakpoint

Additional Info: It appears that the F# compiler is emitting an incorrect sequence point, causing the debugger to bind two separate breakpoints at the same source location. The API ISymUnmanagedMethod is returning 30 sequence points for the ToPigLatin method, the first two are at IL offsets 0 and 7. Looking at the output of ildasm, it does not look like IL offset 7 should be a sequence point:

.method public static string  ToPigLatin(string str) cil managed
{
  // Code size       400 (0x190)
  .maxstack  6
  .locals init ([0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<char,bool> isVowel,
           [1] char firstChar,
           [2] string V_2,
           [3] class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<int32> V_3,
           [4] class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<int32> V_4,
           [5] class [mscorlib]System.Tuple`2<int32,int32> V_5,
           [6] int32 V_6,
           [7] class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<int32> V_7,
           [8] int32 V_8,
           [9] class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<int32> V_9,
           [10] int32 V_10,
           [11] class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<int32> V_11,
           [12] class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<int32> V_12,
           [13] int32 V_13,
           [14] int32 V_14,
           [15] int32 V_15,
           [16] int32 V_16,
           [17] int32 V_17,
           [18] char V_18,
           [19] object V_19,
           [20] class [mscorlib]System.IFormattable V_20,
           [21] class [mscorlib]System.IFormattable V_21,
           [22] object V_22)
  .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}'
// Source File 'C:\Users\chuckr\Source\Repos\15.2-E2E\E2E.Core\PigLatin.fs' 
//000011:         let firstChar = str.[0]
  IL_0000:  nop
  IL_0001:  newobj     instance void E2E.Core.PigLatin/isVowel@8::.ctor()
  IL_0006:  stloc.0
  IL_0007:  ldarg.0
  IL_0008:  ldc.i4.0
  IL_0009:  callvirt   instance char [mscorlib]System.String::get_Chars(int32)
  IL_000e:  stloc.1
//000012: 
//000013:         if isVowel firstChar then
  IL_000f:  ldloc.0
  IL_0010:  ldloc.1
  IL_0011:  callvirt   instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2<char,bool>::Invoke(!0)
  IL_0016:  brfalse.s  IL_001a
  IL_0018:  br.s       IL_001c
  IL_001a:  br.s       IL_0028
//000014:             str + "way"
  IL_001c:  ldarg.0
  IL_001d:  ldstr      "way"
  IL_0022:  call       string [mscorlib]System.String::Concat(string,
                                                              string)
  IL_0027:  ret

Activity

  1. added this to the milestone on May 12, 2017
  2. added
    Impact-Medium
    on May 12, 2017
  3. 0x53A commented on May 12, 2017

    @0x53A
    Contributor

    I would like to take this opportunity and add an advertisement for a great tool: The latest dnSpy (https://ci.appveyor.com/project/0xd4d/dnspy/branch/master/artifacts) shows the sequence points inline in the IL view, which is awesome when you need to reason about that:

    image

    image

    image

  4. dsyme commented on Sep 7, 2017

    @dsyme
    Contributor

    Fixed by #3561

  5. modified the milestones: , 15.5 on Jun 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact-MediumReady

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions