Skip to content

A programming framework for agentic AI

Add code analysis (#305)

Andreas Volkmannd8bf7ee8a8a8
diff --git a/dotnet/src/Microsoft.AI.Agents.Worker.Client/AgentWorkerRuntime.cs b/dotnet/src/Microsoft.AI.Agents.Worker.Client/AgentWorkerRuntime.cs
index ad2fd24dc..39e05e00b 100644
--- a/dotnet/src/Microsoft.AI.Agents.Worker.Client/AgentWorkerRuntime.cs
+++ b/dotnet/src/Microsoft.AI.Agents.Worker.Client/AgentWorkerRuntime.cs
@@ -8,7 +8,9 @@ using Microsoft.Extensions.DependencyInjection;
using System.Threading.Channels;
using Grpc.Net.Client.Configuration;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using static System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes;
namespace Microsoft.AI.Agents.Worker.Client;
@@ -56,7 +58,8 @@ public static class HostBuilderExtensions
public sealed class AgentApplicationBuilder(IHostApplicationBuilder builder)
{
- public AgentApplicationBuilder AddAgent<TAgent>(string typeName) where TAgent : AgentBase
+ public AgentApplicationBuilder AddAgent<
+ [DynamicallyAccessedMembers(PublicConstructors)] TAgent>(string typeName) where TAgent : AgentBase
{
builder.Services.AddKeyedSingleton("AgentTypes", (sp, key) => Tuple.Create(typeName, typeof(TAgent)));
return this;