Improve NativeAOT trimming for syntax-only KustoCode.Parse consumers
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- csharp, wasm
调研方向
Start with src/Kusto.Language/KustoCode.cs, especially Parse and the shared Create(..., bool analyze, ...) implementation described in the issue. Trace how Binder.TryBind enters the NativeAOT dependency graph for KustoCode.Parse(query).GetDiagnostics(), then compare it with ParseAndAnalyze and Analyze. Done means syntax-only parsing still covers the listed valid and malformed inputs without retaining semantic binding, while explicit semantic analysis continues to work.
由索引模型根据 Issue 内容生成。
描述
Scenario
kusto-cli is a NativeAOT command-line application using Microsoft.Azure.Kusto.Language 12.3.2 for syntax validation. Its validation path calls KustoCode.Parse(query).GetDiagnostics(); it does not call ParseAndAnalyze or Analyze. Semantic name/type validation is left to the server.
During our NativeAOT size investigation, we found that this syntax-only usage retains semantic binding code that the application does not execute.
Retaining path
In KustoCode.cs, Parse passes analyze: false to the shared Create(..., bool analyze, ...) implementation. That implementation also serves semantic-analysis callers and references Binder.TryBind behind if (analyze).
In our NativeAOT publish, the runtime Boolean does not prevent the compiler's dependency analysis from retaining that binding path. The same shared structure is still present at the upstream revision linked above.
Requested improvement
Please make syntax-only parsing and semantic analysis independently reachable for trimming purposes, so consumers that only parse and retrieve syntax diagnostics do not retain otherwise-unused semantic binding implementation.
Possible approaches include separating parsing from the explicitly requested binding operation, or providing a dedicated trim-friendly syntax-only API. The important property is that the syntax-only path does not retain binding through a shared runtime branch; another runtime Boolean alone would not address this.
Evidence and current workaround
Our PR applies a consumer-side ILC substitution that removes the body of Kusto.Language.Binding.Binder.TryBind. The published application's syntax-validation smoke tests continue to pass. This is not an appropriate long-term integration: it depends on an internal member signature and undocumented consumer-side substitution behavior. We would like to remove it in favor of upstream-supported trimming.
The Kusto binding substitution together with an unrelated Hex1b console-construction substitution reduced our Windows x64 executable from 20,682,240 to 19,831,808 bytes (850,432 bytes) using SDK 10.0.401 / runtime 10.0.12, Release. We did not isolate the Kusto-only contribution, so that combined number should not be attributed solely to this library.
Suggested acceptance coverage
- Native-publish a small application that only calls
KustoCode.Parse(...).GetDiagnostics(), without substitutions or suppression-based workarounds. - Confirm valid queries and management commands parse, malformed syntax produces diagnostics, and unknown table/column names do not trigger semantic validation.
- Inspect NativeAOT dependency/size diagnostics to confirm the otherwise-unused semantic-binding path is eliminated.
- Keep full semantic analysis working for consumers that explicitly use
ParseAndAnalyzeorAnalyze.
Example inputs exercised by our PR include print 1, UnknownTable | where UnknownColumn > 0 | take 5, .show tables, and .show database ['Samples'] schema as json.
This request concerns unnecessary code retention/binary size, not a claim that the parsing API fails at runtime under NativeAOT.
- 主要语言
- C#
- 星标
- 684
- 派生
- 122
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/Kusto-Query-Language 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 72/100
-
难度 3/5 1-2 天 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 72/100
microsoft/Kusto-Query-Language#194 · 3 条评论 ·
-
难度 3/5 1-2 天 新手友好度 52/100
microsoft/Kusto-Query-Language#189 · 1 个 reaction ·
查看 microsoft/Kusto-Query-Language 的全部 Issue
相似的 Issue
-
devtools
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
clawsweeper:fix-shape-clear clawsweeper:needs-maintainer-review clawsweeper:no-new-fix-pr clawsweeper:not-repro-on-main impact:ux-release-blocker issue-rating: 🦪 silver shellfish P0
难度 2/5 1-3 小时 新手友好度 72/100
openclaw/openclaw-windows-node#1843 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
-
kind:ux size:S type:bug
难度 2/5 1-3 小时 新手友好度 78/100
elsa-workflows/elsa-foundation#3256 ·
维护者通常 1 天内回复
-
[Bug]: Revit selector reads process ids 2000-2099 as years (flaky AgentClientTests.AYearOrAProcessIdSelectsTheHost)可能已有人在做 @Wurschdhaud 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 83/100
pyrevitlabs/pyRevit#3817 ·
维护者通常 1 天内回复