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

未關閉 適合新手
#778 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
70/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
csharp, python
領域
build-system, cli

研究方向

從 LeanRunner.set_up_csharp_options 開始,位於 lean/components/docker/lean_runner.py,其中 PathMap 的值是從主機編譯根目錄組裝出來的。閱讀 MSBuild 如何接收該值,並用 dotnet build Lib.csproj "-p:PathMap=/src=/work/a%2Cb" 或在包含逗號的路徑下的專案來重現。變更是在建構 PathMap 字串之前,對主機路徑中編譯器的對應分隔符號進行轉義;完成意味著 /work/a,b/Algorithm 下的 C# 專案能夠建置,並且 PathMap 將 /LeanCLI 對應到該確切路徑。

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Python
星號
335
分支
172
平均合併
6 小時 54 分鐘
30 天內合併 PR
37

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

QuantConnect/lean-cli 的其他 Issue

查看 QuantConnect/lean-cli 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。