Skip to content

Static Initialization for Non-Byte Spans #3379

@ds5678

Description

@ds5678

Input code

internal class Class
{
	public static ReadOnlySpan<int> Data => new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
}

Erroneous output

internal class Class
{
	public static ReadOnlySpan<int> Data => RuntimeHelpers.CreateSpan<int>((RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
}

Details

  • Product in use: ILSpy
  • Version in use: 9.0 (the latest release)
  • SDK: 9.0.200-preview.0.25057.12 (the latest preview of .NET 9)
  • I'm open to contributing a fix, but I may need some guidance on how it should be implemented into the codebase. I understand the IL side of things, but I'm unfamiliar with the structure of ILSpy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDecompilerThe decompiler engine itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions