Skip to content

Commit a74e411

Browse files
#5916 fix multiple drop things (#5917)
* #5916 fix multiple drop things * Update orleans/Adventure/AdventureGrains/PlayerGrain.cs --------- Co-authored-by: David Pine <[email protected]>
1 parent 65014b1 commit a74e411

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

orleans/Adventure/AdventureGrains/PlayerGrain.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ public override Task OnActivateAsync(CancellationToken cancellationToken)
2626
async Task IPlayerGrain.Die()
2727
{
2828
// Drop everything
29-
var tasks = _things.Select(Drop).ToList();
30-
await Task.WhenAll(tasks);
29+
var dropTasks = new List<Task<string?>>();
30+
foreach (var thing in _things.ToArray() /* New collection */)
31+
{
32+
dropTasks.Add(Drop(thing));
33+
}
34+
await Task.WhenAll(dropTasks);
3135

3236
// Exit the game
3337
if (_roomGrain is not null && _myInfo is not null)

0 commit comments

Comments
 (0)