-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Inconsistent behavior using interface with generic out and derived classes with explicit implementations #103365
Comments
Based on local testing, it looks like both mono x86 jit and mono interpreter also do this incorrectly. |
As an interim workaround, a construction like this appears to work:
I'm guessing whatever your real scenario is might make it impossible to apply this as a workaround though. |
* Slightly reduce memory usage for classes without a variance search table (many of them) * Make the variance search table for a given class larger, but remove the need to recursively search every table in the hierarchy * Optimize out the additional interfaces list scan to compute the interface offset once we find a match in the variance table
This should be fixed now. Feel free to reopen if it's not fixed for your real scenario. |
Can you verify what version will have the fix? |
Preview 7 should have it. RC1 will as well. |
…238) This is the same issue that we saw previously with `ChatMessage`'s serialization in unity/mono/etc. See: dotnet/runtime#103365 See: #138
Description
When using an interface with a generic out type, an explicit implementation, and a derived class, the base classes implementation is called instead of the derived class when running on Android. Running on Windows yields the expected behavior.
Reproduction Steps
Given an interface:
and a couple of classes:
You can then create some objects in a list and iterate over them to call their function:
Expected behavior
I would expect the behavior to be the same on Android and Windows.
Actual behavior
The printouts you will see when running on Windows is:
and when running on Android:
Regression?
No response
Known Workarounds
No response
Configuration
.NET 8
Android 33 and Windows x64
Other information
This only occurs with explicit interface declarations. If you simply hide the base implementation, the issue does not occur. This is true for implicit hiding, 'new' keyword, and overriding virtual functions.
The text was updated successfully, but these errors were encountered: