Add a skill to interpret Android runtime events in .nettrace files
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/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
- Lĩnh vực
- devtools, observability-sre
Hướng nghiên cứu
Start by locating the repository’s skill conventions and reading the runtime’s documented event schema; use the issue’s session-local TraceEvent decoder example and original .nettrace files as investigation references. Done means a repository skill can answer focused lifetime and GC-bridge queries while explaining event loss, missing data, and uncertainty, without adding a permanent trace-reader project or product dependency.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Android framework version
net11.0-android (Preview)
Affected platform version
.NET 11 Android runtime diagnostics, covering CoreCLR and NativeAOT.
Description
Add a repository skill that accepts a local .nettrace file and interprets our custom Microsoft.Android.Runtime events. This is a follow-up to #6822 and the local experiment moving JNI global/local/weak-global reference diagnostics to EventSource.
The skill should provide cross-platform investigation on Windows, macOS, and Linux without adding a permanent trace-reader project or dependency to the Android solution/product. A small session-local decoder using Microsoft.Diagnostics.Tracing.TraceEvent is one possible implementation detail.
Suggested coverage:
- Decode event names, IDs, timestamps, keywords, levels, and typed payloads; correlate GC bridge/type-map timing with reference operations.
- Track creation, deletion, ownership release, and Java GC collection of global/local/weak-global references. Distinguish local-reference ownership release from actual JNI deletion.
- Correlate numeric handles with Java identity hashes, managed peer/type diagnostics, managed thread IDs, and bridge-operation context. Account for handle reuse and concurrent counter snapshots rather than treating the trace as one atomic history.
- Display CoreCLR EventPipe call stacks and interpret the opt-in NativeAOT
ReferenceStackTracepayloads, correlated by reference event ID, handle, and managed thread ID. - Report event loss, late attachment, abrupt-crash truncation, missing events/stacks, and uncertainty explicitly. Absence of an event is not proof an operation did not happen.
- Allow focused queries such as “what happened to handle 0x75?”, “where was this peer disposed?”, and “what happened during this GC bridge round?”.
dotnet-trace report and its Speedscope/Chromium conversions do not expose the custom event payloads needed for these investigations. Preserve and interpret the original .nettrace file.
Steps to Reproduce
- Build an Android application with
EnableDiagnostics=trueandEventSourceSupport=true; use startup suspension when a complete initial reference history is needed. - Collect global/weak-global events using
dotnet-trace collect --dsrouter android-emu --providers Microsoft.Android.Runtime:0x10:5 -o references.nettrace, or use0x30to include local references. - For NativeAOT managed stack payloads, additionally enable keyword
0x40(0x50for globals/weak-globals plus stacks;0x70to include locals). - Ask the proposed skill to analyze the original trace, identify relevant lifetimes, and explain the evidence and collection limitations.
The new reference event IDs/keywords above describe the current local experiment, not a shipped contract. The skill should follow the runtime's documented event schema as it evolves.
Did you find any workaround?
A small prototype reader was validated against real CoreCLR and NativeAOT Android emulator traces. It is being removed from the repository/solution; the following example preserves the useful decoding approach for future skill development.
Example: session-local TraceEvent decoder
Use a console project referencing Microsoft.Diagnostics.Tracing.TraceEvent (the experiment used version 3.1.21). This is an example, not a request to add a permanent tool project.
using System;
using System.Globalization;
using System.IO;
using Microsoft.Diagnostics.Tracing.Etlx;
if (args.Length != 1) {
Console.Error.WriteLine("Usage: decoder TRACE.nettrace");
return 2;
}
string convertedPath = Path.Combine (
Path.GetTempPath (), $"android-trace-{Guid.NewGuid ():N}.etlx");
try {
TraceLog.CreateFromEventPipeDataFile (args [0], convertedPath);
using var trace = new TraceLog (convertedPath);
if (trace.EventsLost != 0) {
Console.Error.WriteLine (
$"WARNING: {trace.EventsLost} events were lost; histories are incomplete.");
}
Console.Error.WriteLine (
"Operations before collection and final events at abrupt exit may be missing.");
int eventCount = 0;
foreach (var entry in trace.Events) {
if (entry.ProviderName != "Microsoft.Android.Runtime") {
continue;
}
eventCount++;
Console.Write (string.Create (CultureInfo.InvariantCulture,
$"{entry.TimeStampRelativeMSec:F3}ms thread={entry.ThreadID} {entry.EventName}"));
for (int i = 0; i < entry.PayloadNames.Length; i++) {
string name = entry.PayloadNames [i];
object value = entry.PayloadValue (i);
Console.Write ($" {name}=");
if (value is ulong handle &&
(name == "handle" || name == "sourceHandle")) {
Console.Write (string.Create (
CultureInfo.InvariantCulture, $"0x{handle:x}"));
} else {
Console.Write (Convert.ToString (value, CultureInfo.InvariantCulture));
}
}
Console.WriteLine ();
for (var stack = entry.CallStack (); stack != null; stack = stack.Caller) {
Console.WriteLine ($" at {stack.CodeAddress.FullMethodName}");
}
}
if (eventCount == 0) {
Console.Error.WriteLine ("No Microsoft.Android.Runtime events found.");
return 1;
}
return trace.EventsLost == 0 ? 0 : 1;
} finally {
if (File.Exists (convertedPath)) {
File.Delete (convertedPath);
}
}
This prints raw evidence. The skill still needs schema-aware interpretation and correlation, especially when traces are partial. NativeAOT stack strings are event payloads, not CallStack() entries.
Relevant log output
The local experiment decoded ordinary JNI reference events, peer diagnostics, local-reference releases, and Java GC collection on both runtimes. CoreCLR provided application call stacks through EventPipe. NativeAOT provided no EventPipe call stacks; the opt-in fallback produced 148 correlated managed stack events containing application frames. Ordinary NativeAOT collection with keyword mask 0x30 emitted no stack-string events.
By opening the issue you agree to follow this project's Code of Conduct.
- Ngôn ngữ chính
- C#
- Star
- 2.1k
- Fork
- 579
- Merge trung bình
- 2 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 222
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
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 dotnet/android
-
Area: App+Library Build
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
EditText.getText() isn't boundĐang mởArea: Mono.Android
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
dotnet/android#9192 · 4 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows needs-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 4/5 Hơn một tuần Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Investigate JNI reference ownership leaks and GC-bridge leak-check reliabilityCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởneeds-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 50/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của dotnet/android
Issue tương tự
-
Bug pulumi/pulumi
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
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 82/100
activescott/lessmsi#306 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
HTML sitemap lists unpublished pagesCó thể đã có người làm @KrzysztofPajak đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
grandnode/grandnode2#883 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: `winapp ui <command> --on sandbox --help` starts sandbox setup instead of showing helpĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày