Skip to content

Commit 672ff05

Browse files
committed
Added additional client error logging when parsing exceptions.
This should give us more insight into MSIX issues.
1 parent 77ad8a2 commit 672ff05

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

src/Exceptionless/Extensions/ToErrorModelExtensions.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ private static Error ToErrorModelInternal(Exception exception, ExceptionlessClie
5757
PropertyInfo info = type.GetProperty("HResult", BindingFlags.Public | BindingFlags.Instance);
5858
if (info != null)
5959
error.Code = info.GetValue(exception, null).ToString();
60-
} catch (Exception) { }
60+
} catch (Exception ex) {
61+
log.Error(typeof(ExceptionlessClient), ex, "Error populating HResult Code: " + ex.Message);
62+
}
6163

6264
#if NET45
6365
try {
@@ -93,7 +95,9 @@ private static Error ToErrorModelInternal(Exception exception, ExceptionlessClie
9395
var extraProperties = type.GetPublicProperties().Where(p => !p.Name.AnyWildcardMatches(exclusions, true)).ToDictionary(p => p.Name, p => {
9496
try {
9597
return p.GetValue(exception, null);
96-
} catch { }
98+
} catch (Exception ex) {
99+
log.Error(typeof(ExceptionlessClient), ex, String.Format("Error getting extra exception property {0} value: {1}", p.Name, ex.Message));
100+
}
97101
return null;
98102
});
99103

@@ -107,7 +111,9 @@ private static Error ToErrorModelInternal(Exception exception, ExceptionlessClie
107111
MaxDepthToSerialize = 5
108112
}, client);
109113
}
110-
} catch { }
114+
} catch (Exception ex) {
115+
log.Error(typeof(ExceptionlessClient), ex, "Error populating extra exception properties: " + ex.Message);
116+
}
111117

112118
if (exception.InnerException != null)
113119
error.Inner = ToErrorModelInternal(exception.InnerException, client, true);
@@ -164,7 +170,9 @@ internal static ModuleCollection GetLoadedModules(IExceptionlessLog log, bool in
164170
var attrs = assembly.GetCustomAttributes(typeof(System.CodeDom.Compiler.GeneratedCodeAttribute)).ToList();
165171
if (attrs.Count > 0)
166172
continue;
167-
} catch {}
173+
} catch (Exception ex) {
174+
log.Error(typeof(ExceptionlessClient), ex, "Error while checking if assembly " + assembly.FullName + " should be added to modules:" + ex.Message);
175+
}
168176
}
169177

170178
var module = assembly.ToModuleInfo();
@@ -185,10 +193,15 @@ private static void PopulateStackTrace(this Error error, Error root, Exception e
185193
try {
186194
var st = new EnhancedStackTrace(exception);
187195
frames = st.GetFrames();
188-
} catch {}
196+
}
197+
catch (Exception ex) {
198+
log.Error(typeof(ExceptionlessClient), ex, "Error getting stack frames: " + ex.Message);
199+
}
189200

190-
if (frames == null)
201+
if (frames == null || frames.Length == 0) {
202+
log.Info(typeof(ExceptionlessClient), "Error " + error.Message + " contained no stack frames");
191203
return;
204+
}
192205

193206
foreach (StackFrame frame in frames) {
194207
var stackFrame = new Models.Data.StackFrame {

src/Exceptionless/Extensions/ToSimpleErrorModelExtensions.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ private static SimpleError ToSimpleErrorModelInternal(this Exception exception,
6969
var extraProperties = type.GetPublicProperties().Where(p => !p.Name.AnyWildcardMatches(exclusions, true)).ToDictionary(p => p.Name, p => {
7070
try {
7171
return p.GetValue(exception, null);
72-
} catch {}
72+
} catch (Exception ex) {
73+
log.Error(typeof(ExceptionlessClient), ex, String.Format("Error getting extra exception property {0} value: {1}", p.Name, ex.Message));
74+
}
7375
return null;
7476
});
7577

@@ -83,7 +85,9 @@ private static SimpleError ToSimpleErrorModelInternal(this Exception exception,
8385
MaxDepthToSerialize = 5
8486
}, client);
8587
}
86-
} catch {}
88+
} catch (Exception ex) {
89+
log.Error(typeof(ExceptionlessClient), ex, "Error populating extra exception properties: " + ex.Message);
90+
}
8791

8892
if (exception.InnerException != null)
8993
error.Inner = exception.InnerException.ToSimpleErrorModel(client);

0 commit comments

Comments
 (0)