Steps to reproduce
Compile:
new F().Bar();
new SubF().Bar();
class F : F.IFoo
{
protected interface IFoo
{
void Foo();
}
void IFoo.Foo()
{
System.Console.WriteLine("F");
}
public void Bar()
{
((IFoo)this).Foo();
}
}
class SubF : F, SubF.ISubFoo
{
protected interface ISubFoo : F.IFoo { }
void F.IFoo.Foo()
{
System.Console.WriteLine("SubF");
}
}
Decompiled CSharp:
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
internal class F : F.IFoo
{
protected interface IFoo
{
void Foo();
}
void IFoo.Foo()
{
Console.WriteLine("F");
}
public void Bar()
{
((IFoo)this).Foo();
}
}
internal class SubF : F, SubF.ISubFoo, F.IFoo //<-- F.IFoo is not implemented directly
{
protected interface ISubFoo : IFoo
{
}
void IFoo.Foo()
{
Console.WriteLine("SubF");
}
}
The interface list of SubF contains an unexpected F.IFoo. This is invalid CSharp - it would not compile.
Steps to reproduce
Compile:
Decompiled CSharp:
The interface list of
SubFcontains an unexpectedF.IFoo. This is invalid CSharp - it would not compile.