提交 02da8176 编写于 作者: C Cyrus Najmabadi

PR feedback

上级 88c71cd3
......@@ -109,6 +109,9 @@ private bool TryExecuteCommand(int caretPosition, Document document, IFindUsages
{
try
{
if (document != null)
throw new Exception();
using var token = _asyncListener.BeginAsyncOperation(nameof(StreamingFindReferencesAsync));
// Let the presented know we're starting a search. It will give us back
......
......@@ -88,7 +88,7 @@ public static void ReportNonFatal(Exception exception)
var faultEvent = new FaultEvent(
eventName: FunctionId.NonFatalWatson.GetEventName(),
description: GetDescription(),
description: GetDescription(exception),
FaultSeverity.Diagnostic,
exceptionObject: exception,
gatherEventDetails: faultUtility =>
......@@ -114,16 +114,16 @@ public static void ReportNonFatal(Exception exception)
session.PostEvent(faultEvent);
}
private static string GetDescription()
private static string GetDescription(Exception exception)
{
const string OurNamespace = nameof(Microsoft) + "." + nameof(CodeAnalysis) + "." + nameof(ErrorReporting);
const string CodeAnalysisNamespace = nameof(Microsoft) + "." + nameof(CodeAnalysis);
// Be resilient to failing here. If we can't get a suitable name, just fallback to the standard name we
// Be resilient to failing here. If we can't get a suitable name, just fall back 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())
foreach (var frame in new StackTrace(exception).GetFrames())
{
var method = frame.GetMethod();
var methodName = method?.Name;
......@@ -134,7 +134,7 @@ private static string GetDescription()
if (declaringTypeName == null)
continue;
if (declaringTypeName.StartsWith(OurNamespace))
if (!declaringTypeName.StartsWith(CodeAnalysisNamespace))
continue;
return declaringTypeName + "." + methodName;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册