[runtime] Add pipeline to convert managed exception into telemetry format (#10133)
* [runtime] Expose merp sender to icall
* [runtime] Add initial support for Exc -> Telemetry
In order to allow managed crash reporting using the existing telemetry
format, I have added initial support for converting a MonoException into
a json blob for telemetry.
* [runtime] Zero out stack memory for mono-state dumper
* [runtime] Add test for managed telemetry reporting
To test the proprietary bits, you must first have a copy of MERP
installed somewhere.
Then run the following test:
using System;
using System.Reflection;
public class MinimalTelemetry {
static MinimalTelemetry ()
{
var merp_path = "/xxx/xxx/xxx/Microsoft Error Reporting.app";
var monoType = Type.GetType ("Mono.Runtime", false);
var m = monoType.GetMethod("EnableMicrosoftTelemetry", BindingFlags.NonPublic | BindingFlags.Static);
var m_params = new object[] {"com.xamarin.MinimalTelemetry", "Test.Xam.MinimalTelemetry", "
1337001", merp_path, "AppleAppCrash", "/Library/Frameworks/Mono.framework/Versions/Current/bin/mono"};
m.Invoke(null, m_params);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(HandleException);
}
public static void HandleException (object sender, UnhandledExceptionEventArgs e)
{
var exc = e.ExceptionObject as Exception;
var monoType = Type.GetType ("Mono.Runtime", false);
var send = monoType.GetMethod("SendExceptionToTelemetry", BindingFlags.NonPublic | BindingFlags.Static);
var send_params = new object[] {exc};
send.Invoke(null, send_params);
// Now the MERP GUI should pop up
// Click "More Information"
// You should see something like this:
// {
// "payload" : {
// "protocol_version" : "0.0.1",
// "configuration" : {
// "version" : "5.19.0 (managed_telemetry_pipeline/
d342c73e320 Wed Aug 15 14:40:40 EDT 2018)",
// "tlc" : "normal",
// "sigsgev" : "altstack",
// "notifications" : "kqueue",
// "architecture" : "amd64",
// "disabled_features" : "none",
// "smallconfig" : "disabled",
// "bigarrays" : "disabled",
// "softdebug" : "enabled",
// "interpreter" : "enabled",
// "llvm_support" : "disabled",
// "suspend" : "hybrid"
// },
// "memory" : {
// "Resident Size" : "
16306176",
// "Virtual Size" : "
4491988992",
// "minor_gc_time" : "0",
// "major_gc_time" : "0",
// "minor_gc_count" : "0",
// "major_gc_count" : "0",
// "major_gc_time_concurrent" : "0"
// },
// "threads" : [
// {
// "is_managed" : false,
// "managed_thread_ptr" : "0x0",
// "thread_info_addr" : "0x0",
// "native_thread_id" : "0x0",
// "managed_frames" : [
// {
// "is_managed" : "true",
// "guid" : "
4F72FB1B-1E99-47BA-91CE-
9515783DC174",
// "token" : "0x6000004",
// "native_offset" : "0x6a",
// "il_offset" : "0x00000"
// }
// ]
// }
// ]},
// "parameters" : {
// "ApplicationBundleId:" : "Test.Xam.MinimalTelemetry",
// "ApplicationVersion:" : "
1337001",
// "ApplicationBitness:" : "x64",
// "ApplicationName:" : "com.xamarin.MinimalTelemetry",
// "BlameModuleName:" : "Mono Exception",
// "BlameModuleVersion:" : "5.19.0 (managed_telemetry_pipeline/
d342c73e320 Wed Aug 15 14:40:40 EDT 2018)",
// "BlameModuleOffset:" : "0x0",
// "ExceptionType:" : "0x02000000",
// "StackChecksum:" : "0x60114aa",
// "StackHash:" : "0x6011514",
// "OSVersion:" : "17.4.0",
// "LanguageID:" : "0x7f",
// "SystemManufacturer:" : "apple",
// "SystemModel:" : "MacBookPro14,3",
// "EventType:" : "AppleAppCrash"
// }
// }
}
public static void Main (string[] args)
{
//AppDomain.CurrentDomain.LoadFrom ("something that's not a valid path")
throw new Exception ("MinimalTelemetrybar MinimalTelemetrybar");
}
}
* [runtime] Create more ergonomic API for Exc to Telemetry
* [runtime] Consistently zero summarizer state memory
* [runtime] Stub out exception summarizer when crash reporting is disabled
* [runtime] Add interpreter support for walking Exception stacks