C# setup loses evaluated or namespaced NoWarn suppressions
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- build-system, cli
Research direction
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.
Written by the indexing model from the issue text.
Description
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 tokenExtraNoWarnrather thanCS0168.- 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.
- Dominant language
- Python
- Stars
- 335
- Forks
- 172
- Avg merge
- 6h 54m
- Merged PRs (30d)
- 37
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from QuantConnect/lean-cli
-
priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
QuantConnect/lean-cli#792 ·
Maintainers usually reply within 1 day
-
priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
QuantConnect/lean-cli#786 ·
Maintainers usually reply within 1 day
-
priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
QuantConnect/lean-cli#785 ·
Maintainers usually reply within 1 day
-
A partially written live command result aborts polling with JSONDecodeErrorPossibly taken @pcbeingused333 claimed this 3 days ago. Openpriority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
QuantConnect/lean-cli#784 ·
Maintainers usually reply within 1 day
-
Container lookup failures during result polling are masked by UnboundLocalErrorPossibly taken @pcbeingused333 claimed this 5 days ago. Openpriority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
QuantConnect/lean-cli#783 ·
Maintainers usually reply within 1 day
All issues in QuantConnect/lean-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pimutils/vdirsyncer#1242 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-webui/open-webui#35360 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Suggest link: Destiny Verify (MIT zero-dependency pre-commit security, citation & link hygiene CLI)Open
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day