Poor decompile error

4 posts, 0 answers
  1. Davo
    Davo avatar
    3 posts
    Member since:
    Apr 2011

    Posted 28 Apr 2011 Link to this post

    ILSpy decompile of the method in question (not a bad effort):

    public string[] GetNames()
    {
        string[] array = new string[this._namesDictionary.Count];
        int num = 0;
     
        IEnumerator enumerator = this._namesDictionary.Keys.GetEnumerator();
        try
        {
            while (enumerator.MoveNext())
            {
                string text = (string)enumerator.Current;
                array[num++] = text;
                }
            }
        finally
            {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
        return array;
    }


    *********************************************
    Telerik decompile (spot the obvious mistake!)

    public  string[] GetNames()
    {
        string[] strArrays = new string[this._namesDictionary.Count];
        int num = 0;
        foreach (string key in this._namesDictionary.Keys)
        {
            num[num++] = key;
        }
        return strArrays;
    }



    *********************************
    This isn't meant to be a criticism, just trying to help what I think is going to be a great tool!

    David


  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 28 Apr 2011 Link to this post

    Dave-

    Thanks for the report. Improving the all around decompiling output and accuracy is #2 on the priority list for post-Beta work (second only to adding support for VB).

    I actually like your example. I think it well highlights how JustDecompile is doing a better job decompiling back to code that is closer to the original...other than the wrong method name in this case! That's clearly very strange and we'll definitely investigate. Is this an assembly you can share for repo steps?

    -Todd
  3. DevCraft banner
  4. Davo
    Davo avatar
    3 posts
    Member since:
    Apr 2011

    Posted 28 Apr 2011 Link to this post

    Sorry, the Method Name is erroneous ... :( shame on me! ignore that, the issue is the 'num[num++] = ...'

    Please be clear on this, I think what you guys are doing is great, this is the first time I have ever contributed feedback like this and I have done so because I am impressed with it and want it to be a great app!

    Unfortunately I can't give you the dll in question, work would not be happy! What I will try to do is to try recreate in my own time with a simple example. If I can, will upload it here.

  5. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 28 Apr 2011 Link to this post

    Yes, I see that error now, too. I think I got thrown looking for the most "obvious" error. :)

    We'll definitely research this, and it will likely be fixed in an upcoming post-beta build. Thanks for taking the time to report and for getting involved with the beta. If you have any additional feedback or trouble, you know where to find help.

    -Todd
Back to Top