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

Debug builds of files with huge numbers of methods multiple classes with <64K methods but total > 64K fails. release builds succees #16399

Closed
KevinRansom opened this issue Dec 7, 2023 · 4 comments
Assignees
Labels
Area-Debug stepping, debug points, stacks and more Bug Impact-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. Tracking-External
Milestone

Comments

@KevinRansom
Copy link
Member

Code similar to:

namespace Hello

[<NoComparison; NoEquality>]
type Type1() =
    static member Type1Method00001() = ()
    static member Type1Method00002() = ()
    ... including all methods from 00003 to  65518
    static member Type1Method65519() = ()
    static member Type1Method65520() = ()

[<NoComparison; NoEquality>]
type Type2() =
    static member Type2Method00001() = ()
    static member Type2Method00002() = ()
    ... including all methods from 00003 to  65518
    static member Type2Method65519() = ()
    static member Type2Method65520() = ()

module Main =
  [<EntryPoint>]
  let main _ =
    let _t1 = new Type1()
    Type1.Type1Method00001() 
    Type1.Type1Method30000() 
    Type1.Type1Method60000() 
    Type1.Type1Method65000() 
    let _t2 = new Type2()
    Type2.Type2Method00001() 
    Type2.Type2Method30000() 
    Type2.Type2Method60000() 
    Type2.Type2Method65000() 
    printfn "Fin"
    0

Release builds succeed, debug builds fail with:

C:\Users\kevinr\source\repos\ConsoleApp48\MultipleBigClasses>dotnet run
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Hello.Main.main(System.String[])
@github-actions github-actions bot added this to the Backlog milestone Dec 7, 2023
@KevinRansom KevinRansom self-assigned this Dec 9, 2023
@KevinRansom KevinRansom modified the milestones: Backlog, December-2023 Dec 9, 2023
@0101 0101 added Area-LangService-Diagnostics FCS code analysis, diagnostics, red squigglies Impact-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. Area-Debug stepping, debug points, stacks and more and removed Needs-Triage Area-LangService-Diagnostics FCS code analysis, diagnostics, red squigglies labels Dec 11, 2023
@KevinRansom
Copy link
Member Author

Okay, this is a bug in the windows DIA symbol reader, there is an internal Microsoft bug managing it. We don't believe it is a regression. The fix will appear in a future release of the SDK, fix and release timing is to be determined.

Because the bug managing it is internal, we will keep this bug open to keep you abreast of progress.

Snipped from internal bug:

2 bugs: using the MethodTable size for the column width of the Document Column within the MethodDebugInformation table, and then only using an `assert` to range check the index.

@cataggar
Copy link

This internal fix was merged.

@cataggar
Copy link

The workaround provided by @KevinRansom was to set the assembly attribute of IgnoreSymbolStoreSequencePoints. It can be added to an assembly with > 64K methods as a workaround. I just put the code in a IgnoreSymbolStoreSequencePoints.fs file and added the file to my project. Putting it anywhere in the project will work.

module IgnoreSymbolStoreSequencePoints

open System.Diagnostics

[<assembly: DebuggableAttribute(DebuggableAttribute.DebuggingModes.Default
                                ||| DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)>]
do ()

@KevinRansom
Copy link
Member Author

KevinRansom commented Feb 6, 2024

Closing this.

  • It is resolved. The compiler will generate assemblies that debug with more than 64k methods.
  • There is a known workaround for earlier generations of the compiler.
  • The underlying CLR issue is reported, known and fixed. We are not dependent on this fix, we have an alternate pdb generation mechanism.

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-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. Tracking-External
Projects
Archived in project
Development

No branches or pull requests

4 participants