Skip to content

Commit c1a9d9b

Browse files
authored
hotfix: log expression when failing to analyze expression (#216)
1 parent 0e69d39 commit c1a9d9b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/FluentAssertions.Analyzers/Utilities/FluentAssertionsAnalyzer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ private Diagnostic AnalyzeExpressionSafely(ExpressionSyntax expression, Semantic
101101
}
102102
catch (Exception e)
103103
{
104-
Console.Error.WriteLine($"Failed to analyze expression in {GetType().FullName}.\n{e}");
104+
var expressionString = "UNKNOWN";
105+
try {
106+
expressionString = expression.ToString();
107+
} catch {}
108+
Console.Error.WriteLine($"Failed to analyze expression in {GetType().FullName}. expression: {expressionString}\n{e}");
105109
return null;
106110
}
107111
}

0 commit comments

Comments
 (0)