Skip to main content

Fixed: "System.MissingMethodException: Method not found: … OpenAI.Responses.ResponsesClient.CreateResponseStreamingAsync" with Microsoft Agent Framework

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

My Microsoft Agent Framework agent built without a warning, started, and then failed on every question with System.MissingMethodException: Method not found in CreateResponseStreamingAsync. The cause was one extra line in my project file: I had added the newest OpenAI package myself, and Agent Framework was built against the version before it.

What I Was Doing​

I was building the weather forecast agent of the Microsoft 365 Agents SDK course on Microsoft Agent Framework 1.28.0. My code creates an OpenAIClient itself, to sign in to Microsoft Foundry with Microsoft Entra ID, so I added the OpenAI package directly, at its newest version, alongside Agent Framework:

Terminal
dotnet add package Microsoft.Agents.Hosting.AspNetCore --version 1.9.205
dotnet add package Microsoft.Agents.AI.OpenAI --version 1.28.0
dotnet add package OpenAI --version 2.15.0
dotnet add package Azure.Identity --version 1.21.0

The agent streams its answers: it calls Agent Framework's RunStreamingAsync and forwards each piece to the chat.

What I Expected​

The project built and the agent started, so I expected an answer when I asked What will the weather be like in London tomorrow? in the Microsoft 365 Agents Playground.

What I Got​

After a few seconds of Working on it..., the agent replied with the error message my code sends when something fails:

The Agents Playground conversation: the weather agent's welcome, the question "What will the weather be like in London tomorrow?", and the agent's reply "Sorry, I couldn't get the forecast. Please try again."

The agent's log had the real exception:

