Incorrect decompile transformation from compiler generated iterator classes to C# iterators

2 posts, 0 answers
  1. Chris
    Chris avatar
    12 posts
    Member since:
    May 2011

    Posted 13 Apr 2012 Link to this post


    Version: 2012.1.409.0 SP1

    There is an error with the transformation from the compiler generated classes for iterators to C# iterators. It seems that the captured variables are not being initialized.

    For example, System.Linq.Enumerable::SkipIterator decompiles to the code below. You will notice that num is not initialized with the value of count.
    private static IEnumerable<TSource> SkipIterator<TSource>(IEnumerable<TSource> source, int count)
        IEnumerator<TSource> enumerator = source.GetEnumerator();
        using (enumerator)
            while (num > 0 && enumerator.MoveNext())
                int num = num - 1;
            if (num > 0)
                goto Label0;
            while (enumerator.MoveNext())
                yield return enumerator.Current;
        yield break;

    Best Regards,

  2. Yordan Dikov
    Yordan Dikov avatar
    69 posts

    Posted 20 Apr 2012 Link to this post

    Hi Chris,

     Thank you for pointing this issue out. We'll see what is causing it and we'll provide a fix in one of the future updates. Stay tuned and don't hesitate to contact us about anything in JustDecompile.

    Yordan Dikov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top