void INodeProvider.RegisterNodeLogger(LoggerDescription description) { if (description == null) { throw new ArgumentException("Logger description should be non-null"); } }
/// <summary> /// Register the correct logger and then call the shutdownComponent method. /// This will call shutdown on the loggers, we should expect to see certain exceptions. /// </summary> /// <param name="logger">Logger to register, this will only be used if className is null</param> /// <param name="className">ClassName to instantiate a new distributed logger</param> /// <param name="expectedExceptionType">Exception type which is expected to be thrown</param> private void VerifyShutdownExceptions(ILogger logger, string className, Type expectedExceptionType) { InitializeLoggingService(); if (className != null) { Assembly thisAssembly = Assembly.GetAssembly(typeof(LoggingService_Tests)); string loggerAssemblyName = thisAssembly.FullName; LoggerDescription centralLoggerDescrption = CreateLoggerDescription(className, loggerAssemblyName, true); _initializedService.RegisterDistributedLogger(null, centralLoggerDescrption); } else { _initializedService.RegisterLogger(logger); } try { _initializedService.ShutdownComponent(); Assert.True(false, "No Exceptions Generated"); } catch (Exception e) { if (e.GetType() != expectedExceptionType) { Assert.True(false, "Expected a " + expectedExceptionType + " but got a " + e.GetType() + " Stack:" + e.ToString()); } } }
protected override void ProcessRecord() { base.ProcessRecord(); var loggerParameters = new ConsoleLoggerParameters() { Verbosity = Verbosity, PerformanceSummary = PerformanceSummary, DisableConsoleColor = DisableConsoleColor, DisableMPLogging = DisableMPLogging, EnableMPLogging = EnableMPLogging, ErrorsOnly = ErrorsOnly, ForceConsoleColor = ForceConsoleColor, ForceNoAlign = ForceNoAlign, NoItemAndPropertyList = NoItemAndPropertyList, NoSummary = NoSummary, ShowCommandLine = ShowCommandLine, ShowEventId = ShowEventId, ShowTimestamp = ShowTimestamp, Summary = Summary, WarningsOnly = WarningsOnly }; var logger = new LoggerDescription { Assembly = Assembly, ClassName = PSHost.IsPresent ? PSHostLoggerClassName : PSStreamsLoggerClassName, Parameters = loggerParameters.ToString(), Verbosity = Verbosity }; WriteObject(logger); }
public void RegisterDuplicateForwardingLoggerLogger() { string className = "Microsoft.Build.Logging.ConfigurableForwardingLogger"; LoggerDescription description = CreateLoggerDescription(className, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true); RegularILogger regularILogger = new RegularILogger(); Assert.True(_initializedService.RegisterDistributedLogger(regularILogger, description)); Assert.True(_initializedService.RegisterDistributedLogger(null, description)); Assert.Equal(4, _initializedService.RegisteredLoggerTypeNames.Count); // Verify there are two versions in the type names, one for each description int countForwardingLogger = 0; foreach (string loggerName in _initializedService.RegisteredLoggerTypeNames) { if (String.Compare("Microsoft.Build.Logging.ConfigurableForwardingLogger", loggerName, StringComparison.OrdinalIgnoreCase) == 0) { countForwardingLogger++; } } Assert.Equal(2, countForwardingLogger); Assert.True(_initializedService.RegisteredLoggerTypeNames.Contains("Microsoft.Build.BackEnd.Logging.NullCentralLogger")); Assert.True(_initializedService.RegisteredLoggerTypeNames.Contains("Microsoft.Build.UnitTests.Logging.LoggingService_Tests+RegularILogger")); // Should have 2 sink Assert.NotNull(_initializedService.RegisteredSinkNames); Assert.Equal(2, _initializedService.RegisteredSinkNames.Count); Assert.Equal(2, _initializedService.LoggerDescriptions.Count); }
public void RegisterGoodDistributedAndCentralLogger() { string configurableClassName = "Microsoft.Build.Logging.ConfigurableForwardingLogger"; string distributedClassName = "Microsoft.Build.Logging.DistributedFileLogger"; LoggerDescription configurableDescription = CreateLoggerDescription(configurableClassName, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true); LoggerDescription distributedDescription = CreateLoggerDescription(distributedClassName, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true); DistributedFileLogger fileLogger = new DistributedFileLogger(); RegularILogger regularILogger = new RegularILogger(); Assert.True(_initializedService.RegisterDistributedLogger(regularILogger, configurableDescription)); Assert.True(_initializedService.RegisterDistributedLogger(null, distributedDescription)); Assert.NotNull(_initializedService.RegisteredLoggerTypeNames); // Should have 2 central loggers and 2 forwarding logger Assert.Equal(4, _initializedService.RegisteredLoggerTypeNames.Count); Assert.True(_initializedService.RegisteredLoggerTypeNames.Contains("Microsoft.Build.Logging.ConfigurableForwardingLogger")); Assert.True(_initializedService.RegisteredLoggerTypeNames.Contains("Microsoft.Build.UnitTests.Logging.LoggingService_Tests+RegularILogger")); Assert.True(_initializedService.RegisteredLoggerTypeNames.Contains("Microsoft.Build.Logging.DistributedFileLogger")); Assert.True(_initializedService.RegisteredLoggerTypeNames.Contains("Microsoft.Build.BackEnd.Logging.NullCentralLogger")); // Should have 2 event sink Assert.NotNull(_initializedService.RegisteredSinkNames); Assert.Equal(2, _initializedService.RegisteredSinkNames.Count); Assert.Equal(2, _initializedService.LoggerDescriptions.Count); }
public void LoggerDescriptionCustomSerialization() { string className = "Class"; string loggerAssemblyName = "Class"; string loggerFileAssembly = null; string loggerSwitchParameters = "Class"; LoggerVerbosity verbosity = LoggerVerbosity.Detailed; LoggerDescription description = new LoggerDescription(className, loggerAssemblyName, loggerFileAssembly, loggerSwitchParameters, verbosity); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); BinaryReader reader = new BinaryReader(stream); try { stream.Position = 0; description.WriteToStream(writer); long streamWriteEndPosition = stream.Position; stream.Position = 0; LoggerDescription description2 = new LoggerDescription(); description2.CreateFromStream(reader); long streamReadEndPosition = stream.Position; Assert.Equal(streamWriteEndPosition, streamReadEndPosition); // "Stream end positions should be equal" Assert.Equal(description.Verbosity, description2.Verbosity); // "Expected Verbosity to Match" Assert.Equal(description.LoggerId, description2.LoggerId); // "Expected Verbosity to Match" Assert.Equal(0, string.Compare(description.LoggerSwitchParameters, description2.LoggerSwitchParameters, StringComparison.OrdinalIgnoreCase)); // "Expected LoggerSwitchParameters to Match" Assert.Equal(0, string.Compare(description.Name, description2.Name, StringComparison.OrdinalIgnoreCase)); // "Expected Name to Match" } finally { reader.Close(); writer = null; stream = null; } }
public ILogger CreateLogger(LoggerParameters loggerParameters) { string assemblyName = null; string assemblyFile = null; if (File.Exists(loggerParameters.Assembly)) { assemblyFile = loggerParameters.Assembly; } else { assemblyName = loggerParameters.Assembly; } var loggerDescription = new LoggerDescription( loggerParameters.ClassName, assemblyName, assemblyFile, loggerParameters.Parameters, loggerParameters.Verbosity); var logger = loggerDescription.CreateLogger(); return(Wrap(logger)); }
public void RegisterDistributedLoggerServiceShutdown() { _initializedService.ShutdownComponent(); string className = "Microsoft.Build.Logging.ConfigurableForwardingLogger"; LoggerDescription description = CreateLoggerDescription(className, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true); _initializedService.RegisterDistributedLogger(null, description); }
public void NullForwardingLoggerSink() { string className = "Microsoft.Build.Logging.ConfigurableForwardingLogger"; LoggerDescription description = CreateLoggerDescription(className, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true); _initializedService.ShutdownComponent(); List <LoggerDescription> tempList = new List <LoggerDescription>(); tempList.Add(description); _initializedService.InitializeNodeLoggers(tempList, new EventSourceSink(), 2); }
internal static bool IsPSLogger(LoggerDescription loggerParameters) { var comparision = StringComparison.OrdinalIgnoreCase; var classMatch = typeof(PSHostLogger).FullName.Equals(loggerParameters.ClassName, comparision) || typeof(PSStreamsLogger).FullName.Equals(loggerParameters.ClassName, comparision) || typeof(PSHostLogger).Name.Equals(loggerParameters.ClassName, comparision) || typeof(PSStreamsLogger).Name.Equals(loggerParameters.ClassName, comparision); var assemblyMach = typeof(PSLogger).Assembly.FullName.Equals(loggerParameters.Assembly, comparision); return(assemblyMach && classMatch); }
protected override void ProcessRecord() { base.ProcessRecord(); var logger = new LoggerDescription { Assembly = Assembly, ClassName = ClassName, Parameters = LogFile, Verbosity = LoggerVerbosity.Diagnostic }; WriteObject(logger); }
/// <summary> /// Processes the record. /// </summary> protected override void ProcessRecord() { base.ProcessRecord(); var loggerParameters = new LoggerDescription { ClassName = "Microsoft.Build.Logging.BinaryLogger", Parameters = $"{nameof(ProjectImports)}={ProjectImports};{LogFile}", Assembly = Factory.MSBuildVersion < new Version(15, 3) ? "StructuredLogger" : "Microsoft.Build", Verbosity = LoggerVerbosity.Diagnostic }; WriteObject(loggerParameters); }
protected override void ProcessRecord() { base.ProcessRecord(); var loggerParameters = new LoggerDescription { Assembly = Assembly, ClassName = ClassName, Parameters = Parameters, Verbosity = Verbosity }; WriteObject(loggerParameters); }
public void RegisterDuplicateDistributedCentralLogger() { string className = "Microsoft.Build.Logging.ConfigurableForwardingLogger"; LoggerDescription description = CreateLoggerDescription(className, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true); RegularILogger regularILogger = new RegularILogger(); Assert.True(_initializedService.RegisterDistributedLogger(regularILogger, description)); Assert.False(_initializedService.RegisterDistributedLogger(regularILogger, description)); // Should have 2 central loggers and 1 forwarding logger Assert.Equal(2, _initializedService.RegisteredLoggerTypeNames.Count); Assert.True(_initializedService.RegisteredLoggerTypeNames.Contains("Microsoft.Build.Logging.ConfigurableForwardingLogger")); Assert.True(_initializedService.RegisteredLoggerTypeNames.Contains("Microsoft.Build.UnitTests.Logging.LoggingService_Tests+RegularILogger")); // Should have 1 sink Assert.NotNull(_initializedService.RegisteredSinkNames); Assert.Equal(1, _initializedService.RegisteredSinkNames.Count); Assert.Equal(1, _initializedService.LoggerDescriptions.Count); }
/// <summary> /// Create a logger description from the class name and logger assembly /// This is used in any test which needs to register a distributed logger. /// </summary> /// <param name="loggerClassName">Fully qualified class name (dont for get ParentClass+Nestedclass, if nested)</param> /// <param name="loggerAssemblyName">Assembly name which contains class</param> /// <returns>A logger description which can be registered</returns> private LoggerDescription CreateLoggerDescription(string loggerClassName, string loggerAssemblyName, bool forwardAllEvents) { string eventsToForward = "CustomEvent"; if (forwardAllEvents == true) { eventsToForward = "BuildStartedEvent;BuildFinishedEvent;ProjectStartedEvent;ProjectFinishedEvent;TargetStartedEvent;TargetFinishedEvent;TaskStartedEvent;TaskFinishedEvent;ErrorEvent;WarningEvent;HighMessageEvent;NormalMessageEvent;LowMessageEvent;CustomEvent;CommandLine"; } LoggerDescription centralLoggerDescrption = new LoggerDescription ( loggerClassName, loggerAssemblyName, null /*Not needed as we are loading from current assembly*/, eventsToForward, LoggerVerbosity.Diagnostic /*Not used, but the spirit of the logger is to forward everything so this is the most appropriate verbosity */ ); return(centralLoggerDescrption); }
public void RegisterGoodDistributedAndCentralLoggerTestBuildStartedFinished() { string configurableClassNameA = "Microsoft.Build.Logging.ConfigurableForwardingLogger"; string configurableClassNameB = "Microsoft.Build.Logging.ConfigurableForwardingLogger"; LoggerDescription configurableDescriptionA = CreateLoggerDescription(configurableClassNameA, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, true); LoggerDescription configurableDescriptionB = CreateLoggerDescription(configurableClassNameB, Assembly.GetAssembly(typeof(ProjectCollection)).FullName, false); RegularILogger regularILoggerA = new RegularILogger(); RegularILogger regularILoggerB = new RegularILogger(); RegularILogger regularILoggerC = new RegularILogger(); Assert.True(_initializedService.RegisterDistributedLogger(regularILoggerA, configurableDescriptionA)); Assert.True(_initializedService.RegisterDistributedLogger(regularILoggerB, configurableDescriptionB)); Assert.True(_initializedService.RegisterLogger(regularILoggerC)); Assert.NotNull(_initializedService.RegisteredLoggerTypeNames); _initializedService.LogBuildStarted(); Assert.Equal(1, regularILoggerA.BuildStartedCount); Assert.Equal(1, regularILoggerB.BuildStartedCount); Assert.Equal(1, regularILoggerC.BuildStartedCount); _initializedService.LogBuildFinished(true); Assert.Equal(1, regularILoggerA.BuildFinishedCount); Assert.Equal(1, regularILoggerB.BuildFinishedCount); Assert.Equal(1, regularILoggerC.BuildFinishedCount); // Make sure if we call build started again we only get one other build started event. _initializedService.LogBuildStarted(); Assert.Equal(2, regularILoggerA.BuildStartedCount); Assert.Equal(2, regularILoggerB.BuildStartedCount); Assert.Equal(2, regularILoggerC.BuildStartedCount); // Make sure if we call build started again we only get one other build started event. _initializedService.LogBuildFinished(true); Assert.Equal(2, regularILoggerA.BuildFinishedCount); Assert.Equal(2, regularILoggerB.BuildFinishedCount); Assert.Equal(2, regularILoggerC.BuildFinishedCount); }
/// <summary> /// Registers a distributed logger. /// </summary> /// <param name="centralLogger">The central logger, which resides on the build manager.</param> /// <param name="forwardingLogger">The forwarding logger, which resides on the node.</param> /// <returns>True if successful.</returns> public bool RegisterDistributedLogger(ILogger centralLogger, LoggerDescription forwardingLogger) { throw new NotImplementedException(); }
internal DistributedLoggerRecord(ILogger centralLogger, LoggerDescription forwardingLoggerDescription) { _centralLogger = centralLogger; _forwardingLoggerDescription = forwardingLoggerDescription; }
protected override void ProcessRecord() { WriteDebug("Process record"); var properties = Property?.Cast <DictionaryEntry>().ToDictionary(x => x.Key.ToString(), x => x.Value.ToString()); properties = properties ?? new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); var projects = string.IsNullOrEmpty(Project) ? new[] { SessionState.Path.CurrentFileSystemLocation.Path } : new[] { Project }; var project = MSBuildApp.ProcessProjectSwitch(projects, IgnoreProjectExtensions, Directory.GetFiles); if (!string.IsNullOrEmpty(Configuration)) { properties[nameof(Configuration)] = Configuration; } if (!string.IsNullOrEmpty(Platform)) { properties[nameof(Platform)] = Platform; } _msBuildHelper.Parameters = new InvokeMSBuildParameters { Project = project, Verbosity = Verbosity, ToolsVersion = ToolsVersion, Target = Target, MaxCpuCount = MaxCpuCount, NodeReuse = NodeReuse ?? Environment.GetEnvironmentVariable("MSBUILDDISABLENODEREUSE") != "1", Properties = properties, DetailedSummary = DetailedSummary || Verbosity == LoggerVerbosity.Diagnostic, WarningsAsErrors = WarningsAsErrors == null ? null : new HashSet <string>(WarningsAsErrors, StringComparer.InvariantCultureIgnoreCase), WarningsAsMessages = WarningsAsMessages == null ? null : new HashSet <string>(WarningsAsMessages, StringComparer.InvariantCultureIgnoreCase) }; var loggers = new List <LoggerDescription>(); LoggerDescription consoleLogger; if (Logger != null) { loggers.AddRange(Logger); } var consoleLoggerType = GetConsoleLoggerType(); switch (consoleLoggerType) { case ConsoleLoggerType.PSStreams: consoleLogger = new LoggerDescription { Assembly = NewConsoleLogger.Assembly, ClassName = NewConsoleLogger.PSStreamsLoggerClassName, Parameters = ConsoleLoggerParameters, Verbosity = Verbosity }; break; case ConsoleLoggerType.PSHost: consoleLogger = new LoggerDescription { Assembly = NewConsoleLogger.Assembly, ClassName = NewConsoleLogger.PSHostLoggerClassName, Parameters = ConsoleLoggerParameters, Verbosity = Verbosity }; break; case ConsoleLoggerType.None: consoleLogger = null; break; default: throw new InvalidEnumArgumentException(); } if (consoleLogger != null) { loggers.Add(consoleLogger); } var eventSink = _msBuildHelper.PSEventSink = new PSEventSink(this); _msBuildHelper.Loggers = loggers; try { var asyncResults = ProcessRecordAsync(eventSink); eventSink.ConsumeEvents(); var results = asyncResults.Result; WriteObject(results, true); } catch (Exception ex) { WriteError(new ErrorRecord(ex, "ProcessRecordError", ErrorCategory.NotSpecified, null)); } }
public void TestItemsInandOutOfSharedMemory() { string name = Guid.NewGuid().ToString(); // Create the shared memory buffer SharedMemory readSharedMemory = new SharedMemory ( name, SharedMemoryType.ReadOnly, true ); SharedMemory writeSharedMemory = new SharedMemory ( name, SharedMemoryType.WriteOnly, true ); DualQueue <LocalCallDescriptor> queue = new DualQueue <LocalCallDescriptor>(); DualQueue <LocalCallDescriptor> hiPriQueue = new DualQueue <LocalCallDescriptor>(); LocalCallDescriptorForPostLoggingMessagesToHost LargeLogEvent = CreatePostMessageCallDescriptor(1); LocalCallDescriptorForUpdateNodeSettings updateNodeSettings = new LocalCallDescriptorForUpdateNodeSettings(true, true, true); LocalCallDescriptorForPostBuildResult buildResult = new LocalCallDescriptorForPostBuildResult(CreateBuildResult()); LocalCallDescriptorForPostBuildRequests buildRequests = new LocalCallDescriptorForPostBuildRequests(CreateBuildRequest()); LocalCallDescriptorForRequestStatus requestStatus = new LocalCallDescriptorForRequestStatus(4); LocalCallDescriptorForPostStatus nodeStatusNoExcept = new LocalCallDescriptorForPostStatus(new NodeStatus(1, true, 2, 3, 4, true)); LocalCallDescriptorForPostStatus nodeStatusExcept = new LocalCallDescriptorForPostStatus(new NodeStatus(new Exception("I am bad"))); LocalCallDescriptorForShutdownNode shutdownNode = new LocalCallDescriptorForShutdownNode(Node.NodeShutdownLevel.BuildCompleteSuccess, true); LocalCallDescriptorForShutdownComplete shutdownComplete = new LocalCallDescriptorForShutdownComplete(Node.NodeShutdownLevel.BuildCompleteFailure, 0); LocalCallDescriptorForInitializationComplete initializeComplete = new LocalCallDescriptorForInitializationComplete(99); BuildPropertyGroup propertyGroup = new BuildPropertyGroup(); BuildProperty propertyToAdd = new BuildProperty("PropertyName", "Value"); propertyGroup.SetProperty(propertyToAdd); CacheEntry[] entries = CreateCacheEntries(); LocalCallDescriptorForGettingCacheEntriesFromHost getCacheEntries = new LocalCallDescriptorForGettingCacheEntriesFromHost(new string[] { "Hi", "Hello" }, "Name", propertyGroup, "3.5", CacheContentType.Properties); LocalCallDescriptorForPostingCacheEntriesToHost postCacheEntries = new LocalCallDescriptorForPostingCacheEntriesToHost(entries, "ScopeName", propertyGroup, "3.5", CacheContentType.BuildResults); LocalReplyCallDescriptor replyDescriptor1 = new LocalReplyCallDescriptor(1, entries); LocalReplyCallDescriptor replyDescriptor2 = new LocalReplyCallDescriptor(6, "Foo"); IDictionary environmentVariables = Environment.GetEnvironmentVariables(); Hashtable environmentVariablesHashtable = new Hashtable(environmentVariables); string className = "Class"; string loggerAssemblyName = "Class"; string loggerFileAssembly = null; string loggerSwitchParameters = "Class"; LoggerVerbosity verbosity = LoggerVerbosity.Detailed; LoggerDescription description = new LoggerDescription(className, loggerAssemblyName, loggerFileAssembly, loggerSwitchParameters, verbosity); LocalCallDescriptorForInitializeNode initializeNode = new LocalCallDescriptorForInitializeNode(environmentVariablesHashtable, new LoggerDescription[] { description }, 4, propertyGroup, ToolsetDefinitionLocations.ConfigurationFile, 5, String.Empty); queue.Enqueue(LargeLogEvent); queue.Enqueue(updateNodeSettings); queue.Enqueue(buildResult); queue.Enqueue(buildRequests); queue.Enqueue(requestStatus); queue.Enqueue(nodeStatusNoExcept); queue.Enqueue(nodeStatusExcept); queue.Enqueue(shutdownNode); queue.Enqueue(shutdownComplete); queue.Enqueue(initializeComplete); queue.Enqueue(getCacheEntries); queue.Enqueue(postCacheEntries); queue.Enqueue(replyDescriptor1); queue.Enqueue(replyDescriptor2); queue.Enqueue(initializeNode); writeSharedMemory.Write(queue, hiPriQueue, false); IList localCallDescriptorList = readSharedMemory.Read(); Assert.IsTrue(localCallDescriptorList.Count == 15); LocalCallDescriptorForPostLoggingMessagesToHost messageCallDescriptor = localCallDescriptorList[0] as LocalCallDescriptorForPostLoggingMessagesToHost; VerifyPostMessagesToHost(messageCallDescriptor, 1); LocalCallDescriptorForUpdateNodeSettings updateSettingsCallDescriptor = localCallDescriptorList[1] as LocalCallDescriptorForUpdateNodeSettings; VerifyUpdateSettings(updateSettingsCallDescriptor); LocalCallDescriptorForPostBuildResult buildResultCallDescriptor = localCallDescriptorList[2] as LocalCallDescriptorForPostBuildResult; CompareBuildResult(buildResultCallDescriptor); LocalCallDescriptorForPostBuildRequests buildRequestsCallDescriptor = localCallDescriptorList[3] as LocalCallDescriptorForPostBuildRequests; ComparebuildRequests(buildRequestsCallDescriptor); LocalCallDescriptorForRequestStatus requestStatusCallDescriptor = localCallDescriptorList[4] as LocalCallDescriptorForRequestStatus; Assert.IsTrue(requestStatusCallDescriptor.RequestId == 4); LocalCallDescriptorForPostStatus nodeStatus1CallDescriptor = localCallDescriptorList[5] as LocalCallDescriptorForPostStatus; VerifyNodeStatus1(nodeStatus1CallDescriptor); LocalCallDescriptorForPostStatus nodeStatus2CallDescriptor = localCallDescriptorList[6] as LocalCallDescriptorForPostStatus; VerifyNodeStatus2(nodeStatus2CallDescriptor); LocalCallDescriptorForShutdownNode shutdownNodeCallDescriptor = localCallDescriptorList[7] as LocalCallDescriptorForShutdownNode; Assert.IsTrue(shutdownNodeCallDescriptor.ShutdownLevel == Node.NodeShutdownLevel.BuildCompleteSuccess); Assert.IsTrue(shutdownNodeCallDescriptor.ExitProcess); LocalCallDescriptorForShutdownComplete shutdownNodeCompleteCallDescriptor = localCallDescriptorList[8] as LocalCallDescriptorForShutdownComplete; Assert.IsTrue(shutdownNodeCompleteCallDescriptor.ShutdownLevel == Node.NodeShutdownLevel.BuildCompleteFailure); LocalCallDescriptorForInitializationComplete initializeCompleteCallDescriptor = localCallDescriptorList[9] as LocalCallDescriptorForInitializationComplete; Assert.IsTrue(initializeCompleteCallDescriptor.ProcessId == 99); LocalCallDescriptorForGettingCacheEntriesFromHost getCacheEntriesCallDescriptor = localCallDescriptorList[10] as LocalCallDescriptorForGettingCacheEntriesFromHost; VerifyGetCacheEntryFromHost(getCacheEntriesCallDescriptor); LocalCallDescriptorForPostingCacheEntriesToHost postCacheEntriesCallDescriptor = localCallDescriptorList[11] as LocalCallDescriptorForPostingCacheEntriesToHost; Assert.IsTrue(string.Compare(postCacheEntriesCallDescriptor.ScopeName, "ScopeName", StringComparison.OrdinalIgnoreCase) == 0); Assert.IsTrue(string.Compare(postCacheEntriesCallDescriptor.ScopeProperties["PropertyName"].Value, "Value", StringComparison.OrdinalIgnoreCase) == 0); Assert.IsTrue(string.Compare(postCacheEntriesCallDescriptor.ScopeToolsVersion, "3.5", StringComparison.OrdinalIgnoreCase) == 0); Assert.IsTrue(postCacheEntriesCallDescriptor.ContentType == CacheContentType.BuildResults); VerifyGetCacheEntries(postCacheEntriesCallDescriptor.Entries); LocalReplyCallDescriptor reply1CallDescriptor = localCallDescriptorList[12] as LocalReplyCallDescriptor; Assert.IsTrue(reply1CallDescriptor.RequestingCallNumber == 1); VerifyGetCacheEntries((CacheEntry[])reply1CallDescriptor.ReplyData); LocalReplyCallDescriptor reply2CallDescriptor = localCallDescriptorList[13] as LocalReplyCallDescriptor; Assert.IsTrue(reply2CallDescriptor.RequestingCallNumber == 6); Assert.IsTrue(string.Compare("Foo", (string)reply2CallDescriptor.ReplyData, StringComparison.OrdinalIgnoreCase) == 0); LocalCallDescriptorForInitializeNode initializeCallDescriptor = localCallDescriptorList[14] as LocalCallDescriptorForInitializeNode; Assert.IsTrue(initializeCallDescriptor.ParentProcessId == 5); Assert.IsTrue(initializeCallDescriptor.NodeId == 4); Assert.IsTrue(initializeCallDescriptor.ToolsetSearchLocations == ToolsetDefinitionLocations.ConfigurationFile); Assert.IsTrue(string.Compare(initializeCallDescriptor.ParentGlobalProperties["PropertyName"].Value, "Value", StringComparison.OrdinalIgnoreCase) == 0); Assert.IsTrue(string.Compare(initializeCallDescriptor.NodeLoggers[0].Name, "Class", StringComparison.OrdinalIgnoreCase) == 0); IDictionary variables = Environment.GetEnvironmentVariables(); Assert.IsTrue(variables.Count == initializeCallDescriptor.EnvironmentVariables.Count); foreach (string key in variables.Keys) { Assert.IsTrue(string.Compare((string)initializeCallDescriptor.EnvironmentVariables[key], (string)variables[key], StringComparison.OrdinalIgnoreCase) == 0); } writeSharedMemory.Reset(); readSharedMemory.Reset(); readSharedMemory = null; writeSharedMemory = null; }