When EnableAffectiveDialog = true is set in LiveConnectConfig, the Gemini server silently closes the WebSocket connection after receiving the setup message. AsyncSession.ReceiveAsync() returns null with no exception or error details, making this extremely difficult to diagnose.
Environment
• Package: Google.GenAI v1.5.0
• Runtime: .NET 8
• Model: gemini-2.5-flash-native-audio-latest
Steps to Reproduce:
using Google.GenAI;
using Google.GenAI.Types;
Client client = new(apiKey: "VALID_API_KEY");
LiveConnectConfig config = new() {
EnableAffectiveDialog = true, // ← causes the issue
ResponseModalities = [Modality.Audio],
SystemInstruction = new Content {
Parts = [new Part { Text = "You are a helpful assistant." }]
},
SpeechConfig = new SpeechConfig {
VoiceConfig = new VoiceConfig {
PrebuiltVoiceConfig = new PrebuiltVoiceConfig {
VoiceName = "Zephyr"
}
}
},
InputAudioTranscription = new AudioTranscriptionConfig(),
OutputAudioTranscription = new AudioTranscriptionConfig()
};
AsyncSession session = await client.Live.ConnectAsync(
"gemini-2.5-flash-native-audio-latest", config);
// This returns null — server closed the connection
LiveServerMessage setupMessage = await session.ReceiveAsync();
Console.WriteLine(setupMessage == null
? "BUG: setupMessage is null — server closed connection silently"
: "OK: SetupComplete received");
When EnableAffectiveDialog = true is set in LiveConnectConfig, the Gemini server silently closes the WebSocket connection after receiving the setup message. AsyncSession.ReceiveAsync() returns null with no exception or error details, making this extremely difficult to diagnose.
Environment
• Package: Google.GenAI v1.5.0
• Runtime: .NET 8
• Model: gemini-2.5-flash-native-audio-latest
Steps to Reproduce:
using Google.GenAI;
using Google.GenAI.Types;
Client client = new(apiKey: "VALID_API_KEY");
LiveConnectConfig config = new() {
EnableAffectiveDialog = true, // ← causes the issue
ResponseModalities = [Modality.Audio],
SystemInstruction = new Content {
Parts = [new Part { Text = "You are a helpful assistant." }]
},
SpeechConfig = new SpeechConfig {
VoiceConfig = new VoiceConfig {
PrebuiltVoiceConfig = new PrebuiltVoiceConfig {
VoiceName = "Zephyr"
}
}
},
InputAudioTranscription = new AudioTranscriptionConfig(),
OutputAudioTranscription = new AudioTranscriptionConfig()
};
AsyncSession session = await client.Live.ConnectAsync(
"gemini-2.5-flash-native-audio-latest", config);
// This returns null — server closed the connection
LiveServerMessage setupMessage = await session.ReceiveAsync();
Console.WriteLine(setupMessage == null
? "BUG: setupMessage is null — server closed connection silently"
: "OK: SetupComplete received");