protected override void Load() { base.Load(); Instance = this; var libraryPlatform = PlatformHelper.IsLinux ? (LibraryPlatform) new LinuxPlatform() : new WindowsPlatform(); MonoAPI.Initialize(libraryPlatform); if (Configuration.Instance.EnableWatchdog) { Logger.Log("Installing watchdog...", ConsoleColor.Yellow); AppDomain.CurrentDomain.AssemblyLoad += OnAssemblyLoad; ThreadPool.QueueUserWorkItem(c => { DateTime startTime = DateTime.UtcNow; foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { try { StackTraceHelper.RegisterAssemblyForStacktracePatch(assembly); } catch (Exception e) { Logger.LogException(e, $"Could not load assembly for patching: {assembly.FullName}, watchdog will not work detect this assembly."); } } TaskDispatcher.QueueOnMainThread(() => InstallWatchdog(DateTime.UtcNow - startTime)); }); } }
private void OnAssemblyLoad(object sender, AssemblyLoadEventArgs args) { StackTraceHelper.RegisterAssemblyForStacktracePatch(args.LoadedAssembly); }