C# host paths containing a comma fail the compiler's PathMap parsing

Offen Anfängerfreundlich
#778 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
70/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
csharp, python
Bereich
build-system, cli

Rechercherichtung

Beginne bei LeanRunner.set_up_csharp_options in lean/components/docker/lean_runner.py, wo der PathMap-Wert aus dem Host-Compile-Root zusammengesetzt wird. Lies nach, wie MSBuild diesen Wert erhält, und reproduziere es mit dotnet build Lib.csproj "-p:PathMap=/src=/work/a%2Cb" oder einem Projekt unter einem Pfad, der ein Komma enthält. Die Änderung besteht darin, die Mapping-Separatoren des Compilers im Host-Pfad zu escapen, bevor der PathMap-String gebaut wird; fertig bedeutet, dass ein C#-Projekt unter /work/a,b/Algorithm baut und PathMap /LeanCLI auf genau diesen Pfad abbildet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

priority:P2

Problem

LeanRunner.set_up_csharp_options (lean/components/docker/lean_runner.py) sets the MSBuild property PathMap=/LeanCLI=<host compile root>. MSBuild hands it to the C# compiler as /pathmap:. The compiler splits that option's value into mappings on , (and each mapping on =), and reads a literal comma only when it is doubled (,,). A host path with a comma, such as /work/a,b/Algorithm, is therefore not a valid pathmap.

Reproduction

With https://github.com/QuantConnect/lean-cli/pull/777 applied (which escapes the value for MSBuild), put a C# project under /work/a,b/Algorithm and run lean backtest on it. Or build any SDK project directly:

dotnet build Lib.csproj "-p:PathMap=/src=/work/a%2Cb"

The build fails with CSC : error CS8101: The pathmap option was incorrectly formatted. Without that pull request, MSBuild already rejects the same path earlier (MSB1006), so these paths have never built.

Required result

A C# project whose host compile root contains a comma builds, and its PathMap maps /LeanCLI to that exact path. Suggestion: double the compiler's separators in the host path before it goes into the PathMap value.

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

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus QuantConnect/lean-cli

Alle Issues in QuantConnect/lean-cli

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.