CosmosOS / IL2CPU

IL2CPU is a compiler for .NET IL code to compile to assembly language for direct booting.
BSD 3-Clause "New" or "Revised" License
282 stars 70 forks source link

Problem with IEnumerable #40

Closed fanoI closed 4 years ago

fanoI commented 6 years ago

Having this simply IEnumerable function:

        static IEnumerable<Command> RegisterAllCommands()
        {
            yield return new Echo();
            yield return new Help();
        }

If I simply call it:

 RegisterAllCommands();

I get Stack Overflow exception, a normal Net Core application does little better simply blocks as the IEnumerable is not evalutated.

Doing instead a simple empty foreach (I know I cannot call .ToList() / .ToArray() as that will be a call to a Linq method):

foreach (var c in RegisterAllCommands()) { }

I get this error from IL2CPU itself that make the compilation fail:

Error Exception: System.ArgumentException: 'this' type cannot be an interface itself