diff --git a/osu.Framework.Tests/Threading/SchedulerTest.cs b/osu.Framework.Tests/Threading/SchedulerTest.cs index 9d0e15d2e7..7f2099672d 100644 --- a/osu.Framework.Tests/Threading/SchedulerTest.cs +++ b/osu.Framework.Tests/Threading/SchedulerTest.cs @@ -429,6 +429,8 @@ public void TestAddOnceInlineDelegate() { classInvocations = 0; + // Note that while this works here (even with a capture), there's no guarantee that will always be the + // case. As such it's always best to use a local function or private method. for (int i = 0; i < 10; i++) invokeInlineDelegateAction(); diff --git a/osu.Framework/Threading/Scheduler.cs b/osu.Framework/Threading/Scheduler.cs index 88b3affd59..e76c32f7b9 100644 --- a/osu.Framework/Threading/Scheduler.cs +++ b/osu.Framework/Threading/Scheduler.cs @@ -368,7 +368,7 @@ public bool AddOnce(Action task, T data) /// Adds a task which will only be run once per frame, no matter how many times it was scheduled in the previous frame. /// /// The task will be run on the next independent of the current clock time. - /// The work to be done. + /// The work to be done. Avoid using inline delegates as they may not be cached, bypassing the once-per-frame guarantee. /// Whether this is the first queue attempt of this work. public bool AddOnce(Action task) {