Skip to content

Commit 5fb9f14

Browse files
Update dotnet/src/Client.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f8ab198 commit 5fb9f14

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

dotnet/src/Client.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,23 @@ public async Task<CopilotSession> CreateSessionAsync(SessionConfig? config = nul
383383
session.OnDisposed = (id) =>
384384
{
385385
_sessions.TryRemove(id, out _);
386-
SessionDestroyed?.Invoke(id);
386+
try
387+
{
388+
SessionDestroyed?.Invoke(id);
389+
}
390+
catch (Exception ex)
391+
{
392+
Debug.WriteLine($"Exception in SessionDestroyed event handler: {ex}");
393+
}
387394
};
388-
SessionCreated?.Invoke(session);
395+
try
396+
{
397+
SessionCreated?.Invoke(session);
398+
}
399+
catch (Exception ex)
400+
{
401+
Debug.WriteLine($"Exception in SessionCreated event handler: {ex}");
402+
}
389403

390404
return session;
391405
}

0 commit comments

Comments
 (0)