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