18
18
using Microsoft . Build . Framework . Profiler ;
19
19
using System . Collections ;
20
20
using System . Linq ;
21
+ using System . Diagnostics ;
22
+
21
23
#endif
22
24
23
25
#if FEATURE_APPDOMAIN
@@ -270,11 +272,12 @@ internal abstract class LogMessagePacketBase : INodePacket
270
272
/// </summary>
271
273
private static readonly int s_defaultPacketVersion = ( Environment . Version . Major * 10 ) + Environment . Version . Minor ;
272
274
275
+ #if TASKHOST
273
276
/// <summary>
274
277
/// Dictionary of methods used to read BuildEventArgs.
275
278
/// </summary>
276
279
private static Dictionary < LoggingEventType , MethodInfo > s_readMethodCache = new Dictionary < LoggingEventType , MethodInfo > ( ) ;
277
-
280
+ #endif
278
281
/// <summary>
279
282
/// Dictionary of methods used to write BuildEventArgs.
280
283
/// </summary>
@@ -468,16 +471,18 @@ internal void ReadFromStream(ITranslator translator)
468
471
469
472
_buildEvent = GetBuildEventArgFromId ( ) ;
470
473
474
+
471
475
// The other side is telling us whether the event knows how to log itself, or whether we're going to have
472
476
// to do it manually
473
477
int packetVersion = s_defaultPacketVersion ;
474
478
translator . Translate ( ref packetVersion ) ;
475
-
476
479
bool eventCanSerializeItself = true ;
477
480
translator . Translate ( ref eventCanSerializeItself ) ;
478
481
479
482
if ( eventCanSerializeItself )
480
483
{
484
+
485
+ #if TASKHOST
481
486
MethodInfo methodInfo = null ;
482
487
lock ( s_readMethodCache )
483
488
{
@@ -488,10 +493,15 @@ internal void ReadFromStream(ITranslator translator)
488
493
s_readMethodCache . Add ( _eventType , methodInfo ) ;
489
494
}
490
495
}
491
-
492
496
ArgsReaderDelegate readerMethod = ( ArgsReaderDelegate ) CreateDelegateRobust ( typeof ( ArgsReaderDelegate ) , _buildEvent , methodInfo ) ;
493
497
494
498
readerMethod ( translator . Reader , packetVersion ) ;
499
+
500
+ #else
501
+ _buildEvent . PublicCreateFromStream ( translator . Reader , packetVersion ) ;
502
+ #endif
503
+
504
+
495
505
if ( _eventType == LoggingEventType . TargetFinishedEvent && _targetFinishedTranslator != null )
496
506
{
497
507
_targetFinishedTranslator ( translator , ( TargetFinishedEventArgs ) _buildEvent ) ;
0 commit comments