提交 88c71cd3 编写于 作者: C Cyrus Najmabadi

Add more information in our NFW description to help the backend bucket it better

上级 6ff8c82a
......@@ -88,7 +88,7 @@ public static void ReportNonFatal(Exception exception)
var faultEvent = new FaultEvent(
eventName: FunctionId.NonFatalWatson.GetEventName(),
description: "Roslyn NonFatal Watson",
description: GetDescription(),
FaultSeverity.Diagnostic,
exceptionObject: exception,
gatherEventDetails: faultUtility =>
......@@ -114,6 +114,39 @@ public static void ReportNonFatal(Exception exception)
session.PostEvent(faultEvent);
}
private static string GetDescription()
{
const string OurNamespace = nameof(Microsoft) + "." + nameof(CodeAnalysis) + "." + nameof(ErrorReporting);
// Be resilient to failing here. If we can't get a suitable name, just fallback to the standard name we
// used to report.
try
{
// walk up the stack looking for the first call from a type that isn't in the ErrorReporting namespace.
foreach (var frame in new StackTrace().GetFrames())
{
var method = frame.GetMethod();
var methodName = method?.Name;
if (methodName == null)
continue;
var declaringTypeName = method?.DeclaringType?.FullName;
if (declaringTypeName == null)
continue;
if (declaringTypeName.StartsWith(OurNamespace))
continue;
return declaringTypeName + "." + methodName;
}
}
catch
{
}
return "Roslyn NonFatal Watson";
}
private static List<string> CollectServiceHubLogFilePaths()
{
var paths = new List<string>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册