@@ -250,12 +250,10 @@ internal static bool IsDebuggerAttached()
250
250
public string Trace ( TraceEventType type , int eventId , string message , string [ ] labels , params ReadOnlySpan < object > parameters )
251
251
{
252
252
// 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 ) )
255
254
return null ;
256
255
257
256
// Compose the trace string.
258
-
259
257
AvTraceBuilder traceBuilder = new AvTraceBuilder ( AntiFormat ( message ) ) ; // Holds the format string
260
258
object [ ] combinedArgs = null ; // Holds the combined labels & parameters arrays.
261
259
int formatIndex = 0 ;
@@ -265,7 +263,7 @@ public string Trace(TraceEventType type, int eventId, string message, string[] l
265
263
// Create array of pre-computed size
266
264
int combinedArgsLength = Math . Min ( labels . Length - 1 , parameters . Length ) * 2 ;
267
265
if ( combinedArgsLength > 0 )
268
- combinedArgs = new object [ combinedArgsLength ] ;
266
+ combinedArgs = new object [ combinedArgsLength ] ;
269
267
270
268
int i = 1 , j = 0 ;
271
269
for ( ; i < labels . Length && j < parameters . Length ; i ++ , j ++ )
@@ -279,14 +277,13 @@ public string Trace(TraceEventType type, int eventId, string message, string[] l
279
277
280
278
// If the parameter is null, convert to "<null>"; otherwise,
281
279
// when a string.format is ultimately called it produces bad results.
282
- if ( parameters [ j ] == null )
280
+ if ( parameters [ j ] is null )
283
281
{
284
282
combinedArgs [ j * 2 + 1 ] = "<null>" ;
285
283
}
286
284
287
285
// Otherwise, if this is an interesting object, add the hash code and type to
288
286
// the format string explicitly.
289
-
290
287
else if ( ! SuppressGeneratedParameters
291
288
&& parameters [ j ] . GetType ( ) != typeof ( string )
292
289
&& parameters [ j ] is not ValueType
@@ -297,19 +294,18 @@ public string Trace(TraceEventType type, int eventId, string message, string[] l
297
294
traceBuilder . Append ( $ "; { labels [ i ] } .Type='{ GetTypeHelper ( parameters [ j ] ) } '") ;
298
295
299
296
// Add the parameter to the combined list.
300
-
301
297
combinedArgs [ j * 2 + 1 ] = parameters [ j ] ;
302
298
}
303
- else // Add the parameter to the combined list.
299
+ // Add the parameter to the combined list.
300
+ else
304
301
{
305
302
combinedArgs [ j * 2 + 1 ] = parameters [ j ] ;
306
303
}
307
304
}
308
305
309
306
// It's OK if we terminate because we have more labels than parameters;
310
307
// 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 )
313
309
{
314
310
TraceExtraMessages ( traceBuilder , parameters . Slice ( j ) ) ;
315
311
}
0 commit comments