@@ -249,12 +249,10 @@ internal static bool IsDebuggerAttached()
249249 public string Trace ( TraceEventType type , int eventId , string message , string [ ] labels , params ReadOnlySpan < object > parameters )
250250 {
251251 // Don't bother building the string if this trace is going to be ignored.
252-
253- if ( _traceSource == null || ! _traceSource . Switch . ShouldTrace ( type ) )
252+ if ( _traceSource is null || ! _traceSource . Switch . ShouldTrace ( type ) )
254253 return null ;
255254
256255 // Compose the trace string.
257-
258256 AvTraceBuilder traceBuilder = new AvTraceBuilder ( AntiFormat ( message ) ) ; // Holds the format string
259257 object [ ] combinedArgs = null ; // Holds the combined labels & parameters arrays.
260258 int formatIndex = 0 ;
@@ -264,7 +262,7 @@ public string Trace(TraceEventType type, int eventId, string message, string[] l
264262 // Create array of pre-computed size
265263 int combinedArgsLength = Math . Min ( labels . Length - 1 , parameters . Length ) * 2 ;
266264 if ( combinedArgsLength > 0 )
267- combinedArgs = new object [ combinedArgsLength ] ;
265+ combinedArgs = new object [ combinedArgsLength ] ;
268266
269267 int i = 1 , j = 0 ;
270268 for ( ; i < labels . Length && j < parameters . Length ; i ++ , j ++ )
@@ -278,14 +276,13 @@ public string Trace(TraceEventType type, int eventId, string message, string[] l
278276
279277 // If the parameter is null, convert to "<null>"; otherwise,
280278 // when a string.format is ultimately called it produces bad results.
281- if ( parameters [ j ] == null )
279+ if ( parameters [ j ] is null )
282280 {
283281 combinedArgs [ j * 2 + 1 ] = "<null>" ;
284282 }
285283
286284 // Otherwise, if this is an interesting object, add the hash code and type to
287285 // the format string explicitly.
288-
289286 else if ( ! SuppressGeneratedParameters
290287 && parameters [ j ] . GetType ( ) != typeof ( string )
291288 && parameters [ j ] is not ValueType
@@ -296,19 +293,18 @@ public string Trace(TraceEventType type, int eventId, string message, string[] l
296293 traceBuilder . Append ( $ "; { labels [ i ] } .Type='{ GetTypeHelper ( parameters [ j ] ) } '") ;
297294
298295 // Add the parameter to the combined list.
299-
300296 combinedArgs [ j * 2 + 1 ] = parameters [ j ] ;
301297 }
302- else // Add the parameter to the combined list.
298+ // Add the parameter to the combined list.
299+ else
303300 {
304301 combinedArgs [ j * 2 + 1 ] = parameters [ j ] ;
305302 }
306303 }
307304
308305 // It's OK if we terminate because we have more labels than parameters;
309306 // this is used by traces to have out-values in the Stop message.
310-
311- if ( TraceExtraMessages != null && j < parameters . Length )
307+ if ( TraceExtraMessages is not null && j < parameters . Length )
312308 {
313309 TraceExtraMessages ( traceBuilder , parameters . Slice ( j ) ) ;
314310 }
0 commit comments