static void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e) { //var domain = e.Exception.Source.Split('.')[0]; // if (bool.Parse(ConfigHelper.GetConfigValue("EnableLogFirstChanceException"))) if (e.Exception.Source != "Glimpse.Core" && e.Exception.Source != "mscorlib") { var eLog = new LogInfo(); //LogService.GetEventLogObj(); eLog.OccuredException = e.Exception; eLog.CustomMessage = "It's basic Exception!"; List <LogInfo> logs = null; lock (Logs) { Logs.Add(eLog); if (Logs.Count == 100) { logs = Logs.ToList(); Logs.Clear(); } } if (logs != null) { LogService.BatchHandle(logs); } } }