Improve NativeAOT trimming for syntax-only KustoCode.Parse consumers
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp, wasm
- Lĩnh vực
- build-system, performance
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 684
- Fork
- 122
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/Kusto-Query-Language
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
microsoft/Kusto-Query-Language#194 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
microsoft/Kusto-Query-Language#189 · 1 reaction ·
Tất cả issue của microsoft/Kusto-Query-Language
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Nimblesite/SharpLsp#468 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
elastic/ecs-dotnet#575 ·
-
V4 alert-rule reads have no scope gate, so any authenticated credential can list alert rulesĐang mởalerts bug effort:S P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
nightscout/nocturne#2511 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Crash in v3.00Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
arkane-systems/mousejiggler#140 ·