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

C# 9.0 covariant return types break the engine, aboring running the entire test class that contains such code #3732

Closed
Rekkonnect opened this issue Jan 17, 2021 · 2 comments

Comments

@Rekkonnect
Copy link

I was trying to run tests for one class in my library, and it suddenly threw that issue in a class:

OneTimeSetUp: System.TypeLoadException : Return type in method '<type>.<function>()' on type '<type>' from assembly <assembly> is not compatible with base type method '<baseType>.<function>()'.

I was using NUnit 3.12.0, updated to 3.13.0, and now the tests will not even show a result; I'm assuming the issue silently occurs.

Basically, this issue applies to code of the following pattern:

class BaseClass
{
    virtual BaseClass Function();
}
class InheritingClass
{
    override InheritingClass Function();
}

For the specific case that I encountered, look at this commit's description.

@mikkelbu
Copy link
Member

@alfasgd It sounds similar to dotnet/runtime#45344 (and related issues). Can you provide a small test samples that reproduces the problem?

@Rekkonnect
Copy link
Author

Yes indeed this is a .NET 5.0 issue; current issue is dotnet/runtime#47007. Closing here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants