Skip to content

ILDASM /linenum support? #53822

Open
Open

Description

@dsyme

The is either a question or a bug report. Basically does the /linenum flag of ILDASM work with .NET Core?

Context: We use ILDASM in the F# repo from package “Microsoft.NETCore.ILDAsm". However I can’t get the “/linenum” option to workm, e.g. to show the PDB file contents in terms of sequence points. We use this to lock down our debugging experience, which is quite important one way or another. I could dump the sequence points from the compiler but it’s really convenient to have them showing with the IL code.

Repro:

  • Compile something with portable symbols
  • run ildasm /linenum /text foo.dll

e.g. in F# repo:

ildasm.exe artifacts\bin\FSharp.Core\Debug\netstandard2.0\FSharp.Core.dll /linenum

Expected: output include .line
Actual: no .line observed

We've tried lots of variations like embedded symbols etc., we can't find a configuration that works.

cc @vzarytovskii, @brettfo

Activity

  1. ghost added
    untriaged
    on Jun 7, 2021
  2. JulieLeeMSFT commented on Jun 16, 2021

    @JulieLeeMSFT
    Member

    @EgorBo PTAL.

  3. added
    needs-further-triage
    and removed
    untriaged
    on Jun 16, 2021
  4. removed
    needs-further-triage
    on Jul 6, 2021
  5. added this to the 6.0.0 milestone on Jul 6, 2021
  6. modified the milestones: 6.0.0, 7.0.0 on Aug 13, 2021
  7. am11 commented on Mar 15, 2022

    @am11
    Member

    When ilasm received the support for portable PDB, ildasm was left out #37702 (comment). It is more of a feature request than a bug report. 😄

    Note that once portable PDB parser is plugged into ildasm, this condition will start to satisfy:

    if(fInsertSourceLines)
    in the statement fInsertSourceLines = g_fInsertSourceLines; under if (g_pSymReader) condition, g_fInsertSourceLines is 1 with /linenum or -linenum argument, otherwise 0; but that statement is unreachable because g_pSymReader is always null in ildasm.

  8. modified the milestones: 7.0.0, 8.0.0 on Jun 16, 2022
  9. assigned and unassigned on Jun 16, 2022
  10. 7 remaining items

  11. ivanpovazan commented on Nov 4, 2022

    @ivanpovazan
    Member

    @mirkomaty I made some initial progress like reading the document table, but had to switch to some other higher priority issues.
    I will probably get back to this later in November.
    If you need assistance earlier, maybe @TIHan or someone from the team, could pick this up sooner.

  12. mirkomaty commented on Nov 4, 2022

    @mirkomaty

    @ivanpovazan: Thanks a lot for your answer. The problem is not so urgent, because currently I tell my users to use

    <DebugType>full</DebugType>

    But since .NET Core will be the dominant platform in the future, there is little point in having my users insert that line into their project files all the time.

    I'm not able to customize ILDasm myself, so I appreciate you taking the time to do so. ;-) If it happens this year, it is perfect for me. Thanks again.

  13. added
    Priority:3
    on Apr 24, 2023
  14. ivanpovazan commented on Feb 9, 2024

    @ivanpovazan
    Member

    Unfortunately, I will not have enough cycles to look further into this in the near future. Will remain at disposal if anyone needs help or has questions around this.

  15. removed their assignment
    on Feb 9, 2024
  16. mirkomaty commented on May 3, 2024

    @mirkomaty

    Hello, is there any progress in this area?

    I created a simple project with this project file:

    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>disable</Nullable>
    	  <DebugMode>full</DebugMode>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="ndo.dll" Version="5.0.0" />
      </ItemGroup>
    
    </Project>
    

    I took ILDasm from the package runtime.win-x64.microsoft.netcore.ilasm in the version 8.0.0.0.
    Disassembling with Dasm with /LINENUM switch doesn't provide any line numbers regardless of the TargetFramework (netstandard 2.0 or net6.0).

    EDIT: Same with v. 9.0.0-preview.3.24172.9

    ILDasm from the .NET Fx Tools 4.8 does the trick. It seems, as if the full pdb support has been removed in order to replace it with portable pdb support, which never happened. It would help a lot to get the pdb support back as long as portable pdb is not implemented.

  17. JulieLeeMSFT commented on Oct 15, 2024

    @JulieLeeMSFT
    Member

    Reassigned to @amanasifkhalid.

  18. antlersoft commented on Feb 5, 2025

    @antlersoft

    You can find a fork here: https://github.com/antlersoft/runtime/tree/Issue-53822_ildasm_portable_pdb_linenum

    that addressed this particular issue. The update as-is is unlikely to be merged, but if build-it-yourself will solve your problem, you might try it.

    There are a number of limitations: most notably, we don't
    try to use the Debug_Information table to find the pdb file;
    we just look for a file with the same name as the executable
    and replace the extension with .pdb.

    No effort is made to read the scope/local variable table.
    
    To build ildasm from this branch, from src/coreclr
    
    ./build-runtime.sh -component iltools
    
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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions