Remove temporary memory-safety LangVersion=preview overrides when no longer required
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 46/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- csharp
- 领域
- build-system
调研方向
Start by reading the four listed project files and the linked migrations #13070 and #13078 to understand which LangVersion=preview and memory-safety settings they introduced. Check the repository’s normal language-version policy and confirm C# 16 is the default before changing anything. Done means applicable temporary overrides are removed, unrelated compiler switches and safe-caller rejection remain intact, and the affected tests pass.
由索引模型根据 Issue 内容生成。
描述
Android framework version
Other — repository build configuration; not a customer application framework issue.
Affected platform version
The repository SDK/compiler once its normal language-version policy supports the migrated memory-safety syntax without preview. A .NET SDK major-version bump alone does not establish that support.
Description
Remove the temporary <LangVersion>preview</LangVersion> overrides introduced for the updated C# memory-safety model as soon as the repository compiler supports the affected code under the normal language-version policy.
Requested by @jonathanpeppers in this review comment. Related migrations: #13070, #13078, and the replacement tooling layer #13189.
Known places to revisit, as of 2026-10-29:
external/Java.Interop/src/Java.Interop/Java.Interop.csprojsrc/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csprojsrc/Microsoft.Android.Build.Tasks/Microsoft.Android.Build.Tasks.csproj
This is an illustrative, non-exhaustive list, not a limit on the cleanup's scope. Project locations and overrides may change before this work is done. Search the entire repository for applicable temporary preview overrides, including ones added by later migrations, and assess each against the compiler then in use. The earlier override in tools/tmt/tmt.csproj is no longer needed after removal of its linked encoding helper and is removed by the rebased #13189.
When the prerequisite is met, remove the overrides that are no longer needed and inherit the repository's normal language-version policy. Do not replace them with another permanent project-local language-version pin.
Completion criteria:
- The repository compiler accepts the affected syntax without
LangVersion=preview; do not assume that a particular SDK major version or a future numbered C# version is sufficient. - All applicable temporary overrides are audited, not just the projects listed above. Remove those no longer required while preserving unrelated compiler feature switches.
- Reassess
updated-memory-safety-rulesseparately: removingLangVersion=previewmust not accidentally disable the memory-safety model. - Affected projects and relevant existing tests pass, and safe-caller rejection of caller-unsafe APIs is preserved.
Steps to Reproduce
Inspect the project-local LangVersion=preview declarations added by the linked migrations. With repository SDK 12.0.100-alpha.1.26523.103, removing the override from either tooling project leaves LangVersion=latest and produces CS8652: “The feature 'updated memory safety rules' is currently in Preview … use the 'preview' language version.”
The same compiler lists numbered language versions only through C# 15 and rejects LangVersion=16 with CS1617. These observations explain why the overrides are needed today; they are not permanent restrictions on when cleanup may happen.
Did you find any workaround?
Keep the preview overrides until the compiler prerequisite is satisfied.
Relevant log output
CS8652: updated memory safety rules require the preview language version.
CS1617: invalid option '16' for /langversion in the compiler shipped with the SDK above.
- 主要语言
- C#
- 星标
- 2.1k
- 派生
- 579
- 平均合并
- 1 天 16 小时
- 30 天内合并 PR
- 255
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotnet/android 的其他 Issue
-
Area: App+Library Build
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
Area: Mono.Android
难度 2/5 1-3 小时 新手友好度 65/100
dotnet/android#9192 · 4 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Area: Mono.Bindings needs-triage
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
needs-triage
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
agentic-workflows needs-triage
难度 3/5 1-2 天 新手友好度 45/100
dotnet/android#13325 · 1 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 3 天内回复
-
enhancement P3 performance
难度 2/5 1-3 小时 新手友好度 75/100
thomhurst/TUnit#7380 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
-
documentation trivial
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
PCL-Community/PCL-CE#3767 ·
维护者通常 1 天内回复