Adding a C# library can silently restrict its reference to Debug builds
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- build-system, cli
Hướng nghiên cứu
Start in lean/commands/library/add.py and inspect _add_csharp_project_to_csproj and _add_csharp_package_to_csproj, which the issue identifies as sharing the conditional last-ItemGroup behavior. Trace their existing tests and add regression coverage for a project whose last or only ItemGroup is conditional. Done means both added references are available in Debug and Release builds.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Adding a C# library can silently make its reference available only in Debug builds. The reference is appended to the last ItemGroup, even when that group has a configuration condition. The command succeeds and records the library in config.json, but Release builds cannot use it.
The reference-writing helper has this behavior on master at 51a654f.
Reproduction
-
In an initialized Lean CLI workspace, have a C# project
Appand C# libraryLibrary/Lib. A minimalApp/App.csprojis:<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net10.0</TargetFramework> </PropertyGroup> <ItemGroup Condition="'$(Configuration)' == 'Debug'" /> </Project> -
Define
ExampleLibrary.UsefulTypein the library and use that type in the application. -
Run
lean library add App Library/Lib --no-local.
The command exits successfully but inserts this reference inside the Debug-only group:
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<ProjectReference Include="../Library/Lib/Lib.csproj" />
</ItemGroup>
dotnet build App/App.csproj -c Debugsucceeds;dotnet build App/App.csproj -c Releasefails withCS0246forExampleLibrary.
Verified through the library command and actual Debug/Release builds, and independently with _add_csharp_project_to_csproj loaded from the base commit above. _add_csharp_package_to_csproj in lean/commands/library/add.py uses the same last-group selection; directly adding a package also puts its PackageReference into the conditional group.
Expected result
Adding a library or package without a configuration restriction should make the new reference available in every build configuration. Regression tests should cover a project whose last or only ItemGroup is conditional.
Suggestion: share the group-selection/insertion logic between project and package references, selecting or creating an unconditional group rather than inheriting an unrelated group's condition.
Impact is limited to customized project files with conditional groups. Moving the new reference to an unconditional group is a workaround.
- Ngôn ngữ chính
- Python
- Star
- 335
- Fork
- 172
- Merge trung bình
- 6 giờ 54 phút
- Pull request đã merge (30 ngày)
- 37
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của QuantConnect/lean-cli
-
priority:P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
QuantConnect/lean-cli#792 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority:P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
QuantConnect/lean-cli#786 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority:P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
QuantConnect/lean-cli#785 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A partially written live command result aborts polling with JSONDecodeErrorCó thể đã có người làm @pcbeingused333 đã nhận 3 ngày trước. Đang mởpriority:P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
QuantConnect/lean-cli#784 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Container lookup failures during result polling are masked by UnboundLocalErrorCó thể đã có người làm @pcbeingused333 đã nhận 5 ngày trước. Đang mởpriority:P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
QuantConnect/lean-cli#783 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của QuantConnect/lean-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pimutils/vdirsyncer#1242 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
open-webui/open-webui#35360 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày