Support for auto properties?

7 posts, 0 answers
  1. Attila
    Attila avatar
    1 posts
    Member since:
    Jul 2012

    Posted 27 Jun 2013 Link to this post

    Hi!

    Is there a way to get rid of these kind of noise in the decompiled code:

         public DateTime JustDecompileGenerated_get_CloseDateTime()
            {
                return this.dateTime_1;
            }

            private void JustDecompileGenerated_set_CloseDateTime(DateTime value)
            {
                this.dateTime_1 = value;
            }

            public DateTime CloseDateTime
            {
                get
                {
                    return JustDecompileGenerated_get_CloseDateTime();
                }
                set
                {
                    JustDecompileGenerated_set_CloseDateTime(value);
                }
            }

    All the auto properties are generated this way, and sometime a field name inside the JustDecompileGenerated functions are simply wrong since they're not added to the class itself.

    Thanks,
    Attila
  2. Yordan Dikov
    Admin
    Yordan Dikov avatar
    69 posts

    Posted 27 Jun 2013 Link to this post

    Hello Attila,

     Thank you for getting in touch with us. JustDecompile decides to split properties, when the getter and setter cannot be combined together in one property, due to differences in their modifiers (for instance virtual getter and non-virtual setter - this is possible in IL, but not in C#). At the moment there is no option to allow disabling this behavior. However, from the code you've shown, I see that JD split a property when it wasn't needed. This is definitely a bug, and we'll be grateful if you can send us a sample assembly, that reproduces this behavior, so we can further investigate it at our side and fine-tune this logic.

    Regards,
    Yordan Dikov
    Telerik
    Tell us what you think about JustDecompile. Your opinion matters! You can use our forum, or our JustDecompile UserVoice website for feature requests.
  3. DevCraft banner
  4. David
    David avatar
    3 posts
    Member since:
    Feb 2012

    Posted 15 Oct 2014 in reply to Yordan Dikov Link to this post

    I've seen this bug.

    When I have code that looks like this:
    namespace ClassLibrary1
    {
        public class Class1
        {
            public virtual string Prop1 { get; private set; }
        }
    }

    I get code like this from JustDecompile:
    using System;
    using System.Runtime.CompilerServices;
     
    namespace ClassLibrary1
    {
        public class Class1
        {
            public string Prop1
            {
                get
                {
                    return JustDecompileGenerated_get_Prop1();
                }
                set
                {
                    JustDecompileGenerated_set_Prop1(value);
                }
            }
     
            private string JustDecompileGenerated_Prop1_k__BackingField;
     
            public virtual string JustDecompileGenerated_get_Prop1()
            {
                return this.JustDecompileGenerated_Prop1_k__BackingField;
            }
     
            private void JustDecompileGenerated_set_Prop1(string value)
            {
                this.JustDecompileGenerated_Prop1_k__BackingField = value;
            }
     
            public Class1()
            {
            }
        }
    }

    David
  5. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 16 Oct 2014 Link to this post

    Hello,

    Thanks for letting us know about this. Which version of JustDecompile are you using?

    Regards,
    Tsviatko Yovtchev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. David
    David avatar
    3 posts
    Member since:
    Feb 2012

    Posted 16 Oct 2014 in reply to Tsviatko Yovtchev Link to this post

    I'm using the latest version, 2014.1.225.0.

    Here's another scenario where something similar will happen.

    When I have code like this:
    namespace ClassLibrary1
    {
        public interface IHasReadonlyProperty
        {
            string Prop2 { get; }
        }
     
        public class Class1 : IHasReadonlyProperty
        {
            public string Prop2 { get; set; }
        }
    }

    I get code like this from JustDecompile:
    using System;
     
    namespace ClassLibrary1
    {
        public interface IHasReadonlyProperty
        {
            string Prop2
            {
                get;
            }
        }
    }
    and
    using System;
    using System.Runtime.CompilerServices;
     
    namespace ClassLibrary1
    {
        public class Class1 : IHasReadonlyProperty
        {
            public string Prop2
            {
                get
                {
                    return JustDecompileGenerated_get_Prop2();
                }
                set
                {
                    JustDecompileGenerated_set_Prop2(value);
                }
            }
     
            private string JustDecompileGenerated_Prop2_k__BackingField;
     
            public string JustDecompileGenerated_get_Prop2()
            {
                return this.JustDecompileGenerated_Prop2_k__BackingField;
            }
     
            public void JustDecompileGenerated_set_Prop2(string value)
            {
                this.JustDecompileGenerated_Prop2_k__BackingField = value;
            }
     
            public Class1()
            {
            }
        }
    }

    David
  7. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 20 Oct 2014 Link to this post

    Hello,

    That really is annoying and it looks like a problem on our side. We have it on our list now. Please, stay tuned and update regularly.

    Regards,
    Tsviatko Yovtchev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  8. David
    David avatar
    3 posts
    Member since:
    Feb 2012

    Posted 20 Oct 2014 in reply to Tsviatko Yovtchev Link to this post

    OK. Glad I could bring this to your attention. Look forward to seeing the fix.
Back to Top
DevCraft banner