private ReadOnlyMemory <byte> WriteTraceToJsonWriter(JsonSerializationFormat jsonSerializationFormat)
        {
            IJsonWriter jsonTextWriter = JsonWriter.Create(jsonSerializationFormat);

            TraceWriter.WriteTrace(jsonTextWriter, this.Value);
            return(jsonTextWriter.GetResult());
        }
        private ReadOnlyMemory <byte> WriteTraceToJsonWriter(JsonSerializationFormat jsonSerializationFormat)
        {
            IJsonWriter jsonTextWriter = JsonWriter.Create(jsonSerializationFormat);

            jsonTextWriter.WriteObjectStart();

            jsonTextWriter.WriteFieldName("User Agent");
            jsonTextWriter.WriteStringValue(this.UserAgent);

            jsonTextWriter.WriteFieldName("Traces");
            TraceWriter.WriteTrace(jsonTextWriter, this.Value);

            jsonTextWriter.WriteObjectEnd();

            return(jsonTextWriter.GetResult());
        }
Exemple #3
0
        public static bool RebuildGACAssemblyCache(bool forceRebuild)
        {
            if (_gacNameCache.Length != 0 && !forceRebuild)
            {
                return(true);
            }

            IAssemblyEnum iterator = null;

            try { iterator = GAC.CreateGACEnum(); }
            catch (Exception e)
            {
                TraceWriter.WriteTrace("Could not obtain GAC assembly enumerator, " + e.Message);
                iterator = null;
            }

            if (iterator == null)
            {
                return(false);
            }
            IAssemblyName          currentName = null;
            List <GACAssemblyName> gacNames    = new List <GACAssemblyName>();

            while (GAC.GetNextAssembly(iterator, out currentName) == 0)
            {
                if (currentName == null)
                {
                    continue;
                }
                string displayName = GAC.GetDisplayName(currentName, ASM_DISPLAY_FLAGS.PUBLIC_KEY_TOKEN | ASM_DISPLAY_FLAGS.VERSION | ASM_DISPLAY_FLAGS.CULTURE);
                gacNames.Add(new GACAssemblyName(displayName));
            }

            _gacNameCache = gacNames.ToArray();
            return(true);
        }
        private void RegisterHockeyApp()
        {
            //CrashManager.Register(this, AppSettings.HockeyAppID);
            //UpdateManager.Register(this, AppSettings.HockeyAppID);

            // Initialize the HockeyApp TraceWriter
            TraceWriter.Initialize();

            // Wire up Unhandled Expcetion handler from Android
            AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) =>
            {
                // Use the trace writer to log exceptions so HockeyApp finds them
                TraceWriter.WriteTrace(args.Exception);
                args.Handled = true;
            };

            // Wire up the .NET Unhandled Exception handler
            AppDomain.CurrentDomain.UnhandledException +=
                (sender, args) => TraceWriter.WriteTrace(args.ExceptionObject);

            // Wire up the unobserved task exception handler
            TaskScheduler.UnobservedTaskException +=
                (sender, args) => TraceWriter.WriteTrace(args.Exception);
        }