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

Avoiding Mono's ParameterInfo[].AsSpan() bug #1571

Merged
merged 2 commits into from Jul 2, 2023
Merged

Conversation

CreepGin
Copy link
Contributor

@CreepGin CreepGin commented Jul 2, 2023

Changed AsSpan usage in TypeReference.Construct to plain iteration.

#1543 (beta-2050) has a ParameterInfo[].AsSpan usage which will throw ArrayTypeMismatchException in Mono (I think only when the target method is static).

It was reported to mono years ago (mono/mono#17993), but like many other mono bugs, I don't think they will get fixed anytime soon or ever.

This is breaking things like new Color(1, 1, 1, 1) with Unity, or anything similar to this:

// C#
public struct Foo {
    public Foo(float a, float b) {
    }

    public Foo(float a) {
    }
}
// JS
new Foo(1, 1) // throws ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.

@lahma lahma merged commit b1df4cb into sebastienros:main Jul 2, 2023
3 checks passed
@lahma
Copy link
Collaborator

lahma commented Jul 2, 2023

Thank you!

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

Successfully merging this pull request may close these issues.

None yet

2 participants