fix(net): preserve failed session tick stacks

Keep the original exception stack when cleanup succeeds so connected lifecycle failures identify the real packet/event handler instead of the session wrapper.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
This commit is contained in:
Erik 2026-07-24 19:48:11 +02:00
parent 621f70eab6
commit 3f1548b952
2 changed files with 8 additions and 1 deletions

View file

@ -342,6 +342,8 @@ internal sealed class LiveSessionController
catch (Exception tickError)
{
Exception error = StopAfterFailure(tickError);
if (ReferenceEquals(error, tickError))
throw;
throw error;
}
});

View file

@ -805,11 +805,16 @@ public sealed class LiveSessionControllerTests
controller.Start(LiveOptions(), host);
WorldSession session = operations.Sessions[0];
Assert.Throws<InvalidOperationException>(controller.Tick);
InvalidOperationException error =
Assert.Throws<InvalidOperationException>(controller.Tick);
Assert.False(controller.IsInWorld);
Assert.Null(controller.CurrentSession);
Assert.Equal(1, operations.DisposeCounts[session]);
Assert.Contains(
$"{nameof(TestOperations)}.{nameof(TestOperations.Tick)}",
error.StackTrace,
StringComparison.Ordinal);
}
[Fact]