Skip to content

Remaining issues with source generation migration #3247

Answered by nirinchev
peppy asked this question in Q&A
Discussion options

You must be logged in to vote

So the issue seems to be with this line: https://github.com/ppy/osu/blob/d679703fa24dcf8ed12f95febd0eeb962e3552a6/osu.Game/Collections/BeatmapCollection.cs#LL47.

The problem here comes from the interaction of two things we didn't account well for:

  1. For source generated classes, we added an optimization that removes the backing fields from the models. The reason is those are never used and with large classes it does show up in benchmarks for GC. It also can result in incorrect behavior because we copy the property initializers into the generated ManagedAccessor. This means that the initializer would run twice for every instance created.
  2. In the ctor you're setting readonly properties. Since…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@peppy
Comment options

Answer selected by peppy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants