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

Stack overflow error while building code with nested interfaces #45863

Closed
mordraugwe opened this issue Jul 10, 2020 · 0 comments
Closed

Stack overflow error while building code with nested interfaces #45863

mordraugwe opened this issue Jul 10, 2020 · 0 comments
Assignees
Milestone

Comments

@mordraugwe
Copy link

Version Used:
.Net Core SDK 3.1.301

Steps to Reproduce:

  1. Create new C# console application project (.net core 3.1, C# 8.0)
  2. Enable Nullable reference types. .csproj looks like:
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>netcoreapp3.1</TargetFramework>
        <Nullable>enable</Nullable>
    </PropertyGroup>
</Project>
  1. Add next code to Program.cs:
public interface IInterface
{
    public interface INestedInterface<T> 
    {
    }

    public interface INestedSubInterface<T1, T2> : INestedInterface<T1>
        where T2 : INestedSubInterface<T1, T2>.IDoubleNestedInterface
    {
        public interface IDoubleNestedInterface
        {
        }
    }
}
  1. dotnet build NestedInterfaces.csproj

Alternative Steps to Reproduce:

  1. Clone solution from https://github.com/mordraugwe/NestedInterfaces
  2. dotnet build NestedInterfaces.csproj

Expected Behavior:
Build succeeded.

Actual Behavior:

Build FAILED.
C:\Program Files\dotnet\sdk\3.1.301\Roslyn\Microsoft.CSharp.Core.targets(59,5): error : Stack overflow. [D:\dev\NestedInterfaces\NestedInterfaces\NestedInterfaces.csproj]

While writing this code in Visual Studio 16.6.3 it hangs and crashes. Issue has been reported
JetBrains Rider 2020.1.4 and Visual Studio Code with Omni plugin allows writing code but dotnet build gives Stack overflow error.

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

No branches or pull requests

4 participants