mirror of
https://github.com/microsoft/autogen.git
synced 2025-11-16 01:55:18 +00:00
Unlike with the InProcessRuntime, there is a two-phase initialization, first when AgentsApp is built (when initial agents are registered) and when it StartAsync()s and connects to the Gateway. Unfortunately, it is possible to attempt to send direct RPC calls to the Gateway before the message channel is opened; in this case, the Gateway has no connected client corresponding to the RPC's clientId, and falls over. The fix is to defer registering agents and subscriptions with the gateway until after the connection is established after .StartAsync() is called.
23 lines
622 B
C#
23 lines
622 B
C#
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// TestBase.cs
|
|
|
|
namespace Microsoft.AutoGen.Core.Grpc.Tests;
|
|
|
|
public class TestBase
|
|
{
|
|
public TestBase()
|
|
{
|
|
try
|
|
{
|
|
// For some reason the first call to StartAsync() throws when these tests
|
|
// run in parallel, even though the port does not actually collide between
|
|
// different instances of GrpcAgentRuntimeFixture. This is a workaround.
|
|
_ = new GrpcAgentRuntimeFixture().StartAsync().Result;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Console.WriteLine(e);
|
|
}
|
|
}
|
|
}
|