Skip to content

Compilation-time error, no error location output!!! Span<ulong> span = MemoryMarshal.Cast<TestStruct, ulong>(arr); #122827

@delverOne25

Description

@delverOne25

Description

    Span<ulong> span = MemoryMarshal.Cast<TestStruct, ulong>(arr);

Span span = MemoryMarshal.Cast<TestStruct, ulong>(arr);
"error CS0029: Cannot implicitly convert type 'System.ReadOnlySpan' to 'System.Span'

Correct, an explicit conversion is needed:

Span span = MemoryMarshal.Cast<TestStruct, ulong>(arr.AsSpan());
However, Visual Studio doesn't show this error and doesn't detect it at all - compilation just stops abruptly without showing where the error occurred.

Reproduction Steps

1

Expected behavior

1

Actual behavior

1

Regression?

1

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions