-
Following up from #3085, I'm hitting a couple more issues.
I don't think fody should be involved anymore, so I attempted to disable it, which results in a successful compilation, but a new runtime issue:
Here's ScoreInfo.cs on that branch for reference. Any pointers would be appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Fody is still involved with source generated classes because SG doesn't support the |
Beta Was this translation helpful? Give feedback.
-
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:
So this is a very subtle bug that we need to fix - ideally the source generator should detect when you're trying to assign readonly persisted properties and error out with a nice explanation. In the meantime though, the fix for you would be to make sure you don't do that. My suggestion would be to add an extension like: public static void AddRange<T>(this ICollection<T> collection, IEnumerable<T>? items)
{
if (items is null)
return;
}
foreach (T obj in items)
collection.Add(obj);
} and then use that rather than assignment: public BeatmapCollection(string? name = null, IList<string>? beatmapMD5Hashes = null)
{
ID = Guid.NewGuid();
Name = name ?? string.Empty;
BeatmapMD5Hashes.AddRange(beatmapMD5Hashes);
LastModified = DateTimeOffset.UtcNow;
} I haven't tried to compile all projects in the osu solution, but with that change, osu.Game compiles successfully (though I didn't run it to see if something else is broken). |
Beta Was this translation helpful? Give feedback.
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:
ManagedAccessor
. This means that the initializer would run twice for every instance created.