41 |
|
if (e.GetType() == typeof(SqlException)) |
42 |
|
{ |
43 |
|
SqlException sql_ex = (e as SqlException); |
44 |
< |
List<object> strs = new List<object>(); |
44 |
> |
List<string> strs = new List<string>(); |
45 |
|
using (log4net.NDC.Push(string.Format("{0}: ID={1} MESSAGE={2}{3}Diagnostics:{3}{4}", sql_ex.GetType().Name, sql_ex.Number.ToString(), sql_ex.Message, System.Environment.NewLine, sql_ex.ToString()))) |
46 |
|
{ |
47 |
< |
Stack stack = log4net.NDC.CloneStack(); |
48 |
< |
strs = new List<object>(stack.ToArray()); |
49 |
< |
strs.Reverse(); |
47 |
> |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
48 |
|
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
49 |
|
} |
50 |
|
StringBuilder builder = new StringBuilder(); |
51 |
< |
foreach (object str in strs) { builder.AppendLine(str.ToString()); } |
51 |
> |
foreach (string str in strs) { builder.AppendLine(str); } |
52 |
|
result = ShowAbortRetryIgnoreDialog("Encountered unhandled Exception", builder.ToString()); |
53 |
|
if (result == DialogResult.Abort) |
54 |
|
Application.Exit(); |
55 |
|
} |
56 |
|
else |
57 |
|
{ |
58 |
< |
List<object> strs = new List<object>(); |
58 |
> |
List<string> strs = new List<string>(); |
59 |
|
using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", e.GetType().Name, e.Message, System.Environment.NewLine, e.ToString()))) |
60 |
|
{ |
61 |
< |
Stack stack = log4net.NDC.CloneStack(); |
64 |
< |
strs = new List<object>(stack.ToArray()); |
65 |
< |
strs.Reverse(); |
61 |
> |
strs = Logging.GetMessagesFromThreadContextStack("NDC"); |
62 |
|
Logging.ATSAdminLog.Error("Encountered unhandled Exception"); |
63 |
|
} |
64 |
|
StringBuilder builder = new StringBuilder(); |
65 |
< |
foreach (object str in strs) { builder.AppendLine(str.ToString()); } |
65 |
> |
foreach (string str in strs) { builder.AppendLine(str); } |
66 |
|
result = ShowAbortRetryIgnoreDialog("Encountered unhandled Exception", builder.ToString()); |
67 |
|
if (result == DialogResult.Abort) |
68 |
|
Application.Exit(); |