`directives.version` is checked against dsc-lib's crate version (3.2.0), not the running dsc version
维护者通常 1 天内回复
评估
调研方向
从 lib/dsc-lib/src/configure/mod.rs 的 L1299-L1301 (validate_config) 附近开始,那里解析了 env!("CARGO_PKG_VERSION"),并与 L1253-L1257 处使用 self.context.dsc_version 的元数据代码进行比较——修复方式是让指令检查使用正在运行的 dsc 版本,而不是 crate 版本。然后扩展 dsc/tests/dsc_version.tests.ps1,其现有用例 (=999.0.0, >=3.1) 无论哪种方式都会通过,添加一个能区分 3.2.0 与运行中版本的用例(例如固定 '=')。完成标准是固定运行中版本成功,而在较新的 dsc 上固定 3.2.0 失败,并通过运行 Pester 测试进行验证。
由索引模型根据 Issue 内容生成。
描述
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Summary
directives.version always compares against 3.2.0, whatever dsc build is running. On dsc 3.3.0, pinning '=3.3.0' fails and pinning '=3.2.0' passes. 3.4.0-preview.1 behaves the same way.
In practice you can't require anything newer than 3.2.0 with the directive, and an upper bound such as '<3.3.0' is accepted by 3.3.0 and 3.4.0-preview.1.
The check in validate_config parses env!("CARGO_PKG_VERSION"), and inside dsc-lib that resolves to dsc-lib's own version (mod.rs L1299-L1301 at v3.3.0). lib/dsc-lib/Cargo.toml is still 3.2.0 on main, while dsc/Cargo.toml is 3.4.0-preview.1. The metadata code in the same file uses self.context.dsc_version (L1253-L1257), so the directive check could probably use that as well. The existing tests in dsc/tests/dsc_version.tests.ps1 use =999.0.0 and >=3.1, and both give the same result with 3.2.0 or 3.3.0, so they don't catch this.
Steps to reproduce
-
Save this as
repro.dsc.config.yaml:$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json directives: version: '=3.3.0' resources: - name: os type: Microsoft/OSInfo properties: {} -
Run it with dsc 3.3.0:
dsc --version dsc config test --file ./repro.dsc.config.yaml -
Change the directive to
'=3.2.0'and rundsc config testagain.
Expected behavior
PS> dsc --version
dsc 3.3.0
# version: '=3.3.0'
exit code 0, test results for the OSInfo instance
# version: '=3.2.0'
ERROR Error: Validation: Configuration requires DSC version '=3.2.0', but the current version is '3.3.0'
exit code 2
Actual behavior
PS> dsc --version
dsc 3.3.0
# version: '=3.3.0'
ERROR Error: Validation: Configuration requires DSC version '=3.3.0', but the current version is '3.2.0'
exit code 2
# version: '=3.2.0'
exit code 0, and the output reports executionInformation.version: 3.3.0
Same document, other requirements:
directives.version |
dsc 3.3.0 | dsc 3.4.0-preview.1 |
|---|---|---|
=<running version> |
exit 2 | exit 2 |
=3.2.0 |
exit 0 | exit 0 |
<3.3.0 |
exit 0 | exit 0 |
>=3.3.0 |
exit 2 | not run |
Error details
2026-10-04T10:25:47.660394Z ERROR Error: Validation: Configuration requires DSC version '=3.3.0', but the current version is '3.2.0'
Environment data
Name Value
---- -----
PSVersion 5.1.26100.9444
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.26100.9444
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Windows 11 Pro for Workstations 25H2, build 26200. dsc 3.3.0 installed from the release msixbundle; 3.4.0-preview.1 run from the release zip.
Version
3.3.0 (also reproduced on 3.4.0-preview.1)
Visuals
No response
- 主要语言
- Rust
- 星标
- 532
- 派生
- 76
- 平均合并
- 2 天 28 分钟
- 30 天内合并 PR
- 17
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PowerShell/DSC 的其他 Issue
-
Issue-Enhancement Needs Triage
难度 5/5 一周以上 新手友好度 35/100
PowerShell/DSC#1737 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
PowerShell/DSC#1736 ·
维护者通常 1 天内回复
-
Make it impossible to accidentally define a nonfunctional secret extension可能已有人在做 @Gijsreyn 今天认领。 未关闭Issue-Enhancement
难度 5/5 一周以上 新手友好度 38/100
PowerShell/DSC#1729 · 1 条评论 ·
维护者通常 1 天内回复
-
Feature Request: Support dsc functions in executable args可能已有人在做 @SteveL-MSFT 于 13 天前认领。 未关闭Issue-Enhancement
难度 4/5 3-5 天 新手友好度 62/100
PowerShell/DSC#1722 · 4 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Dev-UX Needs Triage
难度 5/5 一周以上 新手友好度 35/100
PowerShell/DSC#1694 ·
维护者通常 1 天内回复
相似的 Issue
-
documentation enhancement
难度 2/5 1-3 小时 新手友好度 62/100
adorsys/status-list-server#619 ·
维护者通常 2 天内回复
-
batch-backport only backports the first 30 matching PRs可能已有人在做 @DvirDukhan 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 5 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
equinor/septic-config-generator#481 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复