Adding the first C# library reference fails when the project has no ItemGroup
Maintainer antworten meist innerhalb von 1 Tag
@pcbeingused333 arbeitet bereits daran.
Seit 22.11.2026.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 74/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Bereich
- build-system, cli
Rechercherichtung
Start by reading LibraryManager._add_csharp_project_to_csproj and _add_csharp_package_to_csproj in lean/commands/library/add.py, then find the existing tests for C# library and NuGet insertion. Reproduce with a valid SDK style .csproj containing no ItemGroup and run the relevant tests. Done means both insertion paths create the first ItemGroup on the project root and the regression case passes.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Problem
Adding a Lean C# library fails when the consuming .csproj has no ItemGroup. The library is nevertheless recorded in config.json, so repeating the command reports that it is already added while the .csproj still has no ProjectReference.
Reproduced on master at 3842533.
Reproduction
-
In an initialized Lean CLI directory, have C# projects
AppandLibrary/Lib. -
Give
App/App.csprojthis valid SDK-style content:<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net10.0</TargetFramework> </PropertyGroup> </Project> -
Run
lean library add App Library/Lib --no-local.
Observed: exit 1 with Argument '_parent' has incorrect type (expected lxml.etree._Element, got NoneType).
- Run the same command again.
Observed: exit 0 and Library Lib has already been added to the project App, but App.csproj still has no ProjectReference.
Cause and expected result
LibraryManager._add_csharp_project_to_csproj tries to create the first ItemGroup beneath csproj_tree.find(".//Project"). The parsed tree is already the Project element, so that descendant lookup returns None. _add_csharp_package_to_csproj in lean/commands/library/add.py contains the same insertion pattern.
Adding the first library reference should create the necessary ItemGroup on the project root and succeed for a valid project without one. Add regression coverage for this minimal .csproj case. Suggestion: reuse the correct root-insertion handling for both C# library-reference and NuGet-package insertion.
Impact is limited to projects without an existing ItemGroup; retaining an empty <ItemGroup /> before the first add avoids the crash.
- Vorherrschende Sprache
- Python
- Sterne
- 335
- Forks
- 172
- Ø Merge
- 6 Std. 54 Min.
- Gemergte PRs (30 T.)
- 37
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus QuantConnect/lean-cli
-
priority:P2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
QuantConnect/lean-cli#792 ·
Maintainer antworten meist innerhalb von 1 Tag
-
priority:P2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
QuantConnect/lean-cli#786 ·
Maintainer antworten meist innerhalb von 1 Tag
-
priority:P2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
QuantConnect/lean-cli#785 ·
Maintainer antworten meist innerhalb von 1 Tag
-
A partially written live command result aborts polling with JSONDecodeErrorEvtl. vergeben @pcbeingused333 hat das vor 3 Tagen übernommen. Offenpriority:P2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
QuantConnect/lean-cli#784 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Container lookup failures during result polling are masked by UnboundLocalErrorEvtl. vergeben @pcbeingused333 hat das vor 5 Tagen übernommen. Offenpriority:P2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
QuantConnect/lean-cli#783 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in QuantConnect/lean-cli
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
Maintainer antworten meist innerhalb von 4 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
pimutils/vdirsyncer#1242 ·
-
backlog
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
sagemathinc/sagebrush#2768 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
vllm-project/vllm-ascend#23791 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
briandconnelly/context-audit#33 ·
Maintainer antworten meist innerhalb von 1 Tag