Skip to content

C# Struct Inherited Interface Causes Cycle In Interface Hierarchy #41501

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[regression] [worked-in:15.9.18]
When compiling the following code in Visual Studio 2019 (.NET 4.6.1 project)

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }

public struct TestStruct : TestStruct.IInnerInterface
    {
        public interface IInnerInterface
        {
        }
    }
}

it generates the following compile error:
CS0529 Inherited interface 'TestStruct.IInnerInterface' causes a cycle in the interface hierarchy of 'TestStruct'

The code compiles successfully in Visual Studio 2017.

The error can also be seen in .Net Core 3.1 using the default Roslyn compiler, however by importing the nuget dependency

    <ItemGroup>
      <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.3.1" />
    </ItemGroup>

to change the version of the compiler to an older version the code can successfully compile.


Original Comments

Visual Studio Feedback System on 1/2/2020, 10:32 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Visual Studio Feedback System on 2/6/2020, 07:32 PM:

I have detected that for the last 35 days, this issue didn't have much product team activity and a very small amount of new votes or comments. Based on this, its severity, and affected area, it’s my experience that this issue is very unlikely to be fixed.

David Symmonds on 2/7/2020, 00:16 AM:

I've been waiting patiently for this to be resolved as this is also breaking my existing code base. The last (automated?) comment is a little disheartening given that I'd assumed breaking changes to existing code bases would be prioritised.


Original Solutions

(no solutions)

Metadata

Metadata

Assignees

Labels

Area-CompilersBugResolution-FixedThe bug has been fixed and/or the requested behavior has been implemented

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions