Adding the first C# library reference fails when the project has no ItemGroup
Los mantenedores suelen responder en 1 día
@pcbeingused333 ya está trabajando en esto.
Desde el 22/11/2026.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 74/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- build-system, cli
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 335
- Forks
- 172
- Merge medio
- 6 h 54 min
- PR fusionados (30 d)
- 37
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de QuantConnect/lean-cli
-
priority:P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
QuantConnect/lean-cli#792 ·
Los mantenedores suelen responder en 1 día
-
priority:P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
QuantConnect/lean-cli#786 ·
Los mantenedores suelen responder en 1 día
-
priority:P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
QuantConnect/lean-cli#785 ·
Los mantenedores suelen responder en 1 día
-
A partially written live command result aborts polling with JSONDecodeErrorPosiblemente ocupada @pcbeingused333 la tomó hace 3 días. Abiertopriority:P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
QuantConnect/lean-cli#784 ·
Los mantenedores suelen responder en 1 día
-
Container lookup failures during result polling are masked by UnboundLocalErrorPosiblemente ocupada @pcbeingused333 la tomó hace 5 días. Abiertopriority:P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
QuantConnect/lean-cli#783 ·
Los mantenedores suelen responder en 1 día
Todos los issues de QuantConnect/lean-cli
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pimutils/vdirsyncer#1242 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
open-webui/open-webui#35360 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día