Skip to content

Conversation

@joesdu
Copy link
Owner

@joesdu joesdu commented Feb 11, 2026

📝 描述 (Description)

新增 PropertyGroup,设置 EnablePreviewFeatures 为 true,并在 Features 属性中启用 runtime-async=on,以便项目可使用 .NET 预览版中的异步运行时相关新特性。

🔗 相关问题 (Related Issues)

  • Closes #
  • Fixes #

🏷️ 变更类型 (Type of Change)

  • 🐛 错误修复 (Bug fix) (non-breaking change which fixes an issue)
  • ✨ 新功能 (New feature) (non-breaking change which adds functionality)
  • 💥 破坏性变更 (Breaking change) (fix or feature that would cause existing functionality to not work as expected)
  • 📚 文档更新 (Documentation update)
  • 🔧 重构 (Refactor) (no functional changes)
  • 🧪 测试 (Tests) (adding or updating tests)
  • 🛠️ 构建/CI 变更 (Build/CI changes)
  • 🎨 样式变更 (Style changes) (formatting, etc.)
  • 🚀 性能改进 (Performance improvements)
  • 🔒 安全改进 (Security improvements)

✅ 检查清单 (Checklist)

  • 我的代码遵循项目的编码标准 (My code follows the project's coding standards)
  • 我已经对自己的代码进行了自我审查 (I have performed a self-review of my own code)
  • 我已经在难以理解的区域注释了我的代码 (I have commented my code, particularly in hard-to-understand areas)
  • 我已经对文档进行了相应的更改 (I have made corresponding changes to the documentation)
  • 我的更改不会产生新的警告或错误 (My changes generate no new warnings or errors)
  • 我已经添加了证明我的修复有效或我的功能工作的测试 (I have added tests that prove my fix is effective or that my feature works)
  • 新增和现有的单元测试在本地通过我的更改 (New and existing unit tests pass locally with my changes)
  • 任何依赖变更都已合并并发布到下游模块 (Any dependent changes have been merged and published in downstream modules)

🧪 测试 (Testing)

  • 单元测试 (Unit tests)
  • 集成测试 (Integration tests)
  • 手动测试 (Manual testing)
  • 其他 (请指定) (Other (please specify)):

📸 截图 (如果适用) (Screenshots (if applicable))

🔍 附加说明 (Additional Notes)

新增 PropertyGroup,设置 EnablePreviewFeatures 为 true,并在 Features 属性中启用 runtime-async=on,以便项目可使用 .NET 预览版中的异步运行时相关新特性。
Copilot AI review requested due to automatic review settings February 11, 2026 08:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Summary / 总结:

This PR adds preview features configuration to the root Directory.Build.props file by setting EnablePreviewFeatures=true and enabling runtime-async=on feature flag. While the intent aligns with the project's stated use of preview features, the implementation has a critical issue: enabling preview features in library projects that produce NuGet packages will cause NETSDK1138 warnings for all package consumers.

该 PR 在根级 Directory.Build.props 文件中添加预览特性配置,设置 EnablePreviewFeatures=true 并启用 runtime-async=on 功能标志。虽然意图与项目声明使用预览特性相符,但实现存在关键问题:在生成 NuGet 包的库项目中启用预览特性会导致所有包使用者收到 NETSDK1138 警告。

Changes / 变更:

  • Added EnablePreviewFeatures=true to enable .NET preview runtime/BCL APIs
  • Added Features=$(Features);runtime-async=on to enable async runtime optimizations

Key Issues / 主要问题:

  • Setting EnablePreviewFeatures=true in library projects causes NETSDK1138 warnings for NuGet package consumers
  • The project already has LangVersion=preview which provides access to preview C# language features without the consumer-facing warnings
  • No documentation updates explain the impact on package consumers or the rationale for requiring preview runtime APIs

建议 / Suggested Changes:

  • Determine if preview runtime/BCL APIs (marked with [RequiresPreviewFeatures]) are actually needed
  • If only preview C# language features are needed, remove EnablePreviewFeatures=true (keep LangVersion=preview)
  • If preview runtime APIs are essential, add clear documentation and consider SuppressNETCoreSdkPreviewMessage=true
  • The runtime-async=on feature can be kept independently

在 Directory.Build.props 中新增 NoWarn 配置,屏蔽 CA2252 和 SYSLIB5007 警告,避免因启用预览特性和相关 API 导致的编译警告。
@joesdu joesdu merged commit 1916c51 into main Feb 11, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant