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

Problem with IEnumerable #40

Closed
fanoI opened this issue Feb 9, 2018 · 0 comments
Closed

Problem with IEnumerable #40

fanoI opened this issue Feb 9, 2018 · 0 comments

Comments

@fanoI
Copy link
Contributor

fanoI commented Feb 9, 2018

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

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

No branches or pull requests

2 participants