Skip to content

.NET: [Bug]: Microsoft.Agents.AI.Foundry.Hosting resolves broken Microsoft.OpenTelemetry 1.0.0-beta.1 via Azure.AI.AgentServer.Core #10398

Open

Description

@seangayler-msft

Observed Behavior

Microsoft.Agents.AI.Foundry.Hosting (1.20.0-preview.260831.1 through 1.28.0-preview.261106.1) depends on Azure.AI.AgentServer.Core (1.0.0-beta.28 / 1.0.0-beta.30) and Azure.AI.AgentServer.Responses (1.0.0-beta.8 / 1.0.0-beta.9):

Azure.AI.AgentServer.Core (<= 1.0.0-beta.31) declares Microsoft.OpenTelemetry >= 1.0.0-beta.1 (Azure.AI.AgentServer.Core.Packages.props#L3 (Azure.AI.AgentServer.Core_1.0.0-beta.31)), so NuGet resolves Microsoft.OpenTelemetry 1.0.0-beta.1 (2026-04-27).

In Foundry hosted agents, this causes three problems:

  1. Non-OTel-compliant invoke_agent messages: Microsoft.OpenTelemetry 1.0.0-beta.1 rewrites gen_ai.input.messages and gen_ai.output.messages into {"version":"0.1.0","messages":[...]} instead of a JSON array (AgentFrameworkSpanProcessor.cs#L41-L54 (v1.0.0-beta.1); fixed in 1.0.3 via microsoft/opentelemetry-distro-dotnet#105). Foundry portal shows raw JSON and trace evaluations drop every turn.
  2. Agent 365 batch export crash: Every export batch containing agent or chat spans throws System.ArgumentException: An item with the same key has already been added. Key: gen_ai.conversation.id (ExportFormatter.cs#L274-L284 (v1.0.3); fixed in 1.0.4 via microsoft/opentelemetry-distro-dotnet#112) because both FoundryEnrichmentProcessor and OpenTelemetryChatClient write gen_ai.conversation.id.
  3. Startup crash if Microsoft.OpenTelemetry is upgraded to >= 1.0.3: Microsoft.OpenTelemetry 1.0.3 removed Agent365Options.Exporter (commit b5464eab), while Azure.AI.AgentServer.Core <= 1.0.0-beta.31 still calls options.Agent365.Exporter.* (OpenTelemetryExtensions.cs#L210-L211 (Azure.AI.AgentServer.Core_1.0.0-beta.31)). When the Foundry platform sets FOUNDRY_AGENT365_TRACING_ENABLED=true, AgentHostBuilder.Build() crashes at startup (HTTP 424 session_not_ready) with System.MissingMethodException.

Expected Behavior

Microsoft.Agents.AI.Foundry.Hosting pulls in Azure.AI.AgentServer.Core and Azure.AI.AgentServer.Responses versions built against Microsoft.OpenTelemetry >= 1.0.4, so that:

  • invoke_agent spans emit standard OpenTelemetry JSON arrays for gen_ai.input.messages and gen_ai.output.messages.
  • Agent 365 telemetry batches export without ArgumentException on duplicate gen_ai.conversation.id tags.
  • Hosted agents start cleanly when FOUNDRY_AGENT365_TRACING_ENABLED=true.

Steps to Reproduce

  1. Create a .NET 10.0 web project referencing Microsoft.Agents.AI.Foundry.Hosting (1.28.0-preview.261106.1 or 1.20.0-preview.260831.1).
  2. Deploy as a Foundry hosted agent (where FOUNDRY_AGENT365_TRACING_ENABLED=true and OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true are enabled) and invoke /responses — observe {"version":"0.1.0","messages":[...]} on invoke_agent spans and ArgumentException (Key: gen_ai.conversation.id) in Agent 365 export.
  3. Add <PackageReference Include="Microsoft.OpenTelemetry" Version="1.0.4" /> (or 1.2.0) to pick up the telemetry fixes, keep FOUNDRY_AGENT365_TRACING_ENABLED=true, and run AgentHost.CreateBuilder(args).Build() — observe unhandled System.MissingMethodException at startup.

Minimal Reproduction

<!-- Repro.csproj -->
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Agents.AI.Foundry.Hosting" Version="1.28.0-preview.261106.1" />
    <!-- Upgrading Microsoft.OpenTelemetry to >= 1.0.3 to fix the 1.0.0-beta.1 bugs triggers MissingMethodException: -->
    <PackageReference Include="Microsoft.OpenTelemetry" Version="1.0.4" />
  </ItemGroup>
</Project>
// Program.cs
Environment.SetEnvironmentVariable("FOUNDRY_HOSTING_ENVIRONMENT", "hosted");
Environment.SetEnvironmentVariable("FOUNDRY_AGENT365_TRACING_ENABLED", "true");
Environment.SetEnvironmentVariable("FOUNDRY_AGENT_INSTANCE_CLIENT_ID", "00000000-0000-0000-0000-000000000001");

var builder = AgentHost.CreateBuilder(args);
var app = builder.Build(); // Throws System.MissingMethodException: Agent365Options.get_Exporter()

Error Messages and Stack Traces

Unhandled exception. System.MissingMethodException: Method not found: 'Microsoft.Agents.A365.Observability.Runtime.Tracing.Exporters.Agent365ExporterOptions Microsoft.OpenTelemetry.Agent365Options.get_Exporter()'.
   at Azure.AI.AgentServer.Core.Internal.OpenTelemetryExtensions.ConfigureAgent365Export(MicrosoftOpenTelemetryOptions options)
   at Azure.AI.AgentServer.Core.Internal.OpenTelemetryExtensions.<>c.<AddAgentHostTelemetry>b__1_0(MicrosoftOpenTelemetryOptions options)
   at Microsoft.OpenTelemetry.MicrosoftOpenTelemetryBuilderExtensions.UseMicrosoftOpenTelemetry(IOpenTelemetryBuilder builder, Action`1 configure)
   at Azure.AI.AgentServer.Core.Internal.OpenTelemetryExtensions.AddAgentHostTelemetry(IServiceCollection services, Action`1 configureTracing)
   at Azure.AI.AgentServer.Core.AgentHostBuilder.Build()

Package Versions

Microsoft.Agents.AI.Foundry.Hosting: 1.28.0-preview.261106.1 (also reproduced on 1.20.0-preview.260831.1), Microsoft.Agents.AI.Foundry: 1.28.0-preview.261106.1, Microsoft.Agents.AI: 1.28.0

.NET Version

.NET 10.0

Operating System

Linux

Regression

No

Additional Context

Upstream issue in Azure/azure-sdk-for-net: Azure/azure-sdk-for-net#65007

Because NuGet resolves the lowest compatible version in a dependency range, hosted-agent projects that reference Microsoft.Agents.AI.Foundry.Hosting without pinning Azure.AI.AgentServer.Core directly will continue resolving Azure.AI.AgentServer.Core 1.0.0-beta.30 -> Microsoft.OpenTelemetry 1.0.0-beta.1 even after Azure/azure-sdk-for-net publishes fixed betas.

Once Azure/azure-sdk-for-net#65007 ships updated Azure.AI.AgentServer.Core and Azure.AI.AgentServer.Responses betas, please update both versions in dotnet/Directory.Packages.props#L27-L29 (and Microsoft.Agents.AI.Foundry.Hosting.csproj#L34) and publish an updated Microsoft.Agents.AI.Foundry.Hosting preview.

Acknowledgements

  • I searched existing issues and did not find a duplicate.
  • I personally verified this behavior and the reproduction details are authentic.
  • I will wait for explicit maintainer agreement before starting implementation of a non-trivial change.

Activity

  1. added
    .NET
    on Nov 17, 2026
  2. added
    triage
    on Nov 17, 2026
  3. added
    foundry
    hosting
    needs-maintainer-triage
    on Nov 17, 2026
  4. github-actions commented on Nov 17, 2026

    @github-actions
    Contributor

    Routing result: inconclusive, not reproduced. I did not run a reproduction. It needs a Foundry hosted environment plus the external Azure.AI.AgentServer.Core and Microsoft.OpenTelemetry packages, and neither is available in this sandbox.

    Source check on the base checkout (f8ade3e): dotnet/Directory.Packages.props pins Azure.AI.AgentServer.Core 1.0.0-beta.30 and Azure.AI.AgentServer.Responses 1.0.0-beta.9, which matches the report. The failures described are in Azure.AI.AgentServer.Core and Microsoft.OpenTelemetry, so the cause appears to be external to this repo. The fix looks like it depends on the upstream Azure/azure-sdk-for-net release tracked in the linked issue.

    Support boundary: unclear. I found no maintained spec or decision record that sets how this package's telemetry dependencies are supported, so a maintainer should decide the scope.

    Routed to the Foundry Hosting owner for maintainer triage. This does not mean the report or its priority has been accepted. Run: https://github.com/microsoft/agent-framework/actions/runs/43984804425

    Generated by Issue Routing for #10398 · copilot · auto · ~18 AIC · ⌖ ~1 AIC · ⊞ 5.2K · ◷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

.NETfoundryhostingneeds-maintainer-triagetriage

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions