@@ -263,10 +263,11 @@ public void RoundtripBuildErrorEventArgs(bool useArguments)
263263 e => string . Join ( ", " , e . RawArguments ?? Array . Empty < object > ( ) ) ) ;
264264 }
265265
266+
266267 [ Theory ]
267268 [ InlineData ( true ) ]
268269 [ InlineData ( false ) ]
269- public void RoundtripExtendedErrorEventArgs_SerializedAsError ( bool useArguments )
270+ public void RoundtripExtendedErrorEventArgs_SerializedAsError ( bool withOptionalData )
270271 {
271272 var args = new ExtendedBuildErrorEventArgs (
272273 "extendedDataType" ,
@@ -281,10 +282,14 @@ public void RoundtripExtendedErrorEventArgs_SerializedAsError(bool useArguments)
281282 "Help" ,
282283 "SenderName" ,
283284 DateTime . Parse ( "9/1/2021 12:02:07 PM" ) ,
284- useArguments ? new object [ ] { "argument0" } : null ) ;
285+ withOptionalData ? new object [ ] { "argument0" } : null )
286+ {
287+ ExtendedData = withOptionalData ? "{'long-json':'mostly-strings'}" : null ,
288+ ExtendedMetadata = withOptionalData ? new Dictionary < string , string > { { "m1" , "v1" } , { "m2" , "v2" } } : null ,
289+ BuildEventContext = withOptionalData ? new BuildEventContext ( 1 , 2 , 3 , 4 , 5 , 6 , 7 ) : null ,
290+ } ;
285291
286- // For now we don't serialize extended data into binary log
287- Roundtrip < BuildErrorEventArgs > ( args ,
292+ Roundtrip ( args ,
288293 e => e . Code ,
289294 e => e . ColumnNumber . ToString ( ) ,
290295 e => e . EndColumnNumber . ToString ( ) ,
@@ -294,6 +299,9 @@ public void RoundtripExtendedErrorEventArgs_SerializedAsError(bool useArguments)
294299 e => e . Message ,
295300 e => e . ProjectFile ,
296301 e => e . Subcategory ,
302+ e => e . ExtendedType ,
303+ e => TranslationHelpers . ToString ( e . ExtendedMetadata ) ,
304+ e => e . ExtendedData ,
297305 e => string . Join ( ", " , e . RawArguments ?? Array . Empty < object > ( ) ) ) ;
298306 }
299307
@@ -332,7 +340,7 @@ public void RoundtripBuildWarningEventArgs(bool useArguments)
332340 [ Theory ]
333341 [ InlineData ( true ) ]
334342 [ InlineData ( false ) ]
335- public void RoundtripExtendedWarningEventArgs_SerializedAsWarning ( bool useArguments )
343+ public void RoundtripExtendedWarningEventArgs_SerializedAsWarning ( bool withOptionalData )
336344 {
337345 var args = new ExtendedBuildWarningEventArgs (
338346 "extendedDataType" ,
@@ -347,10 +355,14 @@ public void RoundtripExtendedWarningEventArgs_SerializedAsWarning(bool useArgume
347355 "Help" ,
348356 "SenderName" ,
349357 DateTime . Parse ( "9/1/2021 12:02:07 PM" ) ,
350- useArguments ? new object [ ] { "argument0" } : null ) ;
358+ withOptionalData ? new object [ ] { "argument0" } : null )
359+ {
360+ ExtendedData = withOptionalData ? "{'long-json':'mostly-strings'}" : null ,
361+ ExtendedMetadata = withOptionalData ? new Dictionary < string , string > { { "m1" , "v1" } , { "m2" , "v2" } } : null ,
362+ BuildEventContext = withOptionalData ? new BuildEventContext ( 1 , 2 , 3 , 4 , 5 , 6 , 7 ) : null ,
363+ } ;
351364
352- // For now we don't serialize extended data into binary log
353- Roundtrip < BuildWarningEventArgs > ( args ,
365+ Roundtrip ( args ,
354366 e => e . Code ,
355367 e => e . ColumnNumber . ToString ( ) ,
356368 e => e . EndColumnNumber . ToString ( ) ,
@@ -360,6 +372,9 @@ public void RoundtripExtendedWarningEventArgs_SerializedAsWarning(bool useArgume
360372 e => e . Message ,
361373 e => e . ProjectFile ,
362374 e => e . Subcategory ,
375+ e => e . ExtendedType ,
376+ e => TranslationHelpers . ToString ( e . ExtendedMetadata ) ,
377+ e => e . ExtendedData ,
363378 e => string . Join ( ", " , e . RawArguments ?? Array . Empty < object > ( ) ) ) ;
364379 }
365380
@@ -400,7 +415,7 @@ public void RoundtripBuildMessageEventArgs(bool useArguments)
400415 [ Theory ]
401416 [ InlineData ( true ) ]
402417 [ InlineData ( false ) ]
403- public void RoundtripExtendedBuildMessageEventArgs_SerializedAsMessage ( bool useArguments )
418+ public void RoundtripExtendedBuildMessageEventArgs_SerializedAsMessage ( bool withOptionalData )
404419 {
405420 var args = new ExtendedBuildMessageEventArgs (
406421 "extendedDataType" ,
@@ -416,9 +431,14 @@ public void RoundtripExtendedBuildMessageEventArgs_SerializedAsMessage(bool useA
416431 "SenderName" ,
417432 MessageImportance . High ,
418433 DateTime . Parse ( "12/12/2015 06:11:56 PM" ) ,
419- useArguments ? new object [ ] { "argument0" } : null ) ;
434+ withOptionalData ? new object [ ] { "argument0" } : null )
435+ {
436+ ExtendedData = withOptionalData ? "{'long-json':'mostly-strings'}" : null ,
437+ ExtendedMetadata = withOptionalData ? new Dictionary < string , string > { { "m1" , "v1" } , { "m2" , "v2" } } : null ,
438+ BuildEventContext = withOptionalData ? new BuildEventContext ( 1 , 2 , 3 , 4 , 5 , 6 , 7 ) : null ,
439+ } ;
420440
421- Roundtrip < BuildMessageEventArgs > ( args ,
441+ Roundtrip ( args ,
422442 e => e . Code ,
423443 e => e . ColumnNumber . ToString ( ) ,
424444 e => e . EndColumnNumber . ToString ( ) ,
@@ -429,6 +449,9 @@ public void RoundtripExtendedBuildMessageEventArgs_SerializedAsMessage(bool useA
429449 e => e . Importance . ToString ( ) ,
430450 e => e . ProjectFile ,
431451 e => e . Subcategory ,
452+ e => e . ExtendedType ,
453+ e => TranslationHelpers . ToString ( e . ExtendedMetadata ) ,
454+ e => e . ExtendedData ,
432455 e => string . Join ( ", " , e . RawArguments ?? Array . Empty < object > ( ) ) ) ;
433456 }
434457
@@ -493,19 +516,21 @@ public void ExtendedCustomBuildEventArgs_SerializedAsMessage(bool withOptionalDa
493516
494517 using var buildEventArgsReader = new BuildEventArgsReader ( binaryReader , BinaryLogger . FileFormatVersion ) ;
495518 var deserialized = buildEventArgsReader . Read ( ) ;
496- BuildMessageEventArgs desArgs = ( BuildMessageEventArgs ) deserialized ;
497-
498- desArgs . ShouldBeOfType ( typeof ( BuildMessageEventArgs ) ) ;
519+ ExtendedBuildMessageEventArgs desArgs = ( ExtendedBuildMessageEventArgs ) deserialized ;
499520
521+ desArgs . ShouldBeOfType ( typeof ( ExtendedBuildMessageEventArgs ) ) ;
500522 desArgs . Message . ShouldBe ( args . Message ) ;
501523 desArgs . HelpKeyword . ShouldBe ( args . HelpKeyword ) ;
502524 desArgs . SenderName . ShouldBe ( args . SenderName ) ;
503525 desArgs . Importance . ShouldBe ( MessageImportance . Normal ) ;
504526 desArgs . Timestamp . ShouldBe ( args . Timestamp ) ;
527+ desArgs . ExtendedType . ShouldBe ( args . ExtendedType ) ;
505528
506529 if ( withOptionalData )
507530 {
508531 desArgs . BuildEventContext . ShouldBe ( args . BuildEventContext ) ;
532+ desArgs . ExtendedData . ShouldBe ( args . ExtendedData ) ;
533+ TranslationHelpers . ToString ( desArgs . ExtendedMetadata ) . ShouldBe ( TranslationHelpers . ToString ( args . ExtendedMetadata ) ) ;
509534 }
510535 else
511536 {
0 commit comments