File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -304,14 +304,18 @@ bool includeStacktrace
304304
305305 // --- Formatting ---
306306 string stackTrace = includeStacktrace ? ExtractStackTrace ( message ) : null ;
307- // Get first line if stack is present and requested, otherwise use full message
308- string messageOnly =
309- ( includeStacktrace && ! string . IsNullOrEmpty ( stackTrace ) )
310- ? message . Split (
311- new [ ] { '\n ' , '\r ' } ,
312- StringSplitOptions . RemoveEmptyEntries
313- ) [ 0 ]
314- : message ;
307+ // Always get first line for the message, use full message only if no stack trace exists
308+ string [ ] messageLines = message . Split (
309+ new [ ] { '\n ' , '\r ' } ,
310+ StringSplitOptions . RemoveEmptyEntries
311+ ) ;
312+ string messageOnly = messageLines . Length > 0 ? messageLines [ 0 ] : message ;
313+
314+ // If not including stacktrace, ensure we only show the first line
315+ if ( ! includeStacktrace )
316+ {
317+ stackTrace = null ;
318+ }
315319
316320 object formattedEntry = null ;
317321 switch ( format )
You can’t perform that action at this time.
0 commit comments