Skip to content

Recursive constructor declared on CompilerMessageAttribute #1273

Closed
@mrvoorhe

Description

@mrvoorhe

I'm working toward getting IL2CPP to convert FSharp.Core.dll and I stumbled on some problematic IL. Looking at the IL for CompilerMessageAttribute, there is a recursive constructor declared that has an empty body. The C++ that IL2CPP generates for this constructor ends up causing a compiler warning because the code is infinitely recursive.

.method assembly specialname rtspecialname
instance void .ctor (
object message,
object messageNumber
) cil managed
{
// Method begins at RVA 0x258c
// Code size 10 (0xa)
.maxstack 8

IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: ldarg.2
IL_0004: callvirt instance void Microsoft.FSharp.Core.CompilerMessageAttribute::.ctor(object, object)
IL_0009: ret

} // end of method CompilerMessageAttribute::.ctor

Repro steps

Provide the steps required to reproduce the problem

  1. Open FSharp.Core.dll (I checked versions 4.0, 4.3, 4.4) in ILSpy or ILDASM
  2. Find the type CompilerMessageAttribute
  3. Notice there are two constructors. The expected one CompilerMessageAttribute(string, int), and the problematic CompilerMessageAttribute(object, object)

Expected behavior

I don't believe this constructor should exist.

Related information

Notes from @ReedCopsey :
https://github.com/Microsoft/visualfsharp/blob/65b178e13805410f27bed0679f6f2889868b6c96/src/fsharp/FSharp.Core/prim-types.fs#L348

https://github.com/Microsoft/visualfsharp/blob/65b178e13805410f27bed0679f6f2889868b6c96/src/fsharp/FSharp.Core/prim-types.fsi#L653

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions