Skip to content

.NET: [Bug]: Update OpenAI 2.9.1 to prevent MissingMethodException #4380

@rstropek

Description

@rstropek

Description

The following code sample compiles without problems, but shows the following error during runtime:

MissingMethodException (expected with OpenAI 2.9.0):
Method not found: 'System.String OpenAI.Responses.ResponsesClient.get_Model()'.

Works with GetChatClient.

Code Sample

using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
using OpenAI;
using OpenAI.Responses;

// Minimal repro for:
//   System.MissingMethodException: Method not found:
//   'System.String OpenAI.Responses.ResponsesClient.get_Model()'
//
// Guess: Microsoft.Extensions.AI.OpenAI 10.3.0 was compiled against a future version
// of the OpenAI SDK that exposes ResponsesClient.Model, but OpenAI 2.9.0 (the
// latest public release) does not have that property.
//
// Calling AsAIAgent() on the ResponsesClient triggers the bridge code inside
// OpenAIResponsesChatClient..ctor which calls responseClient.Model, causing the
// MissingMethodException at runtime even though the code compiles fine.

var responsesClient = new OpenAIClient("dummy-key").GetResponsesClient();

try
{
    // This throws MissingMethodException at runtime:
    AIAgent agent = responsesClient.AsAIAgent(
        instructions: "You are a helpful assistant.",
        name: "TestAgent");

    Console.WriteLine("No exception — packages are compatible.");
}
catch (MissingMethodException ex)
{
    Console.WriteLine("MissingMethodException (expected with OpenAI 2.9.0):");
    Console.WriteLine(ex.Message);
}

Error Messages / Stack Traces

MissingMethodException (expected with OpenAI 2.9.0):
Method not found: 'System.String OpenAI.Responses.ResponsesClient.get_Model()'.

Package Versions

Microsoft.Agents.AI.OpenAI: 1.0.0-rc2, OpenAI: 2.9.0, Microsoft.Extensions.AI.OpenAI: 10.3.0

.NET Version

.NET 10

Additional Context

No response

Metadata

Metadata

Assignees

Labels

.NETblocked externalThis label indicates whenever an issue or a PR cannot proceed due to an external dependencybugSomething isn't workingexternalThis issue is related to an external service / productv1.0Features being tracked for the version 1.0 GA

Type

Projects

Status

Planned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions