-
Notifications
You must be signed in to change notification settings - Fork 48
Closed
Description
.NET SDK events not firing - session hangs indefinitely
Environment
- CLI Version: 0.0.382 (latest)
- SDK Version: 0.1.12 (latest)
- Platform: Ubuntu 24.04, .NET 10.0.1
- Transport: stdio (default)
Problem
The .NET SDK successfully creates sessions and sends messages, but no events are ever received. Event handlers registered via session.On() are never called, causing applications to hang indefinitely waiting for SessionIdleEvent.
Reproduction
using GitHub.Copilot.SDK;
await using var client = new CopilotClient(new CopilotClientOptions
{
LogLevel = "debug",
AutoStart = true
});
await client.StartAsync();
Console.WriteLine("Client connected"); // ✅ This works
await using var session = await client.CreateSessionAsync(new SessionConfig
{
Model = "gpt-5",
Streaming = true
});
Console.WriteLine($"Session created: {session.SessionId}"); // ✅ This works
var done = new TaskCompletionSource();
session.On(evt =>
{
Console.WriteLine($"Event received: {evt.Type}"); // ❌ NEVER CALLED
if (evt is SessionIdleEvent)
{
done.SetResult();
}
});
var messageId = await session.SendAsync(new MessageOptions { Prompt = "What is 2+2?" });
Console.WriteLine($"Message sent: {messageId}"); // ✅ This works
await done.Task; // ❌ HANGS FOREVER - no events receivedExpected Behavior
Based on the SDK tests and documentation, should receive:
UserMessageEventAssistantMessageEventwith contentSessionIdleEventwhen complete
Actual Behavior
- Session creates successfully
SendAsync()returns a message ID successfully- Zero events are dispatched - event handler never fires
- Application hangs indefinitely waiting for
SessionIdleEvent
Testing
CLI works fine standalone:
$ echo "What is 2+2?" | copilot --allow-all
2 + 2 = 4
# Works in 4 secondsBut SDK never receives events from the same CLI process.
Debug Logs
dbug: GitHub.Copilot.SDK.CopilotClient[0]
Starting Copilot client
info: GitHub.Copilot.SDK.CopilotClient[0]
Copilot client connected
✅ Session created: 5f4457da-1c80-49e1-9d54-dce685b10b40
📤 Sent message: msg-1768508202337
[hangs here - no events ever arrive]
Analysis
The RpcHandler.OnSessionEvent() method in Client.cs appears to never be called, suggesting:
- CLI is not sending
session.eventJSON-RPC notifications, OR - StreamJsonRpc event subscription mechanism is broken, OR
- Protocol version mismatch between SDK and CLI
Impact
This makes the .NET SDK completely unusable - all async operations hang indefinitely.
Workaround
None found. Cannot use the SDK at all.
MLgentDev
Metadata
Metadata
Assignees
Labels
No labels