-
Notifications
You must be signed in to change notification settings - Fork 578
Remove obsolete APIs from codebase #985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
21
commits into
main
Choose a base branch
from
copilot/remove-obsolete-apis
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+663
−2,674
Open
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f636f4b
Initial plan
Copilot 701597c
Remove internal usages of obsolete capability properties
Copilot d826cd3
Remove all obsolete API definitions and related tests
Copilot cd8f7ae
Merge main branch and resolve conflicts
Copilot 3d20111
Merge remote-tracking branch 'origin/main' into copilot/remove-obsole…
Copilot eb31afb
Remove unused duplicate CreateSamplingHandler and helper methods from…
Copilot c7deb7f
Delete empty McpEndpointExtensions and McpServerExtensions classes
Copilot 4d6fe0a
Remove obsolete IMcpEndpoint, IMcpClient, IMcpServer interfaces and M…
Copilot 2decb2d
Remove extra newlines before closing braces in capability classes
Copilot 4443cfc
Merge main branch and resolve conflicts (PR #976 integration)
Copilot 44083aa
Revert "Merge main branch and resolve conflicts (PR #976 integration)"
MackinnonBuck cd9ce13
Merge remote-tracking branch 'origin/main' into copilot/remove-obsole…
MackinnonBuck 93a6877
Remove remaining obsolete EnumSchema and LegacyTitledEnumSchema types…
Copilot 186d85c
Restore EnumSchemaTests.cs and add back valid enum schema tests witho…
Copilot 04e1326
Revert: "Remove remaining obsolete EnumSchema and LegacyTitledEnumSch…
jeffhandley 40df946
Merge branch 'main' into copilot/remove-obsolete-apis
jeffhandley 3c29253
Introduce Obsoletions/Experimentals pattern for custom diagnostics.
jeffhandley 6fcf81c
Fix failing enum schema tests
jeffhandley 981386e
Merge branch 'main' into copilot/remove-obsolete-apis
jeffhandley 95708d6
Revise diagnostic ID ranges for analyzers, obsoletions, experimentals
jeffhandley 7e074f8
Fix XML comment reference to RegisterNotificationHandler
jeffhandley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace ModelContextProtocol; | ||
|
|
||
| /// <summary> | ||
| /// Defines diagnostic IDs, Messages, and Urls for APIs annotated with <see cref="ExperimentalAttribute"/>. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// When an experimental API is associated with an experimental specification, the message | ||
| /// should refer to the specification version that introduces the feature and the SEP | ||
| /// when available. If there is a SEP associated with the experimental API, the Url should | ||
| /// point to the SEP issue. | ||
| /// <para> | ||
| /// Diagnostic IDs cannot be reused when experimental API are removed or promoted to stable. | ||
| /// This ensures that users do not suppress warnings for new diagnostics with existing | ||
| /// suppressions that might be left in place from prior uses of the same diagnostic ID. | ||
| /// </para> | ||
| /// </remarks> | ||
| internal static class Experimentals | ||
| { | ||
| // public const string Tasks_DiagnosticId = "MCP50001"; | ||
| // public const string Tasks_Message = "The Tasks feature is experimental within specification version 2025-11-25 and is subject to change. See SEP-1686 for more information."; | ||
| // public const string Tasks_Url = "https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1686"; | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| namespace ModelContextProtocol; | ||
|
|
||
| /// <summary> | ||
| /// Defines diagnostic IDs, Messages, and Urls for APIs annotated with <see cref="ObsoleteAttribute"/>. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// When a deprecated API is associated with an specification change, the message | ||
| /// should refer to the specification version that introduces the change and the SEP | ||
| /// when available. If there is a SEP associated with the experimental API, the Url should | ||
| /// point to the SEP issue. | ||
| /// <para> | ||
| /// Diagnostic IDs cannot be reused when obsolete APIs are removed or restored. | ||
| /// This ensures that users do not suppress warnings for new diagnostics with existing | ||
| /// suppressions that might be left in place from prior uses of the same diagnostic ID. | ||
| /// </para> | ||
| /// </remarks> | ||
| internal static class Obsoletions | ||
| { | ||
| public const string LegacyTitledEnumSchema_DiagnosticId = "MCP00001"; | ||
| public const string LegacyTitledEnumSchema_Message = "The EnumSchema and LegacyTitledEnumSchema APIs are deprecated as of specification version 2025-11-25 and will be removed in a future major version. See SEP-1330 for more information."; | ||
| public const string LegacyTitledEnumSchema_Url = "https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1330"; | ||
| } |
65 changes: 65 additions & 0 deletions
65
src/Common/Polyfills/System/Diagnostics/CodeAnalysis/ExperimentalAttribute.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| #if !NET | ||
| namespace System.Diagnostics.CodeAnalysis; | ||
|
|
||
| /// <summary> | ||
| /// Indicates that an API is experimental and it may change in the future. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This attribute allows call sites to be flagged with a diagnostic that indicates that an experimental | ||
| /// feature is used. Authors can use this attribute to ship preview features in their assemblies. | ||
| /// </remarks> | ||
| [AttributeUsage(AttributeTargets.Assembly | | ||
| AttributeTargets.Module | | ||
| AttributeTargets.Class | | ||
| AttributeTargets.Struct | | ||
| AttributeTargets.Enum | | ||
| AttributeTargets.Constructor | | ||
| AttributeTargets.Method | | ||
| AttributeTargets.Property | | ||
| AttributeTargets.Field | | ||
| AttributeTargets.Event | | ||
| AttributeTargets.Interface | | ||
| AttributeTargets.Delegate, Inherited = false)] | ||
| internal sealed class ExperimentalAttribute : Attribute | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ExperimentalAttribute"/> class, specifying the ID that the compiler will use | ||
| /// when reporting a use of the API the attribute applies to. | ||
| /// </summary> | ||
| /// <param name="diagnosticId">The ID that the compiler will use when reporting a use of the API the attribute applies to.</param> | ||
| public ExperimentalAttribute(string diagnosticId) | ||
| { | ||
| DiagnosticId = diagnosticId; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the ID that the compiler will use when reporting a use of the API the attribute applies to. | ||
| /// </summary> | ||
| /// <value>The unique diagnostic ID.</value> | ||
| /// <remarks> | ||
| /// The diagnostic ID is shown in build output for warnings and errors. | ||
| /// <para>This property represents the unique ID that can be used to suppress the warnings or errors, if needed.</para> | ||
| /// </remarks> | ||
| public string DiagnosticId { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets an optional message associated with the experimental attribute. | ||
| /// </summary> | ||
| /// <value>The message that provides additional information about the experimental feature.</value> | ||
| /// <remarks> | ||
| /// This message can be used to provide more context or guidance about the experimental feature. | ||
| /// </remarks> | ||
| public string? Message { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the URL for corresponding documentation. | ||
| /// The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID. | ||
| /// </summary> | ||
| /// <value>The format string that represents a URL to corresponding documentation.</value> | ||
| /// <remarks>An example format string is <c>https://contoso.com/obsoletion-warnings/{0}</c>.</remarks> | ||
| public string? UrlFormat { get; set; } | ||
| } | ||
| #endif |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| #if !NET | ||
| namespace System; | ||
|
|
||
| /// <summary> | ||
| /// Marks program elements that are no longer in use. | ||
| /// </summary> | ||
| [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | | ||
| AttributeTargets.Interface | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate, | ||
| Inherited = false)] | ||
| internal sealed class ObsoleteAttribute : Attribute | ||
| { | ||
| public ObsoleteAttribute() | ||
| { | ||
| } | ||
|
|
||
| public ObsoleteAttribute(string? message) | ||
| { | ||
| Message = message; | ||
| } | ||
|
|
||
| public ObsoleteAttribute(string? message, bool error) | ||
| { | ||
| Message = message; | ||
| IsError = error; | ||
| } | ||
|
|
||
| public string? Message { get; } | ||
|
|
||
| public bool IsError { get; } | ||
|
|
||
| public string? DiagnosticId { get; set; } | ||
|
|
||
| public string? UrlFormat { get; set; } | ||
| } | ||
| #endif |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.