c#中递归泛型类型的问题

min*_*ill 14 c# generics mono recursion exception-handling

我有一些C#代码在mono和Microsoft的.net编译器下编译得很好,但只能在单声道上运行.错误消息是(我添加的换行符)

Unhandled Exception: System.TypeLoadException:
Could not load type 'Hasse.Groups.Heavy.Product.PowerGroup`1'
from assembly 'Hasse, Version=1.0.x.y, Culture=neutral, PublicKeyToken=null'
because it has recursive generic definition.
Run Code Online (Sandbox Code Playgroud)

该类型实际上有一个递归的泛型定义,所以我的问题是:为什么它与单声道一起工作?[代码运行并产生预期结果]

完整的源代码在这里:https://github.com/miniBill/Hasse

减少仍然崩溃的代码在这里:

public class Group<T> : IWrappableGroup<WrapperGroup<T>> {}

public class WrapperElement<T> {}

public interface IWrappableGroup<U> {}

public class WrapperGroup<T> : Group<WrapperElement<T>> {}

class MainClass {
    public static void Main(string[] args){
        var ng = new Group<object>();
    }
}
Run Code Online (Sandbox Code Playgroud)

以下证明它适用于单声道:http://ideone.com/ZvA3I

Mat*_*ted 6

这是一个已知问题.它可能被报告为编译器错误.

http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-335.pdf(第129页)

至于在Mono工作,就规格而言,有几个地方Mono的工作"被打破".

(递归lambda是另一个在Mono中工作的东西,不应该)