question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Version 2.1.2 breaks auto-property constructor initialization

See original GitHub issue

Hi, when I updated to version 2.1.2 our entire application broke because as it turned out, during the IL weaving the auto-property initialization in the constructor have been replaced by direct backing-filed assignments.Here is a short example code.

public class Model {
  public int Something { get; set; }

  public Model() {
    Something = 1;
  }
}

In the generated assembly the Something = 1 property assignment is turned into assigning the value 1 to the corresponding backing field.

Reverting to 1.53.0 the problem is gone.

Is this behavior by design? If so, I couldn’t find any notes anywhere about such a breaking change.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tom-englertcommented, Jul 1, 2017

@SimonCropp then please re-open #220.

1reaction
tom-englertcommented, Jun 28, 2017

#264 will now have the old behavior as default; suppressing property changes from within the constructor can be controlled by the new NotifyAutoPropertiesInConstructorAttribute

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Auto-Property Initializes vs Constructor ...
It seems that the Auto-property initializer will be the first to be invoked, and then, the constructor. I made a small demo with...
Read more >
Constructors and member initializer lists
The member initializer list is the place where non-default initialization of these objects can be specified. For bases and non-static data ...
Read more >
“How-to” Guides
2.1.2. Automatic Property Expansion Using Gradle. You can automatically expand properties from the Gradle project by configuring the Java ...
Read more >
TypeScript: Documentation - Classes
A field declaration creates a public writeable property on a class: ... let , and var , the initializer of a class property...
Read more >
Object orientation
Constructors are special methods used to initialize an object with a specific state. As with normal methods, it is possible for a class...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found