Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 986651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:21:13+00:00 2026-05-16T05:21:13+00:00

I ran across this issue today and was able to determine that, when doing

  • 0

I ran across this issue today and was able to determine that, when doing code cleanup, R# will not convert properties from having backing fields to auto properties in classes that are decorated with the SerializableAttribute, e.g.

using System; 

namespace DataContracts
{
    [Serializable]
    public class Class1
    {
        private bool _wontChange;

        public bool WontChange
        {
            get { return _wontChange; }
            set { _wontChange = value; }
        }
    }
}

The above code will not be changed during automatic code cleanup. Of course, I can do this manually, and I still get the quick-action menu option from R# to do it at the individual property level. But it’s got me wondering if there’s an underlying issue that I’m not aware of in using auto properties in [Serializable] classes.

In the JetBrains forum thread we’re referred to an issue in which this problem is discussed, but it does not seem to be definitively resolved.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:21:13+00:00Added an answer on May 16, 2026 at 5:21 am

    When you serialize objects the field-names etc start to matter, because most serialization-mechanism use the field-names to restore the serialized data. Now when you change the field-name you cannot read older serialized versions correctly.

    When you convert to auto-properties, the backing-field will have a auto-generated name, which doesn’t match the old name. Therefore this would introduce a potential problem when reading old serialized data.

    I assume to avoid this pitfall, R# doesn’t change it automatically to a auto-property if the class is marked as serializable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran across an interesting issue in some of my humanize_bytes() code. This loop
I ran across this chunk of code (modified) in our application, and am confused
I recently ran across this puzzle, was finally able to struggle out a hacky
A situation I ran across this week: we have a jQuery Ajax call that
I was reading Joel On Software today and ran across this quote : Without
I ran across some routes that followed this format: resources :foobar, except: create I
I recently ran across a routine that looks something like this: procedure TMyForm.DoSomething(list: TList<TMyObject>;
I ran across this segment of code (in .m implementation file in an IBAction
I recently ran across this problem while trying to implement a service that has
I recently ran across this code in one of the projects I'm working on,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.