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

Combination ref struct and ref parameter causes type constraint IL verification errors #1328

Open
mikernet opened this issue Feb 24, 2024 · 0 comments

Comments

@mikernet
Copy link

mikernet commented Feb 24, 2024

Description

Combination of ref struct and ref parameters causes validation to fail for the code below. Making BinaryReader a normal non-ref struct or making the parameters non-ref causes the validation error to go away.

Reproduction Steps

Sharplab link

ref struct BinaryReader {}

static class IntProcessor
{
    public static void Read(ref BinaryReader reader)
    {
    }
}

public static class Program {
    public static void Main() {
        BinaryReader reader = new();
        IntProcessor.Read(ref reader);
    }
}

Configuration

.NET 8.0.0

@mikernet mikernet changed the title Combination of generics, ref struct and ref parameter causes type constraint IL verification errors Combination ref struct and ref parameter causes type constraint IL verification errors Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant