[http-client-csharp] Handling types that are both experimental and obsolete, including omitting unused types
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- csharp
调研方向
Start with the C# generator changes in Azure/azure-sdk-for-net#64227 and inspect how it emits [Obsolete] and [Experimental] attributes, then trace model reachability and type suppression customization. The issue asks for a safe policy covering backward compatibility, retained SDK references, serialization, custom code, and generated suppressions. Done means proposing and implementing a policy or opt-in mechanism that handles these cases without breaking generated or custom code.
由索引模型根据 Issue 内容生成。
描述
Context
While updating the C# generator in Azure/azure-sdk-for-net#64227 to @typespec/http-client-csharp 1.0.0-alpha.20261026.4, regeneration added [Obsolete] to three types that already have [Experimental("AAIP001")]:
Azure.AI.Extensions.OpenAI.BrowserAutomationPreviewToolAzure.AI.Projects.Agents.BrowserAutomationPreviewToolboxToolAzure.AI.Projects.Agents.WorkflowAgentDefinition
This produces obsolete diagnostics at existing use sites. It also exposes a compiler interaction: adding [Obsolete] to an experimental type causes references inside that type to other experimental APIs to start reporting their diagnostics. For example, BrowserAutomationPreviewTool derives from OpenAI's experimental ResponseTool, so both generated and custom partial declarations start reporting OPENAI001.
Minimal reproduction
Verified with .NET SDK 10.0.401:
using System;
using System.Diagnostics.CodeAnalysis;
[Experimental("OPENAI001")]
public class ExperimentalBase { }
[Experimental("AAIP001")]
[Obsolete("Legacy")]
public class Derived : ExperimentalBase { }
The base-class reference reports OPENAI001. Removing only [Obsolete("Legacy")] makes the example compile without diagnostics.
Desired direction / questions
What should the generator's policy be for types that are both experimental and deprecated?
Ideally, we would not generate the type when it is not required for backward compatibility and is not otherwise used. Could we consider:
- Omitting these types when the configured backward-compatibility baseline does not require them and no retained SDK surface depends on them, or providing an explicit opt-in policy for this behavior.
- Defining the reachability rules carefully: client signatures, other models, polymorphic serialization/deserialization, and custom code may still require a type. Generator-created model factories or model-reader/writer context registrations should not accidentally make an otherwise unused type impossible to omit.
- Providing a supported per-type exclusion customization when automatic omission cannot be determined safely. The current C#
CodeGenSuppressattribute suppresses members, not top-level types. - When the type must remain, generating the necessary narrowly scoped suppressions for experimental dependencies so that adding
[Obsolete]does not break generated code. Custom-code references may still need explicit acknowledgement.
The types above are examples of the attribute interaction, not a claim that they can all be removed as-is: there are existing custom dispatch, telemetry, test, and sample references that must be accounted for. The goal is to discuss a safe policy and customization mechanism rather than dropping every deprecated experimental type unconditionally.
- 主要语言
- Java
- 星标
- 5.9k
- 派生
- 421
- 平均合并
- 2 天 3 小时
- 30 天内合并 PR
- 176
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/typespec 的其他 Issue
-
bug emitter:client:csharp
难度 2/5 1-3 小时 新手友好度 84/100
microsoft/typespec#12572 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Make website build cross-platform compatible可能已有人在做 @pcbeingused333 今天认领。 未关闭bug meta:website
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/typespec#12550 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Emitter framework: make the language-specific Alloy peer dependencies optional可能已有人在做 @timotheeguerin 于 8 天前认领。 未关闭emitter-framework feature triaged:core
难度 1/5 1 小时以内 新手友好度 62/100
microsoft/typespec#12476 · 1 条评论 · 2 个 reaction · 已指派 2 人 ·
维护者通常 1 天内回复
-
Upgrade C# generator Roslyn to 5.9.0可能已有人在做 @ArthurMa1978 于 7 天前认领。 未关闭emitter:client:csharp feature
难度 2/5 1-3 小时 新手友好度 72/100
microsoft/typespec#12445 · 2 条评论 · 1 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
-
bug emitter:client:python
难度 2/5 1-3 小时 新手友好度 75/100
microsoft/typespec#12360 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
查看 microsoft/typespec 的全部 Issue
相似的 Issue
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)未关闭
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configuration可能已有人在做 @amalsaidov 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
needs-area-label
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
area/ai area/backend component/zeebe kind/task
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
spAnser/reacharound#38 ·