.NET: Annotate all public methods of OpenAIAssistantClientExtensions with Obsolete attribute - #2640
Merged
Merged
Conversation
…Extensions Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Annotate OpenAIAssistantClientExtensions methods as obsolete
Annotate all public methods of OpenAIAssistantClientExtensions with Obsolete attribute
Dec 4, 2025
Contributor
|
Copilot fix the build |
…sistants API Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
Contributor
Author
SergeyMenshykh
temporarily deployed
to
integration
December 4, 2025 20:59 — with
GitHub Actions
Inactive
SergeyMenshykh
temporarily deployed
to
integration
December 4, 2025 20:59 — with
GitHub Actions
Inactive
61 tasks
SergeyMenshykh
marked this pull request as ready for review
December 4, 2025 21:15
Contributor
There was a problem hiding this comment.
Pull request overview
This PR marks all 12 public extension methods in OpenAIAssistantClientExtensions as obsolete with the [Obsolete] attribute to guide users away from the deprecated OpenAI Assistants API. The changes also suppress obsolete warnings in existing test files and sample code that continue to use these methods.
Key Changes:
- Added
[Obsolete]attributes to all 12 public methods (6GetAIAgent, 2GetAIAgentAsync, 2CreateAIAgent, and 2CreateAIAgentAsyncoverloads) - Suppressed CS0618 warnings with
#pragma warning disablein test files and sample code that still reference these methods
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 12 comments.
| File | Description |
|---|---|
dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIAssistantClientExtensions.cs |
Added [Obsolete] attributes to all 12 public extension methods |
dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistantClientExtensionsTests.cs |
Added pragma directive to suppress obsolete warnings in integration tests |
dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIAssistantClientExtensionsTests.cs |
Added pragma directive to suppress obsolete warnings in unit tests |
dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Program.cs |
Added pragma directive to suppress obsolete warnings in sample code |
This was referenced Jan 9, 2026
This was referenced Jan 19, 2026
This was referenced Jan 28, 2026
Aris Nguyen (arisng)
pushed a commit
to arisng/agent-framework
that referenced
this pull request
Feb 2, 2026
…with Obsolete attribute (microsoft#2640) * Initial plan * Add Obsolete attribute to all public methods of OpenAIAssistantClientExtensions Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com> * Add pragma warning disable CS0618 to files using deprecated OpenAI Assistants API Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com> * Update Obsolete attribute message to use requested text Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: SergeyMenshykh <68852919+SergeyMenshykh@users.noreply.github.com>
This was referenced Mar 2, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
The OpenAI Assistants API has been deprecated by OpenAI in favor of the Responses API. All public extension methods in
OpenAIAssistantClientExtensionsshould be marked as obsolete to guide users toward the newer API.Description
Added
[Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")]to all 12 public methods:GetAIAgent(6 overloads)GetAIAgentAsync(2 overloads)CreateAIAgent(2 overloads)CreateAIAgentAsync(2 overloads)Also added
#pragma warning disable CS0618to the following files to suppress obsolete warnings when using/testing the deprecated methods:dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Program.cs- Sample code demonstrating the deprecated APIdotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistantClientExtensionsTests.cs- Integration tests for the deprecated extension methodsdotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIAssistantClientExtensionsTests.cs- Unit tests for the deprecated extension methodsContribution Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.