@@ -250,12 +250,10 @@ internal static bool IsDebuggerAttached()
250250 public string Trace ( TraceEventType type , int eventId , string message , string [ ] labels , params ReadOnlySpan < object > parameters )
251251 {
252252 // Don't bother building the string if this trace is going to be ignored.
253-
254- if ( _traceSource == null || ! _traceSource . Switch . ShouldTrace ( type ) )
253+ if ( _traceSource is null || ! _traceSource . Switch . ShouldTrace ( type ) )
255254 return null ;
256255
257256 // Compose the trace string.
258-
259257 AvTraceBuilder traceBuilder = new AvTraceBuilder ( AntiFormat ( message ) ) ; // Holds the format string
260258 object [ ] combinedArgs = null ; // Holds the combined labels & parameters arrays.
261259 int formatIndex = 0 ;
@@ -265,7 +263,7 @@ public string Trace(TraceEventType type, int eventId, string message, string[] l
265263 // Create array of pre-computed size
266264 int combinedArgsLength = Math . Min ( labels . Length - 1 , parameters . Length ) * 2 ;
267265 if ( combinedArgsLength > 0 )
268- combinedArgs = new object [ combinedArgsLength ] ;
266+ combinedArgs = new object [ combinedArgsLength ] ;
269267
270268 int i = 1 , j = 0 ;
271269 for ( ; i < labels . Length && j < parameters . Length ; i ++ , j ++ )
@@ -279,14 +277,13 @@ public string Trace(TraceEventType type, int eventId, string message, string[] l
279277
280278 // If the parameter is null, convert to "<null>"; otherwise,
281279 // when a string.format is ultimately called it produces bad results.
282- if ( parameters [ j ] == null )
280+ if ( parameters [ j ] is null )
283281 {
284282 combinedArgs [ j * 2 + 1 ] = "<null>" ;
285283 }
286284
287285 // Otherwise, if this is an interesting object, add the hash code and type to
288286 // the format string explicitly.
289-
290287 else if ( ! SuppressGeneratedParameters
291288 && parameters [ j ] . GetType ( ) != typeof ( string )
292289 && parameters [ j ] is not ValueType
@@ -297,19 +294,18 @@ public string Trace(TraceEventType type, int eventId, string message, string[] l
297294 traceBuilder . Append ( $ "; { labels [ i ] } .Type='{ GetTypeHelper ( parameters [ j ] ) } '") ;
298295
299296 // Add the parameter to the combined list.
300-
301297 combinedArgs [ j * 2 + 1 ] = parameters [ j ] ;
302298 }
303- else // Add the parameter to the combined list.
299+ // Add the parameter to the combined list.
300+ else
304301 {
305302 combinedArgs [ j * 2 + 1 ] = parameters [ j ] ;
306303 }
307304 }
308305
309306 // It's OK if we terminate because we have more labels than parameters;
310307 // this is used by traces to have out-values in the Stop message.
311-
312- if ( TraceExtraMessages != null && j < parameters . Length )
308+ if ( TraceExtraMessages is not null && j < parameters . Length )
313309 {
314310 TraceExtraMessages ( traceBuilder , parameters . Slice ( j ) ) ;
315311 }
0 commit comments