Incorrect Decompilation - Setting text of a ToolStripStatusLabel

2 posts, 0 answers
  1. john
    john avatar
    1 posts
    Member since:
    Oct 2012

    Posted 24 Jun 2011 Link to this post

    I have a .NET3.5 windows form application that decompiles to non functional code.

    The form has 2 elements on it:
    1) a richtextbox
    2) a Status strip (which contains a single ToolStripStatusLabel).

    The only thing the program does is count the length of the text in the richtextbox and write it out to the ToolStripStatusLabel.  I seem to be getting incorrect decompilation

    Actual Code:
        this.stripLabel.Text = this.txtContent.TextLength.ToString("###,###,###") + " bytes";

    Decompilation:
        int textLength = this.txtContent.TextLength.Text = string.Concat(textLength.ToString("###,###,###"), " bytes");

    Which doesn't work out because the object types don't match.

    So I played with it a little:

    I thought it may be an issue with the oddball RichtextBox.TextLength value, so I changed my code to:
    this.stripLabel.Text = this.txtContent.Text.Length.ToString("###,###,###") + " bytes";
    which then decompiled to:
    int length = this.txtContent.Text.Length.Text = string.Concat(length.ToString("###,###,###"), " bytes");
    which tried to create an invalid string.Length.Text property.


    Then I simplified it to:
    this.stripLabel.Text = this.txtContent.Text.Length.ToString();
    That then decompiles to:
    int length = this.txtContent.Text.Length.Text = length.ToString();
    which still tried to create an invalid string.Length.Text property, but also tried to use length.ToString() which wouldn't exist at this point yet.


    It just seems that it can't figure out that the text isn't being assigned to, but is being used to figure out what to assign to something else.  It also doesn't know what to do with this if it was able to get the length properly.
  2. Yordan Dikov
    Admin
    Yordan Dikov avatar
    69 posts

    Posted 05 Jul 2011 Link to this post

    Hi John,

     Thank you very much for the extensive report. We'll fix this bug in one of our forthcoming updates, so, please, update regularly.

    Kind regards,
    Yordan Dikov
    the Telerik team

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

  3. DevCraft banner
Back to Top