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 摘要。