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

Static virtual interface methods not called on the base interface #8038

Closed
vyacheslav-volkov opened this issue May 13, 2023 · 1 comment
Closed
Assignees
Labels
needs-triage Issues that need to be assigned.

Comments

@vyacheslav-volkov
Copy link

Android application type

.NET Android (net7.0-android, etc.)

Affected platform version

Version: 13.2.0.0

Description

Static virtual interface methods not called on the base interface, it works for net7.0.

Steps to Reproduce

  1. Create an android app.
  2. Run this code and it will fail with the NotSupportedException:
public interface ITestVirtualStaticBase
{
    static virtual string Test() => throw new NotSupportedException();
}

public interface ITestVirtualStatic : ITestVirtualStaticBase
{
    static string ITestVirtualStaticBase.Test() => "Test";
}

[Activity(Label = "@string/app_name", MainLauncher = true)]
public class MainActivity : Activity
{
    public static string Test<T>() where T : ITestVirtualStaticBase => T.Test();

    protected override void OnCreate(Bundle? savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        var test = Test<ITestVirtualStatic>(); //throws NotSupportedException instead of "Test" value
    }
}

Did you find any workaround?

No response

Relevant log output

No response

@vyacheslav-volkov vyacheslav-volkov added the needs-triage Issues that need to be assigned. label May 13, 2023
@jpobst
Copy link
Contributor

jpobst commented May 13, 2023

I think this is an issue in the Mono runtime and will need to be filed in dotnet/runtime. If I understand correctly, they may already be tracking it for .NET 8:

@jpobst jpobst closed this as completed May 22, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-triage Issues that need to be assigned.
Projects
None yet
Development

No branches or pull requests

2 participants