C# setup loses evaluated or namespaced NoWarn suppressions

Abierto
#782 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp, python
Área
build-system, cli

Línea de trabajo

Start in lean/components/docker/lean_runner.py at set_up_csharp_options and see how it collects NoWarn and merges it with the CLI's own suppressions. Build the three repro projects from the issue (conditional Debug/Release groups, an ExtraNoWarn property reference, and a namespaced Project element) and compare dotnet build -c Release against the command the CLI generates for each. Done means the generated command keeps the Release suppression, resolves property references, matches namespaced elements, and still includes the CLI's required codes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

priority:P2

Problem

LeanRunner.set_up_csharp_options in lean/components/docker/lean_runner.py reads the first NoWarn XML element without evaluating MSBuild conditions or property references, then exports the resulting warning codes as a global property. Valid project suppressions can therefore disappear and make a warnings-as-errors build fail.

Reproduction

Use a C# SDK project with these properties:

<PropertyGroup>
  <TargetFramework>net10.0</TargetFramework>
  <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  <NoWarn Condition="'$(Configuration)' == 'Debug'">CS0618</NoWarn>
  <NoWarn Condition="'$(Configuration)' == 'Release'">CS0168</NoWarn>
</PropertyGroup>

Include a method containing an unused local:

public void Example() { int unused; }

A normal dotnet build -c Release succeeds. The Release build command generated by set_up_csharp_options instead passes NoWarn=MSB3277%3BCS0618, overriding the Release suppression and failing with CS0168.

Two other forms reproduce the same loss of suppressions:

  • <ExtraNoWarn>CS0168</ExtraNoWarn><NoWarn>$(ExtraNoWarn);CS0618</NoWarn>: the generated property contains the literal token ExtraNoWarn rather than CS0168.
  • A project with xmlns="http://schemas.microsoft.com/developer/msbuild/2003" and <NoWarn>CS0168</NoWarn>: the unqualified element lookup misses the suppression.

Verified with .NET SDK 10.0.101: ordinary SDK builds succeed for all three cases, while commands generated by both master and the property-escaping change fail with CS0168. This is pre-existing and independent of property escaping.

Required result

Retain the project's effective warning suppressions for the selected build configuration, including evaluated property references and supported XML namespaces, while retaining the CLI's required suppressions. A literal, unconditional NoWarn in a non-namespaced project is a workaround for these cases.

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de QuantConnect/lean-cli

Todos los issues de QuantConnect/lean-cli

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.