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

Weird cast #3253

Closed
CreateAndInject opened this issue Aug 4, 2024 · 6 comments
Closed

Weird cast #3253

CreateAndInject opened this issue Aug 4, 2024 · 6 comments
Labels
Bug Decompiler The decompiler engine itself

Comments

@CreateAndInject
Copy link
Contributor

Is the same issue as #3011?

image

@CreateAndInject CreateAndInject added Bug Decompiler The decompiler engine itself labels Aug 4, 2024
@siegfriedpammer
Copy link
Member

Hard to say without taking a look at the IL...

@CreateAndInject
Copy link
Contributor Author

Hard to say without taking a look at the IL...

@siegfriedpammer Check it : test.zip

@siegfriedpammer
Copy link
Member

image

Yes, in this assembly the code is trying to assign an array of type System.Byte from mscorlib v2 to a variable of type array of type System.Byte from mscorlib v4. This causes these weird casts.

@CreateAndInject
Copy link
Contributor Author

image
image

How about those Unsafe.As? Is also the same issue?

@siegfriedpammer
Copy link
Member

@dgrunwald do you think it would make sense to do "unification" of well-known/special types in the type-system?

@dgrunwald
Copy link
Member

I think this makes more sense as a job for the assembly resolver -- there shouldn't be multiple mscorlibs in the same compilation.
If we let both assemblyrefs resolve to the newer mscorlib version, then the typerefs will also resolve to the same type and the casts are avoided.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Decompiler The decompiler engine itself
Projects
None yet
Development

No branches or pull requests

3 participants