Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Improve NativeAOT trimming for syntax-only KustoCode.Parse consumers

Đang mở
#200 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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 ParseAndAnalyze or Analyze.

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/Kusto-Query-Language

Tất cả issue của microsoft/Kusto-Query-Language

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.