Output (the agent's console, first lines)
fail: WeatherAgent.WeatherForecastAgent[0]
The weather agent failed to answer.
System.MissingMethodException: Method not found: 'System.ClientModel.AsyncCollectionResult`1<OpenAI.Responses.StreamingResponseUpdate> OpenAI.Responses.ResponsesClient.CreateResponseStreamingAsync(OpenAI.Responses.CreateResponseOptions, System.Threading.CancellationToken)'.
at Microsoft.Extensions.AI.OpenAIResponsesChatClient.GetStreamingResponseAsync(IEnumerable`1 messages, ChatOptions options, CancellationToken cancellationToken)
at Microsoft.Extensions.AI.DelegatingChatClient.GetStreamingResponseAsync(IEnumerable`1 messages, ChatOptions options, CancellationToken cancellationToken)
at Microsoft.Agents.AI.OpenAI.FeatureUsageChatClient.<>n__0(IEnumerable`1 messages, ChatOptions options, CancellationToken cancellationToken)
at Microsoft.Agents.AI.OpenAI.FeatureUsageChatClient.GetStreamingResponseAsync(IEnumerable`1 messages, ChatOptions options, CancellationToken cancellationToken)+MoveNext()

The trace continues through Agent Framework's ChatClientAgent.RunStreamingAsync down to my OnMessageAsync.

macOS-style terminal window with the agent's log: fail from WeatherForecastAgent, The weather agent failed to answer, System.MissingMethodException: Method not found: AsyncCollectionResult of StreamingResponseUpdate OpenAI.Responses.ResponsesClient.CreateResponseStreamingAsync, thrown from Microsoft.Extensions.AI.OpenAIResponsesChatClient.GetStreamingResponseAsync

What I Checked​

Who called the missing method. The top frame isn't my code or Agent Framework's: it's Microsoft.Extensions.AI.OpenAIResponsesChatClient, the adapter that connects the OpenAI library to Microsoft's AI abstractions. It asked ResponsesClient for a CreateResponseStreamingAsync that returns AsyncCollectionResult<StreamingResponseUpdate>, and the ResponsesClient in my app didn't have one.

Which versions the app actually used. dotnet list package --include-transitive lists every package, including the ones other packages pulled in:

Output (relevant lines)
Top-level Package Requested Resolved
> Microsoft.Agents.AI.OpenAI 1.28.0 1.28.0
> OpenAI 2.15.0 2.15.0
Transitive Package Resolved
> Microsoft.Extensions.AI.OpenAI 10.11.0

What those packages were built for. On NuGet, Microsoft.Agents.AI.OpenAI 1.28.0 depends on Microsoft.Extensions.AI.OpenAI 10.11.0 and on OpenAI 2.14.0, and Microsoft.Extensions.AI.OpenAI 10.11.0 depends on OpenAI 2.14.0 too. So the adapter was compiled against 2.14.0, and my own reference had raised it to 2.15.0.

What changed in 2.15.0. The OpenAI .NET library's changelog for 2.15.0 has a section called Breaking Changes in Experimental APIs. For OpenAI.Responses it says: The experimental streaming methods are now async-only and return Task<AsyncStreamingResult<T>> instead of AsyncCollectionResult<T>. That's exactly the method from the error, with a new return type.

Whether a newer adapter would help. Microsoft.Extensions.AI.OpenAI 11.0.0, the newest version, still depends on OpenAI 2.14.0, so at the time of writing no version of the adapter works with 2.15.0.

Why It Happens​

.NET finds a method by its full signature, including its return type. Microsoft.Extensions.AI.OpenAI was compiled to call the 2.14.0 signature. When NuGet resolved OpenAI to 2.15.0 because my project asked for it, the old signature no longer existed, and the runtime only discovered that when the method was first called, during the first streamed answer. Nothing in my own code used the method, so the build had no reason to fail.

A minor version could break it because the method is experimental: the OpenAI library reserves the right to change experimental APIs at any time, and it lists those changes separately in its changelog.

The Fix​

Remove your own reference to the OpenAI package and let Agent Framework bring the version it was built for:

Terminal
dotnet remove package OpenAI
Output
info : Removing PackageReference for package 'OpenAI' from project '/Users/you/source/WeatherAgent/WeatherAgent.csproj'.

Your code can still use OpenAIClient and ResponsesClient: the package is still there, as a dependency of Microsoft.Agents.AI.OpenAI.

After the Fix​

The package list now shows OpenAI 2.14.0, arriving through Agent Framework:

Output (relevant lines)
Top-level Package Requested Resolved
> Microsoft.Agents.AI.OpenAI 1.28.0 1.28.0
Transitive Package Resolved
> Microsoft.Extensions.AI.OpenAI 10.11.0
> OpenAI 2.14.0

I rebuilt, restarted the agent and asked again. The answer streamed in:

The Agents Playground conversation after the fix: the question "What's the forecast for Paris tomorrow?" and the weather agent's answer "Tomorrow in Paris, the temperature is forecast to be around 5°C (40°F)."

Common Mistakes​

MistakeWhat happensDo this instead
Adding the newest version of every dependency directlyYou override the versions your frameworks were built and tested withReference what your code needs, and let frameworks bring their own dependencies
Trusting a clean buildBinary mismatches only fail at runtime, when the method is first calledTest the feature that uses the library, not just the build
Upgrading Microsoft.Extensions.AI.OpenAI to fix itVersion 11.0.0 still targets OpenAI 2.14.0Remove the direct OpenAI reference

Troubleshooting​

SymptomLikely causeFix
MissingMethodException with another OpenAI methodThe same kind of version mismatchCompare dotnet list package --include-transitive with the framework's dependencies on NuGet
NU1605 Detected package downgrade after removing the referenceAnother package still asks for 2.15.0Find it with dotnet list package --include-transitive and remove or align it
The error appears only with streamingOnly the streaming method changedThe same fix

FAQ​

Can't I just use the newest OpenAI package?​

Not with Agent Framework 1.28.0. Wait until a version of Agent Framework or Microsoft.Extensions.AI.OpenAI depends on a newer OpenAI package, then upgrade through it.

Why didn't NuGet warn me?​

Raising a dependency to a newer version is normal, and NuGet allows it. It can't know that a minor version changed an experimental API that another package calls.

Would non-streaming calls have worked?​

The changelog entry is about the streaming methods, which is the one this agent uses. I didn't test non-streaming calls with 2.15.0.

Conclusion​

MissingMethodException: Method not found: … ResponsesClient.CreateResponseStreamingAsync means your app has a newer OpenAI package than the Microsoft AI libraries were built for. Remove your direct OpenAI reference, let Microsoft.Agents.AI.OpenAI bring the version it supports, and upgrade only when it does.

Additional Resources​