@@ -434,6 +434,8 @@ private unsafe void WriteMultiMergeInner(
434434 var pinCount = eventTypes . pinCount ;
435435 var scratch = stackalloc byte [ eventTypes . scratchSize ] ;
436436 var descriptors = stackalloc EventData [ eventTypes . dataCount + 3 ] ;
437+ for ( int i = 0 ; i < eventTypes . dataCount + 3 ; i ++ )
438+ descriptors [ i ] = default ( EventData ) ;
437439
438440 var pins = stackalloc GCHandle [ pinCount ] ;
439441 for ( int i = 0 ; i < pinCount ; i ++ )
@@ -538,7 +540,10 @@ internal unsafe void WriteMultiMerge(
538540
539541 // We make a descriptor for each EventData, and because we morph strings to counted strings
540542 // we may have 2 for each arg, so we allocate enough for this.
541- var descriptors = stackalloc EventData [ eventTypes . dataCount + eventTypes . typeInfos . Length * 2 + 3 ] ;
543+ var descriptorsLength = eventTypes . dataCount + eventTypes . typeInfos . Length * 2 + 3 ;
544+ var descriptors = stackalloc EventData [ descriptorsLength ] ;
545+ for ( int i = 0 ; i < descriptorsLength ; i ++ )
546+ descriptors [ i ] = default ( EventData ) ;
542547
543548 fixed ( byte *
544549 pMetadata0 = this . providerMetadata ,
@@ -614,6 +619,8 @@ private unsafe void WriteImpl(
614619 var pinCount = eventTypes . pinCount ;
615620 var scratch = stackalloc byte [ eventTypes . scratchSize ] ;
616621 var descriptors = stackalloc EventData [ eventTypes . dataCount + 3 ] ;
622+ for ( int i = 0 ; i < eventTypes . dataCount + 3 ; i ++ )
623+ descriptors [ i ] = default ( EventData ) ;
617624
618625 var pins = stackalloc GCHandle [ pinCount ] ;
619626 for ( int i = 0 ; i < pinCount ; i ++ )
0 commit comments