3 instantiations of Traits
Microsoft.Build.Framework (3)
Traits.cs (3)
16private static Traits _instance = new Traits(); 23return new Traits(); 142_instance = new Traits();
140 references to Traits
Microsoft.Build (86)
BackEnd\BuildManager\BuildManager.cs (3)
491if (Traits.Instance.DebugEngine) 663Traits.Instance.DebugEngine is false) 1982if (Traits.Instance.DebugEngine is false)
BackEnd\Client\MSBuildClient.cs (1)
516envVars.Remove(Traits.UseMSBuildServerEnvVarName);
BackEnd\Components\BuildRequestEngine\BuildRequestEngine.cs (1)
123_debugDumpState = Traits.Instance.DebugScheduler;
BackEnd\Components\Communications\NodeLauncher.cs (6)
68if (Traits.Instance.EscapeHatches.EnsureStdOutForChildNodesIsPrimaryStdout) 75if (!Traits.Instance.EscapeHatches.EnsureStdOutForChildNodesIsPrimaryStdout) 106if (!Traits.Instance.EscapeHatches.EnsureStdOutForChildNodesIsPrimaryStdout) 196string useMSBuildServerEnvVarValue = Environment.GetEnvironmentVariable(Traits.UseMSBuildServerEnvVarName); 201Environment.SetEnvironmentVariable(Traits.UseMSBuildServerEnvVarName, "0"); 209Environment.SetEnvironmentVariable(Traits.UseMSBuildServerEnvVarName, useMSBuildServerEnvVarValue);
BackEnd\Components\Communications\NodeProviderOutOfProc.cs (1)
72CommunicationsUtilities.Trace("MSBUILDNODEHANDSHAKESALT=\"{0}\", msbuildDirectory=\"{1}\", enableNodeReuse={2}, enableLowPriority={3}", Traits.MSBuildNodeHandshakeSalt, BuildEnvironmentHelper.Instance.MSBuildToolsDirectory32, enableNodeReuse, enableLowPriority);
BackEnd\Components\Communications\NodeProviderOutOfProcBase.cs (2)
116Traits.Instance.EscapeHatches.EnsureStdOutForChildNodesIsPrimaryStdout; 356if (Traits.Instance.DebugNodeCommunication)
BackEnd\Components\Logging\LoggingService.cs (2)
569bool? escapeHatch = Traits.Instance.EscapeHatches.LogPropertiesAndItemsAfterEvaluation; 987&& Traits.Instance.EscapeHatches.EnableWarningOnCustomBuildEvent)
BackEnd\Components\Logging\ProjectLoggingContext.cs (1)
212else if (Traits.LogAllEnvironmentVariables)
BackEnd\Components\RequestBuilder\AssemblyLoadsTracker.cs (1)
110!Traits.Instance.LogAllAssemblyLoads &&
BackEnd\Components\RequestBuilder\IntrinsicTasks\ItemGroupLoggingHelper.cs (1)
124bool truncateTaskInputs = Traits.Instance.EscapeHatches.TruncateTaskInputs;
BackEnd\Components\RequestBuilder\TaskHost.cs (1)
128_disableInprocNode = Traits.Instance.InProcNodeDisabled || host.BuildParameters.DisableInProcNode;
BackEnd\Components\Scheduler\Scheduler.cs (2)
147=> Traits.Instance.InProcNodeDisabled || _componentHost.BuildParameters.DisableInProcNode; 183_debugDumpState = Traits.Instance.DebugScheduler;
BackEnd\Components\Scheduler\SchedulingPlan.cs (1)
220if (Traits.Instance.DebugScheduler)
BackEnd\Components\SdkResolution\CachingSdkResolverService.cs (1)
46if (Traits.Instance.EscapeHatches.DisableSdkResolutionCache)
BackEnd\Node\OutOfProcNode.cs (3)
490Traits.UpdateFromEnvironment(); 589&& Traits.Instance.EscapeHatches.EnableWarningOnCustomBuildEvent) 728Traits.UpdateFromEnvironment();
BackEnd\Node\OutOfProcServerNode.cs (1)
366Traits.UpdateFromEnvironment();
BackEnd\Shared\BuildResult.cs (1)
86private int _version = Traits.Instance.EscapeHatches.DoNotVersionBuildResult ? 0 : 1;
BackEnd\TaskExecutionHost\TaskExecutionHost.cs (1)
173LogTaskInputs = Traits.Instance.EscapeHatches.LogTaskInputs;
BuildCheck\Infrastructure\CheckWrapper.cs (1)
38private readonly bool _limitReportsNumber = !Traits.Instance.EscapeHatches.DoNotLimitBuildCheckResultsNumber;
CommunicationsUtilities.cs (1)
213private static bool s_trace = Traits.Instance.DebugNodeCommunication;
Construction\Solution\SolutionProjectGenerator.cs (2)
188_batchProjectTargets = Traits.Instance.SolutionBatchTargets; 1030if (Traits.Instance.EmitSolutionMetaproj)
CoreCLRAssemblyLoader.cs (1)
58if (Traits.Instance.EscapeHatches.UseSingleLoadContext)
DebugUtils.cs (1)
35if (Traits.Instance.DebugEngine)
Definition\Project.cs (1)
3796var canEvaluateElementsWithFalseConditions = Traits.Instance.EscapeHatches.EvaluateElementsWithFalseConditionInProjectEvaluation ?? !loadSettings.HasFlag(ProjectLoadSettings.DoNotEvaluateElementsWithFalseCondition);
Definition\ProjectCollection.cs (1)
309if (Traits.Instance.UseSimpleProjectRootElementCacheConcurrency)
Definition\ProjectProperty.cs (2)
106if (this is EnvironmentDerivedProjectProperty environmentProperty && environmentProperty.loggingContext is { IsValid: true } loggingContext && !environmentProperty._loggedEnvProperty && !Traits.LogAllEnvironmentVariables) 125if (this is EnvironmentDerivedProjectProperty environmentProperty && environmentProperty.loggingContext is { IsValid: true } loggingContext && !environmentProperty._loggedEnvProperty && !Traits.LogAllEnvironmentVariables)
Definition\Toolset.cs (1)
913Traits.Instance.ForceEvaluateAsFullFramework ? "Full" : "Core",
Evaluation\Evaluator.cs (10)
228data = new PropertyTrackingEvaluatorDataWrapper<P, I, M, D>(data, _evaluationLoggingContext, Traits.Instance.LogPropertyTracking); 349properties = Traits.LogAllEnvironmentVariables ? evaluator._data.Properties : evaluator.FilterOutEnvironmentDerivedProperties(evaluator._data.Properties); 627_logProjectImportedEvents = Traits.Instance.EscapeHatches.LogProjectImports; 790if (Traits.Instance.EscapeHatches.DebugEvaluation) 868if (!Traits.Instance.EscapeHatches.IgnoreTreatAsLocalProperty) 1113_evaluationLoggingContext.LogWarning("", new BuildEventFileInfo(""), "ChangeWave_InvalidFormat", Traits.Instance.MSBuildDisableFeaturesFromVersion, $"[{String.Join(", ", ChangeWaves.AllWaves.Select(x => x.ToString()))}]"); 1116_evaluationLoggingContext.LogWarning("", new BuildEventFileInfo(""), "ChangeWave_OutOfRotation", ChangeWaves.DisabledWave, Traits.Instance.MSBuildDisableFeaturesFromVersion, $"[{String.Join(", ", ChangeWaves.AllWaves.Select(x => x.ToString()))}]"); 1154Traits.Instance.ForceEvaluateAsFullFramework ? "Full" : "Core"); 1743Traits.Instance.EscapeHatches.SdkReferencePropertyExpansion ?? 2249if (((_loadSettings & ProjectLoadSettings.IgnoreEmptyImports) != 0 || Traits.Instance.EscapeHatches.IgnoreEmptyImports) && ProjectRootElement.IsEmptyXmlFile(importFileUnescaped))
Evaluation\Expander.cs (5)
697return (options & ExpanderOptions.Truncate) != 0 && !Traits.Instance.EscapeHatches.DoNotTruncateConditions; 2314if (Traits.Instance.UseLazyWildCardEvaluation) 4591if (Traits.Instance.LogPropertyFunctionsRequiringReflection) 5530if (Traits.Instance.EnableAllPropertyFunctions) 5542if (Traits.Instance.EnableAllPropertyFunctions)
Evaluation\LazyItemEvaluator.cs (2)
42private Dictionary<string, LazyItemList> _itemLists = Traits.Instance.EscapeHatches.UseCaseSensitiveItemNames ? 468public ImmutableDictionary<string, LazyItemList>.Builder ReferencedItemLists { get; } = Traits.Instance.EscapeHatches.UseCaseSensitiveItemNames ?
Evaluation\LazyItemEvaluator.IncludeOperation.cs (1)
96bool skipGlob = !_conditionResult && globFragment.IsFullFileSystemScan && !Traits.Instance.EscapeHatches.AlwaysEvaluateDangerousGlobs;
Evaluation\LazyItemEvaluator.RemoveOperation.cs (1)
62if (listBuilder.Count >= Traits.Instance.DictionaryBasedItemRemoveThreshold)
Evaluation\LazyItemEvaluator.UpdateOperation.cs (1)
116&& !Traits.Instance.EscapeHatches.DoNotExpandQualifiedMetadataInUpdateOperation)
Evaluation\ProjectRootElementCache.cs (1)
179if (!Traits.Instance.EscapeHatches.AlwaysDoImmutableFilesUpToDateCheck && FileClassifier.Shared.IsNonModifiable(projectFile))
Evaluation\PropertiesUseTracker.cs (1)
33private bool _warnForUninitializedProperties = BuildParameters.WarnOnUninitializedProperty || Traits.Instance.EscapeHatches.WarnOnUninitializedProperty;
FileMatcher.cs (2)
102if (Traits.Instance.MSBuildCacheFileEnumerations) 2113if (logDriveEnumeratingWildcard && Traits.Instance.ThrowOnDriveEnumeratingWildcard)
FileUtilities.cs (3)
1000return Traits.Instance.CacheFileExistence 1024return Traits.Instance.CacheFileExistence 1048return Traits.Instance.CacheFileExistence
Instance\ProjectInstance.cs (2)
2383var forcedProjectInstanceTranslationMode = Traits.Instance.EscapeHatches.ProjectInstanceTranslation; 3162if (Traits.Instance.EscapeHatches.DebugEvaluation)
Instance\ProjectPropertyInstance.cs (2)
102if (this is EnvironmentDerivedProjectPropertyInstance envProperty && envProperty.loggingContext?.IsValid == true && !envProperty._loggedEnvProperty && !Traits.LogAllEnvironmentVariables) 116if (this is EnvironmentDerivedProjectPropertyInstance envProperty && envProperty.loggingContext?.IsValid == true && !envProperty._loggedEnvProperty && !Traits.LogAllEnvironmentVariables)
Logging\BaseConsoleLogger.cs (3)
884Traits.LogAllEnvironmentVariables = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MSBUILDLOGALLENVIRONMENTVARIABLES")); 953bool logPropertiesAndItemsAfterEvaluation = Traits.Instance.EscapeHatches.LogPropertiesAndItemsAfterEvaluation ?? true; 994Traits.LogAllEnvironmentVariables = true;
Logging\BinaryLogger\BinaryLogger.cs (4)
165_initialLogImports = Traits.Instance.EscapeHatches.LogProjectImports; 172Traits.Instance.EscapeHatches.LogProjectImports = true; 173bool logPropertiesAndItemsAfterEvaluation = Traits.Instance.EscapeHatches.LogPropertiesAndItemsAfterEvaluation ?? true; 319Traits.Instance.EscapeHatches.LogProjectImports = _initialLogImports;
Logging\BinaryLogger\BuildEventArgsWriter.cs (1)
292if (Traits.LogAllEnvironmentVariables)
Logging\ParallelLogger\ParallelConsoleLogger.cs (1)
234if (Traits.LogAllEnvironmentVariables)
Logging\SerialConsoleLogger.cs (1)
107if (Traits.LogAllEnvironmentVariables)
Utilities\EngineFileUtilities.cs (4)
29if (Traits.Instance.UseLazyWildCardEvaluation) 209if (Traits.Instance.LogExpandedWildcards) 294if (logDriveEnumeratingWildcard && Traits.Instance.ThrowOnDriveEnumeratingWildcard) 551return Traits.Instance.UseLazyWildCardEvaluation && !forceEvaluateWildCards && MatchesLazyWildcard(filespecEscaped);
Microsoft.Build.Engine.OM.UnitTests (4)
DebugUtils.cs (1)
35if (Traits.Instance.DebugEngine)
FileUtilities.cs (3)
1000return Traits.Instance.CacheFileExistence 1024return Traits.Instance.CacheFileExistence 1048return Traits.Instance.CacheFileExistence
Microsoft.Build.Engine.UnitTests (3)
BackEnd\ResultsCache_Tests.cs (1)
424Traits.UpdateFromEnvironment();
BuildEventArgsSerialization_Tests.cs (2)
59Traits.LogAllEnvironmentVariables = serializeAllEnvironmentVariables; 82Traits.LogAllEnvironmentVariables = false;
Microsoft.Build.Framework (6)
NativeMethods.cs (4)
593bool isMaxPathRestricted = Traits.Instance.EscapeHatches.DisableLongPaths || IsMaxPathLegacyWindows(); 1157if (Traits.Instance.EscapeHatches.AlwaysDoImmutableFilesUpToDateCheck) 1189if (Traits.Instance.EscapeHatches.AlwaysUseContentTimestamp) 1203if ((data.fileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) == FILE_ATTRIBUTE_REPARSE_POINT && !Traits.Instance.EscapeHatches.UseSymlinkTimeInsteadOfTargetTime)
Traits.cs (2)
16private static Traits _instance = new Traits(); 17public static Traits Instance
Microsoft.Build.Tasks.Core (13)
AssemblyDependency\ReferenceTable.cs (1)
3026if (!Traits.Instance.EscapeHatches.TargetPathForRelatedFiles)
AssemblyDependency\ResolveAssemblyReference.cs (1)
2372Traits.Instance.EscapeHatches.CacheAssemblyInformation
Copy.cs (2)
290if (!Traits.Instance.EscapeHatches.CopyWithoutDelete && 1054int parallelism = Traits.Instance.CopyTaskParallelism;
CreateItem.cs (1)
170if (logDriveEnumeratingWildcard && Traits.Instance.ThrowOnDriveEnumeratingWildcard)
DebugUtils.cs (1)
35if (Traits.Instance.DebugEngine)
Exec.cs (1)
591if (!Traits.Instance.EscapeHatches.UseAutoRunWhenLaunchingProcessUnderCmd)
FileMatcher.cs (2)
102if (Traits.Instance.MSBuildCacheFileEnumerations) 2113if (logDriveEnumeratingWildcard && Traits.Instance.ThrowOnDriveEnumeratingWildcard)
FileUtilities.cs (3)
1000return Traits.Instance.CacheFileExistence 1024return Traits.Instance.CacheFileExistence 1048return Traits.Instance.CacheFileExistence
GenerateResource.cs (1)
3023if (Traits.Instance.EscapeHatches.UseMinimalResxParsingInCoreScenarios)
Microsoft.Build.UnitTests.Shared (1)
RunnerUtilities.cs (1)
147if (Traits.Instance.DebugUnitTests)
Microsoft.Build.Utilities.Core (9)
DebugUtils.cs (1)
35if (Traits.Instance.DebugEngine)
FileMatcher.cs (2)
102if (Traits.Instance.MSBuildCacheFileEnumerations) 2113if (logDriveEnumeratingWildcard && Traits.Instance.ThrowOnDriveEnumeratingWildcard)
FileUtilities.cs (3)
1000return Traits.Instance.CacheFileExistence 1024return Traits.Instance.CacheFileExistence 1048return Traits.Instance.CacheFileExistence
MuxLogger.cs (1)
865Traits.LogAllEnvironmentVariables ? _buildStartedEvent.BuildEnvironment : _buildStartedEvent.BuildEnvironment?.Where(kvp => EnvironmentUtilities.IsWellKnownEnvironmentDerivedProperty(kvp.Key)).ToDictionary(kvp => kvp.Key, kvp => kvp.Value));
ToolTask.cs (2)
1434if (Traits.Instance.EscapeHatches.AvoidUnicodeWhenWritingToolTaskBatch) 1472commandLineCommands = $"{(Traits.Instance.EscapeHatches.UseAutoRunWhenLaunchingProcessUnderCmd ? string.Empty : "/D ")}/C \"{batchFileForCommandLine}\"";
MSBuild (18)
CommandLineSwitches.cs (1)
716if (!unquoteParameter || !Traits.Instance.EscapeHatches.UnquoteTargetSwitchParameters)
CommunicationsUtilities.cs (1)
213private static bool s_trace = Traits.Instance.DebugNodeCommunication;
DebugUtils.cs (1)
35if (Traits.Instance.DebugEngine)
FileUtilities.cs (3)
1000return Traits.Instance.CacheFileExistence 1024return Traits.Instance.CacheFileExistence 1048return Traits.Instance.CacheFileExistence
OutOfProcTaskHostNode.cs (2)
185_debugCommunications = Traits.Instance.DebugNodeCommunication; 801_shutdownReason = buildComplete.PrepareForReuse && Traits.Instance.EscapeHatches.ReuseTaskHostNodes ? NodeEngineShutdownReason.BuildCompleteReuse : NodeEngineShutdownReason.BuildComplete;
XMake.cs (10)
261Environment.GetEnvironmentVariable(Traits.UseMSBuildServerEnvVarName) == "1" && 262!Traits.Instance.EscapeHatches.EnsureStdOutForChildNodesIsPrimaryStdout && 720bool enableRestore = Traits.Instance.EnableRestoreFirst; 1530if (!Traits.Instance.EscapeHatches.DoNotSendDeferredMessagesToBuildManager) 1787if (Traits.Instance.DebugEngine) 2764if (Traits.Instance.DebugEngine) 2854if (Traits.Instance.EscapeHatches.EnsureStdOutForChildNodesIsPrimaryStdout) 3923if (cpuCount == 1 && !Traits.Instance.InProcNodeDisabled) 3993if (cpuCount == 1 && !Traits.Instance.InProcNodeDisabled) 4030if (cpuCount == 1 && !Traits.Instance.InProcNodeDisabled)