Back to Csharplang

LDM 2024 07 15 Usage Data

meetings/2024/LDM-2024-07-15-usage-data.md

latest3.4 KB
Original Source

Building a large internal repo with this.field/value style of breaking changes had 100+ errors. Hit every variation of the diagnostic:

  • field as field
  • value as field
  • this.that.value in accessor

Example:

csharp
public int Value
{
  get { return this.value; }
  set
  {
    this.value = value;
    this.valuePtr = &value;
  }
}

Random repos found with GH queries

I only dug in the first 4-5 pages for each query as I felt it was representative at that point. Possible I'm wrong but I doubt the numbers would change if we dug any deeper.

More GH queries:

  • _field as a field name. 6K results, near 100% hit rate
  • _value as a field name. 137K results, near 100% hit rate

Largest intentional breaking change we've in last ~5 years was lambda inference and overload changes:

  • Had a very long lead and got plenty of preview feedback about it.
  • In total we had ~20-30 bugs filed against it.
  • That is number of customers who did not self correct. Let's assume for sake of argument that total number of users that hit this problem is 10x reported. So 200-300

My conclusions from data:

  1. Generated code is a challenge for our fixer
  2. field and _field are uncommon but not rare field names
    • The use of field/_field is a style decision
    • Breaking change is about the style in which it is declared and accessed: this.field = vs. field =
  3. value and _value are common field names
    • The use of value/_value is a style decision
    • Breaking change is about the style in which it is declared and accessed: this.value vs. value =
  4. Ratio of field:value virtually every query is 1:8-1:12
  5. Breaks on this.value or this.field are not viable
    • In the range of 20K and 10K impacted GH samples
    • That is roughly 2 orders of magnitude greater than the upper bound of our highest breaking change
  6. It is very hard to quantify what the breaks on naked field / value would be.
    • Hard to construct a GH query to narrow down to uses of field / value without keywords.
    • Metadata queries can't distinguish between this.field and simply field in an accessor