159 references to CommunicationsUtilities
Microsoft.Build (150)
BackEnd\BuildManager\BuildParameters.cs (7)
281? CommunicationsUtilities.GetEnvironmentVariables() 621internal static int ThreadStackSize => CommunicationsUtilities.GetIntegerVariableOrDefault( 627internal static int EndpointShutdownTimeout => CommunicationsUtilities.GetIntegerVariableOrDefault( 633internal static int EngineShutdownTimeout => CommunicationsUtilities.GetIntegerVariableOrDefault( 645internal static int LoggingThreadShutdownTimeout => CommunicationsUtilities.GetIntegerVariableOrDefault( 651internal static int RequestBuilderShutdownTimeout => CommunicationsUtilities.GetIntegerVariableOrDefault( 1002_buildProcessEnvironment = CommunicationsUtilities.GetEnvironmentVariables();
BackEnd\Client\MSBuildClient.cs (29)
172CommunicationsUtilities.Trace("Executing build with command line '{0}'", descriptiveCommandLine); 183CommunicationsUtilities.Trace("Server was not running. Starting server now."); 195CommunicationsUtilities.Trace("Server is busy, falling back to former behavior."); 210CommunicationsUtilities.Trace("Failed to obtain the current build server state: {0}", ex); 211CommunicationsUtilities.Trace("HResult: {0}.", ex.HResult); 229CommunicationsUtilities.Trace("Build finished."); 255CommunicationsUtilities.Trace("Trying shutdown server node."); 260CommunicationsUtilities.Trace("No need to shutdown server node for it is not running."); 269CommunicationsUtilities.Trace("Server cannot be shut down for it is not idle."); 276CommunicationsUtilities.Trace("Client cannot connect to idle server to shut it down."); 282CommunicationsUtilities.Trace("Failed to send shutdown command to the server."); 297CommunicationsUtilities.Trace("Wait for server to be not busy - will retry soon..."); 369CommunicationsUtilities.Trace("MSBuild client error: problem during packet handling occurred: {0}.", ex); 394CommunicationsUtilities.Trace("MSBuild client warning: problem during querying console buffer width.", ex); 427CommunicationsUtilities.Trace("Command packet of type '{0}' sent...", packet.Type); 431CommunicationsUtilities.Trace("Failed to send command packet of type '{0}' to server: {1}", packet?.Type.ToString() ?? "Unknown", ex); 455CommunicationsUtilities.Trace("Another process launching the msbuild server, falling back to former behavior."); 462CommunicationsUtilities.Trace("Failed to obtain the current build server state: {0}", ex); 463CommunicationsUtilities.Trace("HResult: {0}.", ex.HResult); 476CommunicationsUtilities.Trace("Starting Server..."); 478CommunicationsUtilities.Trace("Server started with PID: {0}", msbuildProcess?.Id); 482CommunicationsUtilities.Trace("Failed to launch the msbuild server: {0}", ex); 496CommunicationsUtilities.Trace("Sending shutdown command to server."); 539return new ServerNodeHandshake(CommunicationsUtilities.GetHandshakeOptions(taskHost: false, architectureFlagToSet: XMakeAttributes.GetCurrentMSBuildArchitecture())); 549CommunicationsUtilities.Trace("MSBuild client sent cancellation command."); 559CommunicationsUtilities.Trace("MSBuild client error: packet pump unexpectedly shut down: {0}", packetPump.PacketPumpException); 604CommunicationsUtilities.Trace("Build response received: exit code '{0}', exit type '{1}'", response.ExitCode, response.ExitType); 630CommunicationsUtilities.Trace("Retrying to connect to server after {0} ms", sw.ElapsedMilliseconds); 638CommunicationsUtilities.Trace("Failed to connect to server: {0}", ex);
BackEnd\Client\MSBuildClientPacketPump.cs (5)
202CommunicationsUtilities.Trace("Entering read loop."); 234CommunicationsUtilities.Trace("Shutdown message pump thread."); 295CommunicationsUtilities.Trace("Packet factory failed to receive package. Exception while deserializing packet {0}.", packetType); 324CommunicationsUtilities.Trace("Exception occurred in the packet pump: {0}", ex); 328CommunicationsUtilities.Trace("Ending read loop.");
BackEnd\Components\Communications\DetouredNodeLauncher.cs (2)
72CommunicationsUtilities.Trace("Launching node from {0}", msbuildLocation); 139CommunicationsUtilities.Trace("Successfully launched {1} node with PID {0}", sp.ProcessId, exeName);
BackEnd\Components\Communications\NodeEndpointOutOfProc.cs (1)
36HandshakeOptions handshakeOptions = CommunicationsUtilities.GetHandshakeOptions(
BackEnd\Components\Communications\NodeLauncher.cs (5)
92CommunicationsUtilities.Trace("Launching node from {0}", msbuildLocation); 125CommunicationsUtilities.Trace( 134CommunicationsUtilities.Trace("Successfully launched {1} node with PID {0}", process.Id, exeName); 167CommunicationsUtilities.Trace( 189CommunicationsUtilities.Trace("Successfully launched {1} node with PID {0}", childProcessId, exeName);
BackEnd\Components\Communications\NodeProviderInProc.cs (1)
406int connectionTimeout = CommunicationsUtilities.NodeConnectionTimeout;
BackEnd\Components\Communications\NodeProviderOutOfProc.cs (4)
72CommunicationsUtilities.Trace("MSBUILDNODEHANDSHAKESALT=\"{0}\", msbuildDirectory=\"{1}\", enableNodeReuse={2}, enableLowPriority={3}", Traits.MSBuildNodeHandshakeSalt, BuildEnvironmentHelper.Instance.MSBuildToolsDirectory32, enableNodeReuse, enableLowPriority); 73return new Handshake(CommunicationsUtilities.GetHandshakeOptions(taskHost: false, architectureFlagToSet: XMakeAttributes.GetCurrentMSBuildArchitecture(), nodeReuse: enableNodeReuse, lowPriority: enableLowPriority)); 99CommunicationsUtilities.Trace("Starting to acquire {1} new or existing node(s) to establish nodes from ID {0} to {2}...", nextNodeId, numberOfNodesToCreate, nextNodeId + numberOfNodesToCreate - 1); 101Handshake hostHandshake = new(CommunicationsUtilities.GetHandshakeOptions(taskHost: false, architectureFlagToSet: XMakeAttributes.GetCurrentMSBuildArchitecture(), nodeReuse: ComponentHost.BuildParameters.EnableNodeReuse, lowPriority: ComponentHost.BuildParameters.LowPriority));
BackEnd\Components\Communications\NodeProviderOutOfProcBase.cs (30)
175CommunicationsUtilities.Trace("Shutting down node with pid = {0}", nodeProcess.Id); 234CommunicationsUtilities.Trace("Attempting to connect to {1} existing processes '{0}'...", expectedProcessName, possibleRunningNodesList.Count); 248CommunicationsUtilities.Trace("FAILED TO CONNECT TO A CHILD NODE"); 268CommunicationsUtilities.Trace("Trying to connect to existing process {2} with id {1} to establish node {0}...", nodeId, nodeToReuse.Id, nodeToReuse.ProcessName); 289CommunicationsUtilities.Trace("Successfully connected to existed node {0} which is PID {1}", nodeId, nodeToReuse.Id); 307CommunicationsUtilities.Trace("Could not connect to existing process, now creating a process..."); 325CommunicationsUtilities.Trace( 349CommunicationsUtilities.Trace("Successfully connected to created node {0} which is PID {1}", nodeId, msbuildProcess.Id); 361CommunicationsUtilities.Trace("Could not connect to node with PID {0}; it has exited with exit code {1}. This can indicate a crash at startup", msbuildProcess.Id, msbuildProcess.ExitCode); 367CommunicationsUtilities.Trace("Could not connect to node with PID {0}; it has exited with unknown exit code. This can indicate a crash at startup", msbuildProcess.Id); 373CommunicationsUtilities.Trace("Could not connect to node with PID {0}; it is still running. This can occur when two multiprocess builds run in parallel and the other one 'stole' this node", msbuildProcess.Id); 439CommunicationsUtilities.Trace("The remote pipe owner {0} does not match {1}", remoteOwner.Value, identifier.Value); 464CommunicationsUtilities.Trace("Attempting connect to PID {0} with pipe {1} with timeout {2} ms", nodeProcessId, pipeName, timeout); 478CommunicationsUtilities.Trace("Failed to connect to pipe {0}. {1}", pipeName, e.Message.TrimEnd()); 513CommunicationsUtilities.Trace("Writing handshake part {0} ({1}) to pipe {2}", i, handshakeComponents[i], pipeName); 520CommunicationsUtilities.Trace("Reading handshake from pipe {0}", pipeName); 528CommunicationsUtilities.Trace("Successfully connected to pipe {0}...!", pipeName); 789CommunicationsUtilities.Trace(context._nodeId, "EXCEPTION in SendData: {0}", e); 851CommunicationsUtilities.Trace("Waiting for node with pid = {0} to exit", _process.Id); 879CommunicationsUtilities.Trace("Killing node with pid = {0}", _process.Id); 905CommunicationsUtilities.Trace(_nodeId, "COMMUNICATIONS ERROR (HRC) Node: {0} Process: {1} Bytes Read: {2} Expected: {3}", _nodeId, _process.Id, bytesRead, _headerByte.Length); 910CommunicationsUtilities.Trace(_nodeId, " Child Process {0} has exited.", _process.Id); 914CommunicationsUtilities.Trace(_nodeId, " Child Process {0} is still running.", _process.Id); 919CommunicationsUtilities.Trace(_nodeId, "Unable to retrieve remote process information. {0}", e); 948CommunicationsUtilities.Trace(_nodeId, "Hit CLR bug #825607: called back twice on same async result; ignoring"); 959CommunicationsUtilities.Trace(_nodeId, "EXCEPTION in HeaderReadComplete: {0}", e); 981CommunicationsUtilities.Trace(_nodeId, "Bad packet read for packet {0} - Expected {1} bytes, got {2}", packetType, packetLength, bytesRead); 1003CommunicationsUtilities.Trace(_nodeId, "EXCEPTION in ReadAndRoutPacket: {0}", e); 1034CommunicationsUtilities.Trace(_nodeId, "Hit CLR bug #825607: called back twice on same async result; ignoring"); 1045CommunicationsUtilities.Trace(_nodeId, "EXCEPTION in BodyReadComplete (Reading): {0}", e);
BackEnd\Components\Communications\NodeProviderOutOfProcTaskHost.cs (1)
561CommunicationsUtilities.Trace("For a host context of {0}, spawning executable from {1}.", hostContext.ToString(), msbuildLocation ?? "MSBuild.exe");
BackEnd\Components\RequestBuilder\RequestBuilder.cs (3)
906entryToComplete.RequestConfiguration.SavedEnvironmentVariables = CommunicationsUtilities.GetEnvironmentVariables(); 1337_requestEntry.RequestConfiguration.SavedEnvironmentVariables = CommunicationsUtilities.GetEnvironmentVariables(); 1404IDictionary<string, string> currentEnvironment = CommunicationsUtilities.GetEnvironmentVariables();
BackEnd\Node\InProcNode.cs (2)
349CommunicationsUtilities.SetEnvironment(_savedEnvironment); 475_savedEnvironment = CommunicationsUtilities.GetEnvironmentVariables();
BackEnd\Node\OutOfProcNode.cs (5)
457CommunicationsUtilities.Trace("Shutting down with reason: {0}, and exception: {1}.", _shutdownReason, _shutdownException); 496CommunicationsUtilities.SetEnvironment(_savedEnvironment); 500CommunicationsUtilities.Trace("Failed to restore the original environment: {0}.", ex); 537CommunicationsUtilities.Trace("Shut down complete."); 712_savedEnvironment = CommunicationsUtilities.GetEnvironmentVariables();
BackEnd\Node\OutOfProcServerNode.cs (7)
102CommunicationsUtilities.GetHandshakeOptions(taskHost: false, architectureFlagToSet: XMakeAttributes.GetCurrentMSBuildArchitecture())); 108CommunicationsUtilities.Trace("Starting new server node with handshake {0}", handshake); 256CommunicationsUtilities.Trace("Shutting down with reason: {0}, and exception: {1}.", _shutdownReason, _shutdownException); 267CommunicationsUtilities.Trace("Shut down complete."); 333CommunicationsUtilities.Trace("Received request to cancel build running on MSBuild Server. MSBuild server will shutdown.}"); 357CommunicationsUtilities.Trace("Building with MSBuild server with command line {0}", command.CommandLine); 373CommunicationsUtilities.SetEnvironment(command.BuildProcessEnvironment);
CommunicationsUtilities.cs (21)
96const int handshakeVersion = (int)CommunicationsUtilities.handshakeVersion; 101CommunicationsUtilities.Trace("Building handshake for node type {0}, (version {1}): options {2}.", nodeType, handshakeVersion, options); 104CommunicationsUtilities.Trace("Handshake salt is {0}", handshakeSalt); 106CommunicationsUtilities.Trace("Tools directory root is {0}", toolsDirectory); 107salt = CommunicationsUtilities.GetHashCode($"{handshakeSalt}{toolsDirectory}"); 127CommunicationsUtilities.AvoidEndOfHandshakeSignal(options), 128CommunicationsUtilities.AvoidEndOfHandshakeSignal(salt), 129CommunicationsUtilities.AvoidEndOfHandshakeSignal(fileVersionMajor), 130CommunicationsUtilities.AvoidEndOfHandshakeSignal(fileVersionMinor), 131CommunicationsUtilities.AvoidEndOfHandshakeSignal(fileVersionBuild), 132CommunicationsUtilities.AvoidEndOfHandshakeSignal(fileVersionPrivate), 133CommunicationsUtilities.AvoidEndOfHandshakeSignal(sessionId) 139public virtual byte? ExpectedVersionInFirstByte => CommunicationsUtilities.handshakeVersion; 160CommunicationsUtilities.AvoidEndOfHandshakeSignal(options), 161CommunicationsUtilities.AvoidEndOfHandshakeSignal(salt), 162CommunicationsUtilities.AvoidEndOfHandshakeSignal(fileVersionMajor), 163CommunicationsUtilities.AvoidEndOfHandshakeSignal(fileVersionMinor), 164CommunicationsUtilities.AvoidEndOfHandshakeSignal(fileVersionBuild), 165CommunicationsUtilities.AvoidEndOfHandshakeSignal(fileVersionPrivate), 501CommunicationsUtilities.Trace("Handshake failed on part {0}. Probably the client is a different MSBuild build.", valueRead); 505CommunicationsUtilities.Trace("Expected end of handshake signal but received {0}. Probably the host is a different MSBuild build.", valueRead);
Evaluation\IntrinsicFunctions.cs (3)
435=> CommunicationsUtilities.GetHashCode(toHash); 449StringHashingAlgorithm.Legacy => CommunicationsUtilities.GetHashCode(toHash), 509HandshakeOptions desiredContext = CommunicationsUtilities.GetHandshakeOptions(taskHost: true, taskHostParameters: parameters);
Instance\TaskFactories\TaskHostTask.cs (3)
271CommunicationsUtilities.GetEnvironmentVariables(), 294_requiredContext = CommunicationsUtilities.GetHandshakeOptions(taskHost: true, taskHostParameters: _taskHostParameters); 465CommunicationsUtilities.SetEnvironment(taskHostTaskComplete.BuildProcessEnvironment);
NodeEndpointOutOfProcBase.cs (20)
275CommunicationsUtilities.Trace("Changing link status from {0} to {1}", _status.ToString(), newStatus.ToString()); 366int waitTimeRemaining = Math.Max(0, CommunicationsUtilities.NodeConnectionTimeout - (int)usedWaitTime.TotalMilliseconds); 373CommunicationsUtilities.Trace("Waiting for connection {0} ms...", waitTimeRemaining); 382CommunicationsUtilities.Trace("Connection timed out waiting a host to contact us. Exiting comm thread."); 387CommunicationsUtilities.Trace("Parent started connecting. Reading handshake from parent"); 403byteToAccept: i == 0 ? (byte?)CommunicationsUtilities.handshakeVersion : null /* this will disconnect a < 16.8 host; it expects leading 00 or F5 or 06. 0x00 is a wildcard */ 412CommunicationsUtilities.Trace("Handshake failed. Received {0} from host not {1}. Probably the host is a different MSBuild build.", handshakePart, handshakeComponents[i]); 427CommunicationsUtilities.Trace("Successfully connected to parent."); 440CommunicationsUtilities.Trace("Handshake failed. Host user is {0} but we were created by {1}.", (clientIdentity == null) ? "<unknown>" : clientIdentity.Name, currentIdentity.Name); 454CommunicationsUtilities.Trace("Client connection failed but we will wait for another connection. Exception: {0}", e.Message); 476CommunicationsUtilities.Trace("Client connection failed. Exiting comm thread. {0}", e); 493CommunicationsUtilities.Trace("Ending read loop"); 522CommunicationsUtilities.Trace("Entering read loop."); 565CommunicationsUtilities.Trace("Exception reading from server. {0}", e); 579CommunicationsUtilities.Trace("Parent disconnected gracefully."); 586CommunicationsUtilities.Trace("Parent disconnected abruptly."); 592CommunicationsUtilities.Trace("Incomplete header read from server. {0} of {1} bytes read", bytesRead, headerByte.Length); 609CommunicationsUtilities.Trace("Exception while deserializing packet {0}: {1}", packetType, e); 666CommunicationsUtilities.Trace("Exception while serializing packets: {0}", e); 675CommunicationsUtilities.Trace("Disconnecting voluntarily");
Utilities\Utilities.cs (1)
474IDictionary<string, string> environmentVariablesBag = CommunicationsUtilities.GetEnvironmentVariables();
Microsoft.Build.Engine.UnitTests (9)
CommunicationUtilities_Tests.cs (9)
9using CommunicationsUtilities = Microsoft.Build.Internal.CommunicationsUtilities; 21IDictionary<string, string> envVars = CommunicationsUtilities.GetEnvironmentVariables(); 45CommunicationsUtilities.SetEnvironmentVariable(testName1, testValue); 48IDictionary<string, string> envVars = CommunicationsUtilities.GetEnvironmentVariables(); 50CommunicationsUtilities.SetEnvironmentVariable(testName1, null); 51CommunicationsUtilities.SetEnvironmentVariable(testName2, testValue); 53CommunicationsUtilities.SetEnvironment(envVars); 60CommunicationsUtilities.SetEnvironmentVariable(testName1, null); 61CommunicationsUtilities.SetEnvironmentVariable(testName2, null);