From 13f25fcdc80328a3b89928dcedcc15906cd9da91 Mon Sep 17 00:00:00 2001 From: Michael Yanni Date: Fri, 22 Sep 2023 17:01:32 -0700 Subject: [PATCH] Applied cleanup for IDE0049 to the solution. --- .../dotnet-watch/Internal/ProcessRunner.cs | 2 +- .../SlnFile.cs | 2 +- .../NativeMethods.cs | 24 ++++++------ .../RuntimeEnvironment.cs | 2 +- .../UILanguageOverride.cs | 2 +- .../Windows/InstallClientElevationContext.cs | 2 +- .../dotnet/ReleasePropertyProjectLocator.cs | 6 +-- src/Cli/dotnet/SlnFileExtensions.cs | 2 +- .../LaunchSettings/LaunchSettingsManager.cs | 2 +- .../dotnet/commands/dotnet-run/RunCommand.cs | 2 +- .../dotnet/commands/dotnet-test/Program.cs | 2 +- ...lUninstallCommandLowLevelErrorConverter.cs | 2 +- .../install/NetSdkMsiInstallerClient.cs | 14 +++---- .../install/NetSdkMsiInstallerServer.cs | 2 +- .../install/WorkloadManifestUpdater.cs | 2 +- .../BaseImageNotFoundException.cs | 2 +- .../ContainerHelpers.cs | 2 +- .../Tasks/CreateNewImage.cs | 2 +- .../Tasks/ParseContainerProperties.cs | 10 ++--- .../Tool/ServerProtocol/NativeMethods.cs | 24 ++++++------ .../NETCoreSdkResolver.cs | 2 +- .../WorkloadSet.cs | 2 +- .../Common/ConflictResolution/ConflictItem.cs | 10 ++--- .../ConflictResolution/ConflictResolver.cs | 2 +- src/Tasks/Common/ItemUtilities.cs | 8 ++-- src/Tasks/Common/MSBuildUtilities.cs | 26 ++++++------- .../GetDependsOnNETStandard.net46.cs | 38 +++++++++---------- .../GivenAnAssetsFileResolver.cs | 2 +- .../AllowEmptyTelemetry.cs | 4 +- .../CollectSDKReferencesDesignTime.cs | 2 +- .../ProjectContext.cs | 2 +- .../ResolvePackageAssets.cs | 2 +- ...omCreateXUnitWorkItemsWithTestExclusion.cs | 4 +- .../TarGzFileCreateFromDirectory.cs | 2 +- .../EndToEndTests.cs | 2 +- .../TargetsTests.cs | 16 ++++---- ...atWeWantToBuildAnAppWithLibrariesAndRid.cs | 2 +- ...venThatWeWantToPublishASelfContainedApp.cs | 2 +- ...SolutionWithPublishReleaseOrPackRelease.cs | 6 +-- .../PublishDepsFilePathTests.cs | 2 +- .../WasmBuildIntegrationTest.cs | 2 +- .../Assertions/StringAssertionsExtensions.cs | 2 +- .../ProjectConstruction/TestProject.cs | 4 +- .../TestAssetsManager.cs | 2 +- .../TestPackageReference.cs | 2 +- .../Program.cs | 6 +-- .../GivenDotnetRunRunsVbProj.cs | 4 +- ...enDotnetTestBuildsAndRunsTestfromCsproj.cs | 2 +- .../GivenDotnetWorkloadInstall.cs | 8 ++-- .../GivenWorkloadManifestUpdater.cs | 6 +-- src/WebSdk/Publish/Tasks/Kudu/KuduConnect.cs | 2 +- .../Publish/Tasks/Kudu/KuduVfsDeploy.cs | 8 ++-- .../Publish/Tasks/Kudu/KuduZipDeploy.cs | 8 ++-- .../Publish/Tasks/Tasks/Kudu/KuduDeploy.cs | 18 ++++----- .../Tasks/Tasks/MsDeploy/GetPassword.cs | 4 +- .../Tasks/Tasks/MsDeploy/VsMsdeploy.cs | 2 +- .../Publish/Tasks/Tasks/ValidateParameter.cs | 4 +- .../Tasks/Xdt/TaskTransformationLogger.cs | 6 +-- .../Publish/Tasks/Tasks/Xdt/TransformXml.cs | 6 +-- .../Publish/Tasks/WebConfigTransform.cs | 2 +- 60 files changed, 171 insertions(+), 171 deletions(-) diff --git a/src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs b/src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs index cd52ea0b7880..655f74e2fde8 100644 --- a/src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs +++ b/src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs @@ -182,7 +182,7 @@ public ProcessState(Process process, IReporter reporter) // events. // // See the remarks here: https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.waitforexit#System_Diagnostics_Process_WaitForExit_System_Int32_ - if (!_process.WaitForExit(Int32.MaxValue)) + if (!_process.WaitForExit(int.MaxValue)) { throw new TimeoutException(); } diff --git a/src/Cli/Microsoft.DotNet.Cli.Sln.Internal/SlnFile.cs b/src/Cli/Microsoft.DotNet.Cli.Sln.Internal/SlnFile.cs index a227d43e4543..173ccaa96a4a 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Sln.Internal/SlnFile.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Sln.Internal/SlnFile.cs @@ -504,7 +504,7 @@ private SlnSectionType ToSectionType(int curLineNum, string s) } throw new InvalidSolutionFormatException( curLineNum, - String.Format(LocalizableStrings.InvalidSectionTypeError, s)); + string.Format(LocalizableStrings.InvalidSectionTypeError, s)); } private string FromSectionType(bool isProjectSection, SlnSectionType type) diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/NativeMethods.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/NativeMethods.cs index e63518ab4d6d..2467eb6166ea 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/NativeMethods.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/NativeMethods.cs @@ -23,26 +23,26 @@ internal enum JobObjectLimitFlags : uint [StructLayout(LayoutKind.Sequential)] internal struct JobObjectBasicLimitInformation { - public Int64 PerProcessUserTimeLimit; - public Int64 PerJobUserTimeLimit; + public long PerProcessUserTimeLimit; + public long PerJobUserTimeLimit; public JobObjectLimitFlags LimitFlags; public UIntPtr MinimumWorkingSetSize; public UIntPtr MaximumWorkingSetSize; - public UInt32 ActiveProcessLimit; + public uint ActiveProcessLimit; public UIntPtr Affinity; - public UInt32 PriorityClass; - public UInt32 SchedulingClass; + public uint PriorityClass; + public uint SchedulingClass; } [StructLayout(LayoutKind.Sequential)] internal struct IoCounters { - public UInt64 ReadOperationCount; - public UInt64 WriteOperationCount; - public UInt64 OtherOperationCount; - public UInt64 ReadTransferCount; - public UInt64 WriteTransferCount; - public UInt64 OtherTransferCount; + public ulong ReadOperationCount; + public ulong WriteOperationCount; + public ulong OtherOperationCount; + public ulong ReadTransferCount; + public ulong WriteTransferCount; + public ulong OtherTransferCount; } [StructLayout(LayoutKind.Sequential)] @@ -73,7 +73,7 @@ internal struct PROCESS_BASIC_INFORMATION internal static extern SafeWaitHandle CreateJobObjectW(IntPtr lpJobAttributes, string lpName); [DllImport("kernel32.dll", SetLastError = true)] - internal static extern bool SetInformationJobObject(IntPtr hJob, JobObjectInfoClass jobObjectInformationClass, IntPtr lpJobObjectInformation, UInt32 cbJobObjectInformationLength); + internal static extern bool SetInformationJobObject(IntPtr hJob, JobObjectInfoClass jobObjectInformationClass, IntPtr lpJobObjectInformation, uint cbJobObjectInformationLength); [DllImport("kernel32.dll", SetLastError = true)] internal static extern bool AssignProcessToJobObject(IntPtr hJob, IntPtr hProcess); diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs index 46d6dd2186d7..18a3f54474b7 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs @@ -82,7 +82,7 @@ private static string GetFreeBSDVersion() // This is same as sysctl kern.version // FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC // What we want is major release as minor releases should be compatible. - String version = RuntimeInformation.OSDescription; + string version = RuntimeInformation.OSDescription; try { // second token up to first dot diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs index 9893d5545ad3..59e37dc038dd 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs @@ -126,7 +126,7 @@ private static bool CurrentPlatformOfficiallySupportsUTF8Encoding() private static bool ForceUniversalEncodingOptInEnabled() { - return String.Equals(Environment.GetEnvironmentVariable("DOTNET_CLI_FORCE_UTF8_ENCODING"), "true", StringComparison.OrdinalIgnoreCase); + return string.Equals(Environment.GetEnvironmentVariable("DOTNET_CLI_FORCE_UTF8_ENCODING"), "true", StringComparison.OrdinalIgnoreCase); } } } diff --git a/src/Cli/dotnet/Installer/Windows/InstallClientElevationContext.cs b/src/Cli/dotnet/Installer/Windows/InstallClientElevationContext.cs index 65c24dfbe79c..d6002a9731e5 100644 --- a/src/Cli/dotnet/Installer/Windows/InstallClientElevationContext.cs +++ b/src/Cli/dotnet/Installer/Windows/InstallClientElevationContext.cs @@ -75,7 +75,7 @@ public override void Elevate() } } - private void ServerExited(Object sender, EventArgs e) + private void ServerExited(object sender, EventArgs e) { _log?.LogMessage($"Elevated command instance has exited."); } diff --git a/src/Cli/dotnet/ReleasePropertyProjectLocator.cs b/src/Cli/dotnet/ReleasePropertyProjectLocator.cs index a51f34ebe9f8..dc075b38b5cb 100644 --- a/src/Cli/dotnet/ReleasePropertyProjectLocator.cs +++ b/src/Cli/dotnet/ReleasePropertyProjectLocator.cs @@ -62,7 +62,7 @@ public IEnumerable GetCustomDefaultConfigurationValueIfSpecified() // Setup Debug.Assert(_propertyToCheck == MSBuildPropertyNames.PUBLISH_RELEASE || _propertyToCheck == MSBuildPropertyNames.PACK_RELEASE, "Only PackRelease or PublishRelease are currently expected."); var nothing = Enumerable.Empty(); - if (String.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DISABLE_PUBLISH_AND_PACK_RELEASE), "true", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DISABLE_PUBLISH_AND_PACK_RELEASE), "true", StringComparison.OrdinalIgnoreCase)) { return nothing; } @@ -160,7 +160,7 @@ public IEnumerable GetCustomDefaultConfigurationValueIfSpecified() HashSet configValues = new HashSet(); object projectDataLock = new object(); - if (String.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DOTNET_CLI_LAZY_PUBLISH_AND_PACK_RELEASE_FOR_SOLUTIONS), "true", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DOTNET_CLI_LAZY_PUBLISH_AND_PACK_RELEASE_FOR_SOLUTIONS), "true", StringComparison.OrdinalIgnoreCase)) { // Evaluate only one project for speed if this environment variable is used. Will break more customers if enabled (adding 8.0 project to SLN with other project TFMs with no Publish or PackRelease.) return GetSingleProjectFromSolution(sln, globalProps); @@ -197,7 +197,7 @@ public IEnumerable GetCustomDefaultConfigurationValueIfSpecified() // 1) This error should not be thrown in VS because it is part of the SDK CLI code // 2) If PublishRelease or PackRelease is disabled via opt out, or Configuration is specified, we won't get to this code, so we won't error // 3) This code only gets hit if we are in a solution publish setting, so we don't need to worry about it failing other publish scenarios - throw new GracefulException(Strings.SolutionProjectConfigurationsConflict, _propertyToCheck, String.Join("\n", (configuredProjects).Select(x => x.FullPath))); + throw new GracefulException(Strings.SolutionProjectConfigurationsConflict, _propertyToCheck, string.Join("\n", (configuredProjects).Select(x => x.FullPath))); } return configuredProjects.FirstOrDefault(); } diff --git a/src/Cli/dotnet/SlnFileExtensions.cs b/src/Cli/dotnet/SlnFileExtensions.cs index 598367215db1..3f601caee8c2 100644 --- a/src/Cli/dotnet/SlnFileExtensions.cs +++ b/src/Cli/dotnet/SlnFileExtensions.cs @@ -205,7 +205,7 @@ private static string GetMatchingProjectKey(IDictionary projectK return projectKey; } - var keyWithoutWhitespace = String.Concat(solutionKey.Where(c => !Char.IsWhiteSpace(c))); + var keyWithoutWhitespace = string.Concat(solutionKey.Where(c => !char.IsWhiteSpace(c))); if (projectKeys.TryGetValue(keyWithoutWhitespace, out projectKey)) { return projectKey; diff --git a/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/LaunchSettingsManager.cs b/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/LaunchSettingsManager.cs index 30bd40a2565b..9e4aa74970e1 100644 --- a/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/LaunchSettingsManager.cs +++ b/src/Cli/dotnet/commands/dotnet-run/LaunchSettings/LaunchSettingsManager.cs @@ -61,7 +61,7 @@ public static LaunchSettingsApplyResult TryApplyLaunchSettings(string launchSett if (caseInsensitiveProfileMatches.Count() > 1) { throw new GracefulException(LocalizableStrings.DuplicateCaseInsensitiveLaunchProfileNames, - String.Join(",\n", caseInsensitiveProfileMatches.Select(p => $"\t{p.Name}").ToArray())); + string.Join(",\n", caseInsensitiveProfileMatches.Select(p => $"\t{p.Name}").ToArray())); } else if (!caseInsensitiveProfileMatches.Any()) { diff --git a/src/Cli/dotnet/commands/dotnet-run/RunCommand.cs b/src/Cli/dotnet/commands/dotnet-run/RunCommand.cs index 6c4e7ac53cf6..5079f7961a03 100644 --- a/src/Cli/dotnet/commands/dotnet-run/RunCommand.cs +++ b/src/Cli/dotnet/commands/dotnet-run/RunCommand.cs @@ -69,7 +69,7 @@ public int Execute() //NOTE: MSBuild variables are not expanded like they are in VS targetCommand.EnvironmentVariable(entry.Key, value); } - if (String.IsNullOrEmpty(targetCommand.CommandArgs) && launchSettings.CommandLineArgs != null) + if (string.IsNullOrEmpty(targetCommand.CommandArgs) && launchSettings.CommandLineArgs != null) { targetCommand.SetCommandArgs(launchSettings.CommandLineArgs); } diff --git a/src/Cli/dotnet/commands/dotnet-test/Program.cs b/src/Cli/dotnet/commands/dotnet-test/Program.cs index f50519454c8f..8cfc5a3600fc 100644 --- a/src/Cli/dotnet/commands/dotnet-test/Program.cs +++ b/src/Cli/dotnet/commands/dotnet-test/Program.cs @@ -141,7 +141,7 @@ private static TestCommand FromParseResult(ParseResult result, string[] settings result.OptionValuesToBeForwarded(TestCommandParser.GetCommand()) // all msbuild-recognized tokens .Concat(unMatchedNonSettingsArgs); // all tokens that the test-parser doesn't explicitly track (minus the settings tokens) - VSTestTrace.SafeWriteTrace(() => $"MSBuild args from forwarded options: {String.Join(", ", parsedArgs)}"); + VSTestTrace.SafeWriteTrace(() => $"MSBuild args from forwarded options: {string.Join(", ", parsedArgs)}"); msbuildArgs.AddRange(parsedArgs); if (settings.Any()) diff --git a/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommandLowLevelErrorConverter.cs b/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommandLowLevelErrorConverter.cs index c7c0e16e3a11..634e20571dd8 100644 --- a/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommandLowLevelErrorConverter.cs +++ b/src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommandLowLevelErrorConverter.cs @@ -15,7 +15,7 @@ public static IEnumerable GetUserFacingMessages(Exception ex, PackageId { userFacingMessages = new[] { - String.Format( + string.Format( CommonLocalizableStrings.FailedToUninstallToolPackage, packageId, ex.Message), diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs b/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs index 4194ec25710f..377062f9d995 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs @@ -283,7 +283,7 @@ private void RemoveWorkloadPacks(List packsToRemove, Directo { Log?.LogMessage($"ProductCode mismatch! Cached package: {msi.ProductCode}, pack record: {record.ProductCode}."); string logFile = GetMsiLogName(record, InstallAction.Uninstall); - uint error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressUninstall, id), () => UninstallMsi(record.ProductCode, logFile)); + uint error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressUninstall, id), () => UninstallMsi(record.ProductCode, logFile)); ExitOnError(error, $"Failed to uninstall {msi.MsiPath}."); } else @@ -586,7 +586,7 @@ public async Task ExtractManifestAsync(string nupkgPath, string targetPath) string packageDataPath = Path.Combine(extractionPath, "data"); if (!Cache.TryGetMsiPathFromPackageData(packageDataPath, out string msiPath, out _)) { - throw new FileNotFoundException(String.Format(LocalizableStrings.ManifestMsiNotFoundInNuGetPackage, extractionPath)); + throw new FileNotFoundException(string.Format(LocalizableStrings.ManifestMsiNotFoundInNuGetPackage, extractionPath)); } string msiExtractionPath = Path.Combine(extractionPath, "msi"); @@ -604,7 +604,7 @@ public async Task ExtractManifestAsync(string nupkgPath, string targetPath) if (result != Error.SUCCESS) { Log?.LogMessage($"ExtractManifestAsync: Admin install failed: {result}"); - throw new GracefulException(String.Format(LocalizableStrings.FailedToExtractMsi, msiPath)); + throw new GracefulException(string.Format(LocalizableStrings.FailedToExtractMsi, msiPath)); } } @@ -619,7 +619,7 @@ public async Task ExtractManifestAsync(string nupkgPath, string targetPath) if (manifestFolder == null) { - throw new GracefulException(String.Format(LocalizableStrings.ExpectedSingleManifest, nupkgPath)); + throw new GracefulException(string.Format(LocalizableStrings.ExpectedSingleManifest, nupkgPath)); } FileAccessRetrier.RetryOnMoveAccessFailure(() => DirectoryPath.MoveDirectory(manifestFolder, targetPath)); @@ -930,17 +930,17 @@ private void ExecutePackage(MsiPayload msi, InstallAction action, string display case InstallAction.MinorUpdate: case InstallAction.Install: case InstallAction.MajorUpgrade: - error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressInstall, name), () => InstallMsi(msi.MsiPath, logFile)); + error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressInstall, name), () => InstallMsi(msi.MsiPath, logFile)); ExitOnError(error, $"Failed to install {msi.Payload}."); break; case InstallAction.Repair: - error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressRepair, name), () => RepairMsi(msi.ProductCode, logFile)); + error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressRepair, name), () => RepairMsi(msi.ProductCode, logFile)); ExitOnError(error, $"Failed to repair {msi.Payload}."); break; case InstallAction.Uninstall: - error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressUninstall, name), () => UninstallMsi(msi.ProductCode, logFile)); + error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressUninstall, name), () => UninstallMsi(msi.ProductCode, logFile)); ExitOnError(error, $"Failed to remove {msi.Payload}."); break; diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerServer.cs b/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerServer.cs index 06e55b87c783..804bf5fed107 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerServer.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerServer.cs @@ -133,7 +133,7 @@ public static NetSdkMsiInstallerServer Create(bool verifySignatures) if ((ParentProcess == null) || (ParentProcess.StartTime > CurrentProcess.StartTime) || !string.Equals(ParentProcess.MainModule.FileName, Environment.ProcessPath, StringComparison.OrdinalIgnoreCase)) { - throw new SecurityException(String.Format(LocalizableStrings.NoTrustWithParentPID, ParentProcess?.Id)); + throw new SecurityException(string.Format(LocalizableStrings.NoTrustWithParentPID, ParentProcess?.Id)); } // Configure pipe DACLs diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadManifestUpdater.cs b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadManifestUpdater.cs index da18d53e4e6d..d1a0d7c60476 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadManifestUpdater.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/install/WorkloadManifestUpdater.cs @@ -470,7 +470,7 @@ private bool BackgroundUpdatesAreDisabled() => private static string GetAdvertisingWorkloadsFilePath(string userProfileDir, SdkFeatureBand featureBand) => Path.Combine(userProfileDir, $".workloadAdvertisingUpdates{featureBand}"); - private async Task GetOnlinePackagePath(SdkFeatureBand sdkFeatureBand, ManifestId manifestId, bool includePreviews) + private async Task GetOnlinePackagePath(SdkFeatureBand sdkFeatureBand, ManifestId manifestId, bool includePreviews) { string packagePath = await _nugetPackageDownloader.DownloadPackageAsync( _workloadManifestInstaller.GetManifestPackageId(manifestId, sdkFeatureBand), diff --git a/src/Containers/Microsoft.NET.Build.Containers/BaseImageNotFoundException.cs b/src/Containers/Microsoft.NET.Build.Containers/BaseImageNotFoundException.cs index 0b721ba060ac..c54083890163 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/BaseImageNotFoundException.cs +++ b/src/Containers/Microsoft.NET.Build.Containers/BaseImageNotFoundException.cs @@ -6,5 +6,5 @@ namespace Microsoft.NET.Build.Containers; public sealed class BaseImageNotFoundException : Exception { internal BaseImageNotFoundException(string specifiedRuntimeIdentifier, string repositoryName, string reference, IEnumerable supportedRuntimeIdentifiers) - : base($"The RuntimeIdentifier '{specifiedRuntimeIdentifier}' is not supported by {repositoryName}:{reference}. The supported RuntimeIdentifiers are {String.Join(",", supportedRuntimeIdentifiers)}") { } + : base($"The RuntimeIdentifier '{specifiedRuntimeIdentifier}' is not supported by {repositoryName}:{reference}. The supported RuntimeIdentifiers are {string.Join(",", supportedRuntimeIdentifiers)}") { } } diff --git a/src/Containers/Microsoft.NET.Build.Containers/ContainerHelpers.cs b/src/Containers/Microsoft.NET.Build.Containers/ContainerHelpers.cs index 5be30d53337b..38b555606a32 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/ContainerHelpers.cs +++ b/src/Containers/Microsoft.NET.Build.Containers/ContainerHelpers.cs @@ -50,7 +50,7 @@ public static bool TryParsePort(string? portNumber, string? portType, [NotNullWh { var portNo = 0; error = null; - if (String.IsNullOrEmpty(portNumber)) + if (string.IsNullOrEmpty(portNumber)) { error = ParsePortError.MissingPortNumber; } diff --git a/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs b/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs index 669edba9590e..ffe30386de2e 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs +++ b/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs @@ -98,7 +98,7 @@ internal async Task ExecuteAsync(CancellationToken cancellationToken) return !Log.HasLoggedErrors; } - SafeLog(Strings.ContainerBuilder_StartBuildingImage, Repository, String.Join(",", ImageTags), sourceImageReference); + SafeLog(Strings.ContainerBuilder_StartBuildingImage, Repository, string.Join(",", ImageTags), sourceImageReference); Layer newLayer = Layer.FromDirectory(PublishDirectory, WorkingDirectory, imageBuilder.IsWindows); imageBuilder.AddLayer(newLayer); diff --git a/src/Containers/Microsoft.NET.Build.Containers/Tasks/ParseContainerProperties.cs b/src/Containers/Microsoft.NET.Build.Containers/Tasks/ParseContainerProperties.cs index f7bc4c755ceb..926f63508865 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Tasks/ParseContainerProperties.cs +++ b/src/Containers/Microsoft.NET.Build.Containers/Tasks/ParseContainerProperties.cs @@ -82,13 +82,13 @@ public ParseContainerProperties() public override bool Execute() { string[] validTags; - if (!String.IsNullOrEmpty(ContainerImageTag) && ContainerImageTags.Length >= 1) + if (!string.IsNullOrEmpty(ContainerImageTag) && ContainerImageTags.Length >= 1) { Log.LogErrorWithCodeFromResources(nameof(Strings.AmbiguousTags), nameof(ContainerImageTag), nameof(ContainerImageTags)); return !Log.HasLoggedErrors; } - if (!String.IsNullOrEmpty(ContainerImageTag)) + if (!string.IsNullOrEmpty(ContainerImageTag)) { if (ContainerHelpers.IsValidImageTag(ContainerImageTag)) { @@ -105,7 +105,7 @@ public override bool Execute() validTags = valids; if (invalids.Any()) { - Log.LogErrorWithCodeFromResources(nameof(Strings.InvalidTags), nameof(ContainerImageTags), String.Join(",", invalids)); + Log.LogErrorWithCodeFromResources(nameof(Strings.InvalidTags), nameof(ContainerImageTags), string.Join(",", invalids)); return !Log.HasLoggedErrors; } } @@ -114,7 +114,7 @@ public override bool Execute() validTags = Array.Empty(); } - if (!String.IsNullOrEmpty(ContainerRegistry) && !ContainerHelpers.IsValidRegistry(ContainerRegistry)) + if (!string.IsNullOrEmpty(ContainerRegistry) && !ContainerHelpers.IsValidRegistry(ContainerRegistry)) { Log.LogErrorWithCodeFromResources(nameof(Strings.CouldntRecognizeRegistry), ContainerRegistry); return !Log.HasLoggedErrors; @@ -173,7 +173,7 @@ public override bool Execute() Log.LogMessage(MessageImportance.Low, "Image: {0}", ParsedContainerImage); Log.LogMessage(MessageImportance.Low, "Tag: {0}", ParsedContainerTag); Log.LogMessage(MessageImportance.Low, "Image Name: {0}", NewContainerRepository); - Log.LogMessage(MessageImportance.Low, "Image Tags: {0}", String.Join(", ", NewContainerTags)); + Log.LogMessage(MessageImportance.Low, "Image Tags: {0}", string.Join(", ", NewContainerTags)); } return !Log.HasLoggedErrors; diff --git a/src/RazorSdk/Tool/ServerProtocol/NativeMethods.cs b/src/RazorSdk/Tool/ServerProtocol/NativeMethods.cs index 7d833d022b28..2e2b849b0b9f 100644 --- a/src/RazorSdk/Tool/ServerProtocol/NativeMethods.cs +++ b/src/RazorSdk/Tool/ServerProtocol/NativeMethods.cs @@ -6,20 +6,20 @@ namespace Microsoft.NET.Sdk.Razor.Tool [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] internal struct STARTUPINFO { - internal Int32 cb; + internal int cb; internal string lpReserved; internal string lpDesktop; internal string lpTitle; - internal Int32 dwX; - internal Int32 dwY; - internal Int32 dwXSize; - internal Int32 dwYSize; - internal Int32 dwXCountChars; - internal Int32 dwYCountChars; - internal Int32 dwFillAttribute; - internal Int32 dwFlags; - internal Int16 wShowWindow; - internal Int16 cbReserved2; + internal int dwX; + internal int dwY; + internal int dwXSize; + internal int dwYSize; + internal int dwXCountChars; + internal int dwYCountChars; + internal int dwFillAttribute; + internal int dwFlags; + internal short wShowWindow; + internal short cbReserved2; internal IntPtr lpReserved2; internal IntPtr hStdInput; internal IntPtr hStdOutput; @@ -47,7 +47,7 @@ internal static class NativeMethods internal const uint NORMAL_PRIORITY_CLASS = 0x0020; internal const uint CREATE_NO_WINDOW = 0x08000000; - internal const Int32 STARTF_USESTDHANDLES = 0x00000100; + internal const int STARTF_USESTDHANDLES = 0x00000100; internal const int ERROR_SUCCESS = 0; #endregion diff --git a/src/Resolvers/Microsoft.DotNet.SdkResolver/NETCoreSdkResolver.cs b/src/Resolvers/Microsoft.DotNet.SdkResolver/NETCoreSdkResolver.cs index d4e857472e76..0fb04b312a4a 100644 --- a/src/Resolvers/Microsoft.DotNet.SdkResolver/NETCoreSdkResolver.cs +++ b/src/Resolvers/Microsoft.DotNet.SdkResolver/NETCoreSdkResolver.cs @@ -112,7 +112,7 @@ private CompatibleSdkValue GetMostCompatibleSdks(string dotnetExeDirectory, Vers continue; } - if (minimumSdkMajorVersion != 0 && Int32.TryParse(netcoreSdkVersion.Split('.')[0], out int sdkMajorVersion) && sdkMajorVersion < minimumSdkMajorVersion) + if (minimumSdkMajorVersion != 0 && int.TryParse(netcoreSdkVersion.Split('.')[0], out int sdkMajorVersion) && sdkMajorVersion < minimumSdkMajorVersion) { continue; } diff --git a/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/WorkloadSet.cs b/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/WorkloadSet.cs index 897d6541b30c..355f5c2ecb67 100644 --- a/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/WorkloadSet.cs +++ b/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/WorkloadSet.cs @@ -42,7 +42,7 @@ public static WorkloadSet FromDictionaryForJson(IDictionary dict string manifestVersionString = parts[0]; if (!FXVersion.TryParse(manifestVersionString, out FXVersion version)) { - throw new FormatException(String.Format(Strings.InvalidVersionForWorkload, manifest.Key, manifestVersionString)); + throw new FormatException(string.Format(Strings.InvalidVersionForWorkload, manifest.Key, manifestVersionString)); } manifestVersion = new ManifestVersion(parts[0]); diff --git a/src/Tasks/Common/ConflictResolution/ConflictItem.cs b/src/Tasks/Common/ConflictResolution/ConflictItem.cs index 0c909a45adf5..9c99187a85af 100644 --- a/src/Tasks/Common/ConflictResolution/ConflictItem.cs +++ b/src/Tasks/Common/ConflictResolution/ConflictItem.cs @@ -69,7 +69,7 @@ public Version AssemblyVersion { _assemblyVersion = null; - var assemblyVersionString = OriginalItem?.GetMetadata(nameof(AssemblyVersion)) ?? String.Empty; + var assemblyVersionString = OriginalItem?.GetMetadata(nameof(AssemblyVersion)) ?? string.Empty; if (assemblyVersionString.Length != 0) { @@ -116,7 +116,7 @@ public string FileName { if (_fileName == null) { - _fileName = OriginalItem == null ? String.Empty : Path.GetFileName(OriginalItem.ItemSpec); + _fileName = OriginalItem == null ? string.Empty : Path.GetFileName(OriginalItem.ItemSpec); } return _fileName; } @@ -133,7 +133,7 @@ public Version FileVersion { _fileVersion = null; - var fileVersionString = OriginalItem?.GetMetadata(nameof(FileVersion)) ?? String.Empty; + var fileVersionString = OriginalItem?.GetMetadata(nameof(FileVersion)) ?? string.Empty; if (fileVersionString.Length != 0) { @@ -190,7 +190,7 @@ public ConflictVersion PackageVersion { _packageVersion = null; - var packageVersionString = OriginalItem?.GetMetadata(nameof(MetadataNames.NuGetPackageVersion)) ?? String.Empty; + var packageVersionString = OriginalItem?.GetMetadata(nameof(MetadataNames.NuGetPackageVersion)) ?? string.Empty; if (packageVersionString.Length != 0) { @@ -212,7 +212,7 @@ public string SourcePath { if (_sourcePath == null) { - _sourcePath = ItemUtilities.GetSourcePath(OriginalItem) ?? String.Empty; + _sourcePath = ItemUtilities.GetSourcePath(OriginalItem) ?? string.Empty; } return _sourcePath.Length == 0 ? null : _sourcePath; diff --git a/src/Tasks/Common/ConflictResolution/ConflictResolver.cs b/src/Tasks/Common/ConflictResolution/ConflictResolver.cs index 50978c8c4777..6ca9aab3a368 100644 --- a/src/Tasks/Common/ConflictResolution/ConflictResolver.cs +++ b/src/Tasks/Common/ConflictResolution/ConflictResolver.cs @@ -44,7 +44,7 @@ public void ResolveConflicts(IEnumerable conflictItems, FuncBoolean true or false, corresponding to the string. internal static bool ConvertStringToBool(string parameterValue, bool defaultValue = false) { - if (String.IsNullOrEmpty(parameterValue)) + if (string.IsNullOrEmpty(parameterValue)) { return defaultValue; } @@ -48,12 +48,12 @@ internal static bool ConvertStringToBool(string parameterValue, bool defaultValu /// private static bool ValidBooleanTrue(string parameterValue) { - return ((String.Compare(parameterValue, "true", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(parameterValue, "on", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(parameterValue, "yes", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(parameterValue, "!false", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(parameterValue, "!off", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(parameterValue, "!no", StringComparison.OrdinalIgnoreCase) == 0)); + return ((string.Compare(parameterValue, "true", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(parameterValue, "on", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(parameterValue, "yes", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(parameterValue, "!false", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(parameterValue, "!off", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(parameterValue, "!no", StringComparison.OrdinalIgnoreCase) == 0)); } /// @@ -62,12 +62,12 @@ private static bool ValidBooleanTrue(string parameterValue) /// private static bool ValidBooleanFalse(string parameterValue) { - return ((String.Compare(parameterValue, "false", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(parameterValue, "off", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(parameterValue, "no", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(parameterValue, "!true", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(parameterValue, "!on", StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(parameterValue, "!yes", StringComparison.OrdinalIgnoreCase) == 0)); + return ((string.Compare(parameterValue, "false", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(parameterValue, "off", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(parameterValue, "no", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(parameterValue, "!true", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(parameterValue, "!on", StringComparison.OrdinalIgnoreCase) == 0) || + (string.Compare(parameterValue, "!yes", StringComparison.OrdinalIgnoreCase) == 0)); } } } diff --git a/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs b/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs index 41cd962a778b..32b56bef82cb 100644 --- a/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs +++ b/src/Tasks/Microsoft.NET.Build.Extensions.Tasks/GetDependsOnNETStandard.net46.cs @@ -48,8 +48,8 @@ internal static bool GetFileDependsOnNETStandard(string filePath) var assemblyImport = (IMetaDataAssemblyImport)metadataDispenser.OpenScope(filePathAbsolute, 0, s_importerGuid); var asmRefEnum = IntPtr.Zero; - var asmRefTokens = new UInt32[16]; - UInt32 fetched; + var asmRefTokens = new uint[16]; + uint fetched; var assemblyMD = new ASSEMBLYMETADATA() { @@ -77,7 +77,7 @@ internal static bool GetFileDependsOnNETStandard(string filePath) { // Determine the length of the string to contain the name first. IntPtr hashDataPtr, pubKeyPtr; - UInt32 hashDataLength, pubKeyBytes, asmNameLength, flags; + uint hashDataLength, pubKeyBytes, asmNameLength, flags; assemblyImport.GetAssemblyRefProps( asmRefTokens[i], out pubKeyPtr, @@ -163,13 +163,13 @@ internal class CorMetaDataDispenser internal interface IMetaDataDispenser { [return: MarshalAs(UnmanagedType.Interface)] - object DefineScope([In] ref Guid rclsid, [In] UInt32 dwCreateFlags, [In] ref Guid riid); + object DefineScope([In] ref Guid rclsid, [In] uint dwCreateFlags, [In] ref Guid riid); [return: MarshalAs(UnmanagedType.Interface)] - object OpenScope([In][MarshalAs(UnmanagedType.LPWStr)] string szScope, [In] UInt32 dwOpenFlags, [In] ref Guid riid); + object OpenScope([In][MarshalAs(UnmanagedType.LPWStr)] string szScope, [In] uint dwOpenFlags, [In] ref Guid riid); [return: MarshalAs(UnmanagedType.Interface)] - object OpenScopeOnMemory([In] IntPtr pData, [In] UInt32 cbData, [In] UInt32 dwOpenFlags, [In] ref Guid riid); + object OpenScopeOnMemory([In] IntPtr pData, [In] uint cbData, [In] uint dwOpenFlags, [In] ref Guid riid); } [ComImport] @@ -177,16 +177,16 @@ internal interface IMetaDataDispenser [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IMetaDataAssemblyImport { - void GetAssemblyProps(UInt32 mdAsm, out IntPtr pPublicKeyPtr, out UInt32 ucbPublicKeyPtr, out UInt32 uHashAlg, StringBuilder strName, UInt32 cchNameIn, out UInt32 cchNameRequired, IntPtr amdInfo, out UInt32 dwFlags); - void GetAssemblyRefProps(UInt32 mdAsmRef, out IntPtr ppbPublicKeyOrToken, out UInt32 pcbPublicKeyOrToken, StringBuilder strName, UInt32 cchNameIn, out UInt32 pchNameOut, ref ASSEMBLYMETADATA amdInfo, out IntPtr ppbHashValue, out UInt32 pcbHashValue, out UInt32 pdwAssemblyRefFlags); - void GetFileProps([In] UInt32 mdFile, StringBuilder strName, UInt32 cchName, out UInt32 cchNameRequired, out IntPtr bHashData, out UInt32 cchHashBytes, out UInt32 dwFileFlags); + void GetAssemblyProps(uint mdAsm, out IntPtr pPublicKeyPtr, out uint ucbPublicKeyPtr, out uint uHashAlg, StringBuilder strName, uint cchNameIn, out uint cchNameRequired, IntPtr amdInfo, out uint dwFlags); + void GetAssemblyRefProps(uint mdAsmRef, out IntPtr ppbPublicKeyOrToken, out uint pcbPublicKeyOrToken, StringBuilder strName, uint cchNameIn, out uint pchNameOut, ref ASSEMBLYMETADATA amdInfo, out IntPtr ppbHashValue, out uint pcbHashValue, out uint pdwAssemblyRefFlags); + void GetFileProps([In] uint mdFile, StringBuilder strName, uint cchName, out uint cchNameRequired, out IntPtr bHashData, out uint cchHashBytes, out uint dwFileFlags); void GetExportedTypeProps(); void GetManifestResourceProps(); - void EnumAssemblyRefs([In, Out] ref IntPtr phEnum, [MarshalAs(UnmanagedType.LPArray), Out] UInt32[] asmRefs, System.UInt32 asmRefCount, out System.UInt32 iFetched); - void EnumFiles([In, Out] ref IntPtr phEnum, [MarshalAs(UnmanagedType.LPArray), Out] UInt32[] fileRefs, System.UInt32 fileRefCount, out System.UInt32 iFetched); + void EnumAssemblyRefs([In, Out] ref IntPtr phEnum, [MarshalAs(UnmanagedType.LPArray), Out] uint[] asmRefs, uint asmRefCount, out uint iFetched); + void EnumFiles([In, Out] ref IntPtr phEnum, [MarshalAs(UnmanagedType.LPArray), Out] uint[] fileRefs, uint fileRefCount, out uint iFetched); void EnumExportedTypes(); void EnumManifestResources(); - void GetAssemblyFromScope(out UInt32 mdAsm); + void GetAssemblyFromScope(out uint mdAsm); void FindExportedTypeByName(); void FindManifestResourceByName(); // PreserveSig because this method is an exception that @@ -216,16 +216,16 @@ typedef struct [StructLayout(LayoutKind.Sequential)] internal struct ASSEMBLYMETADATA { - public UInt16 usMajorVersion; - public UInt16 usMinorVersion; - public UInt16 usBuildNumber; - public UInt16 usRevisionNumber; + public ushort usMajorVersion; + public ushort usMinorVersion; + public ushort usBuildNumber; + public ushort usRevisionNumber; public IntPtr rpLocale; - public UInt32 cchLocale; + public uint cchLocale; public IntPtr rpProcessors; - public UInt32 cProcessors; + public uint cProcessors; public IntPtr rOses; - public UInt32 cOses; + public uint cOses; } #endregion diff --git a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAnAssetsFileResolver.cs b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAnAssetsFileResolver.cs index 5bc7c64a1aa8..4e85850ee060 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAnAssetsFileResolver.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenAnAssetsFileResolver.cs @@ -189,7 +189,7 @@ private static ResolvedFile CreateResolvedFile( string sourcedir = Path.GetDirectoryName(sourcepath); string destinationSubDirPath = preserveStoreLayout ? sourcedir.Substring(packageRoot.Length) : destinationSubDirectory; - if (!String.IsNullOrEmpty(destinationSubDirPath) && !destinationSubDirPath.EndsWith(Path.DirectorySeparatorChar)) + if (!string.IsNullOrEmpty(destinationSubDirPath) && !destinationSubDirPath.EndsWith(Path.DirectorySeparatorChar)) { destinationSubDirPath += Path.DirectorySeparatorChar; } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/AllowEmptyTelemetry.cs b/src/Tasks/Microsoft.NET.Build.Tasks/AllowEmptyTelemetry.cs index c282154bd8f5..cb4cc9b94f36 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/AllowEmptyTelemetry.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/AllowEmptyTelemetry.cs @@ -14,7 +14,7 @@ public sealed class AllowEmptyTelemetry : TaskBase public AllowEmptyTelemetry() { EventData = Array.Empty(); - EventName = String.Empty; + EventName = string.Empty; } /// @@ -46,7 +46,7 @@ protected override void ExecuteCore() { value = HashWithNormalizedCasing(value); } - if (String.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value)) { properties[key] = "null"; } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/CollectSDKReferencesDesignTime.cs b/src/Tasks/Microsoft.NET.Build.Tasks/CollectSDKReferencesDesignTime.cs index dc23d3dbd6c4..ef7d9fb87b8d 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/CollectSDKReferencesDesignTime.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/CollectSDKReferencesDesignTime.cs @@ -74,7 +74,7 @@ private IEnumerable GetImplicitPackageReferences() } else { - Boolean.TryParse(isImplicitlyDefinedString, out isImplicitlyDefined); + bool.TryParse(isImplicitlyDefinedString, out isImplicitlyDefined); } if (isImplicitlyDefined) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ProjectContext.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ProjectContext.cs index 7fdd7f0a10db..f4e78cfcef6d 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ProjectContext.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ProjectContext.cs @@ -99,7 +99,7 @@ public IEnumerable GetRuntimeLibraries(IEnumerable 0 && !String.Equals(PlatformLibrary.Name, NetCorePlatformLibrary, StringComparison.OrdinalIgnoreCase)) + if (PlatformLibrary.Name.Length > 0 && !string.Equals(PlatformLibrary.Name, NetCorePlatformLibrary, StringComparison.OrdinalIgnoreCase)) { var library = _lockFileTarget.GetLibrary(NetCorePlatformLibrary); if (library != null) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs index 9db25dcdaee2..c7693f28076a 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs @@ -1813,7 +1813,7 @@ private void ComputePackageExclusions() // If the platform library is not Microsoft.NETCore.App, treat it as an implicit dependency. // This makes it so Microsoft.AspNet.* 2.x platforms also exclude Microsoft.NETCore.App files. - if (!String.Equals(platformLibrary.Name, NetCorePlatformLibrary, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(platformLibrary.Name, NetCorePlatformLibrary, StringComparison.OrdinalIgnoreCase)) { var library = _runtimeTarget.GetLibrary(NetCorePlatformLibrary); if (library != null) diff --git a/src/Tests/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs b/src/Tests/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs index 737dceef4001..87f95c449cb7 100644 --- a/src/Tests/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs +++ b/src/Tests/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs @@ -136,7 +136,7 @@ private async Task> PrepareWorkItem(ITaskItem xunitProject) msbuildAdditionalSdkResolverFolder = ""; } - var scheduler = new AssemblyScheduler(methodLimit: !String.IsNullOrEmpty(Environment.GetEnvironmentVariable("TestFullMSBuild")) ? 32 : 16); + var scheduler = new AssemblyScheduler(methodLimit: !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TestFullMSBuild")) ? 32 : 16); var assemblyPartitionInfos = scheduler.Schedule(targetPath, netFramework: netFramework); var partitionedWorkItem = new List(); @@ -145,7 +145,7 @@ private async Task> PrepareWorkItem(ITaskItem xunitProject) string command = $"{driver} exec {assemblyName} {testExecutionDirectory} {msbuildAdditionalSdkResolverFolder} {(XUnitArguments != null ? " " + XUnitArguments : "")} -xml testResults.xml {assemblyPartitionInfo.ClassListArgumentString} {arguments}"; if (netFramework) { - var testFilter = String.IsNullOrEmpty(assemblyPartitionInfo.ClassListArgumentString) ? "" : $"--filter \"{assemblyPartitionInfo.ClassListArgumentString}\""; + var testFilter = string.IsNullOrEmpty(assemblyPartitionInfo.ClassListArgumentString) ? "" : $"--filter \"{assemblyPartitionInfo.ClassListArgumentString}\""; command = $"{driver} test {assemblyName} {testExecutionDirectory} {msbuildAdditionalSdkResolverFolder} {(XUnitArguments != null ? " " + XUnitArguments : "")} --results-directory .\\ --logger trx {testFilter}"; } diff --git a/src/Tests/HelixTasks/TarGzFileCreateFromDirectory.cs b/src/Tests/HelixTasks/TarGzFileCreateFromDirectory.cs index c84656185c45..737a5a16fa0c 100644 --- a/src/Tests/HelixTasks/TarGzFileCreateFromDirectory.cs +++ b/src/Tests/HelixTasks/TarGzFileCreateFromDirectory.cs @@ -134,7 +134,7 @@ private string GetDestinationArchive() private string GetExcludes() { - var excludes = String.Empty; + var excludes = string.Empty; if (ExcludePatterns != null) { diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs index f387bfd049c5..767b254dce93 100644 --- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs +++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs @@ -27,7 +27,7 @@ public static string NewImageName([CallerMemberName] string callerMemberName = " var (normalizedName, warning, error) = ContainerHelpers.NormalizeRepository(callerMemberName); if (error is (var format, var args)) { - throw new ArgumentException(String.Format(Strings.ResourceManager.GetString(format)!, args)); + throw new ArgumentException(string.Format(Strings.ResourceManager.GetString(format)!, args)); } return normalizedName!; // non-null if error is null diff --git a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/TargetsTests.cs b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/TargetsTests.cs index 2f90edad0631..c5bbb2567e19 100644 --- a/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/TargetsTests.cs +++ b/src/Tests/Microsoft.NET.Build.Containers.IntegrationTests/TargetsTests.cs @@ -19,7 +19,7 @@ public void CanDeferEntrypoint(string selfContainedPropertyName, bool selfContai var (project, _, d) = ProjectInitializer.InitProject(new() { [selfContainedPropertyName] = selfContainedPropertyValue.ToString() - }, projectName: $"{nameof(CanDeferEntrypoint)}_{selfContainedPropertyName}_{selfContainedPropertyValue}_{String.Join("_", entrypointArgs)}"); + }, projectName: $"{nameof(CanDeferEntrypoint)}_{selfContainedPropertyName}_{selfContainedPropertyValue}_{string.Join("_", entrypointArgs)}"); using var _ = d; Assert.True(project.Build(ComputeContainerConfig)); var computedEntrypointArgs = project.GetItems(ContainerEntrypoint).Select(i => i.EvaluatedInclude).ToArray(); @@ -59,7 +59,7 @@ public void CanNormalizeInputContainerNames(string projectName, string expectedC }, projectName: $"{nameof(CanNormalizeInputContainerNames)}_{projectName}_{expectedContainerImageName}_{shouldPass}"); using var _ = d; var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None); - instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().Be(shouldPass, String.Join(Environment.NewLine, logger.AllMessages)); + instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().Be(shouldPass, string.Join(Environment.NewLine, logger.AllMessages)); Assert.Equal(expectedContainerImageName, instance.GetPropertyValue(ContainerRepository)); } @@ -80,7 +80,7 @@ public void CanWarnOnInvalidSDKVersions(string sdkVersion, bool isAllowed) using var _ = d; var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None); instance.Build(new[] { "_ContainerVerifySDKVersion" }, new[] { logger }, null, out var outputs).Should().Be(isAllowed); - var derivedIsAllowed = Boolean.Parse(project.GetProperty("_IsSDKContainerAllowedVersion").EvaluatedValue); + var derivedIsAllowed = bool.Parse(project.GetProperty("_IsSDKContainerAllowedVersion").EvaluatedValue); if (isAllowed) { logger.Errors.Should().HaveCount(0, "an error should not have been created"); @@ -133,7 +133,7 @@ public void ShouldNotIncludeSourceControlLabelsUnlessUserOptsIn(bool includeSour }, projectName: $"{nameof(ShouldNotIncludeSourceControlLabelsUnlessUserOptsIn)}_{includeSourceControl}"); using var _ = d; var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None); - instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().BeTrue("Build should have succeeded but failed due to {0}", String.Join("\n", logger.AllMessages)); + instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().BeTrue("Build should have succeeded but failed due to {0}", string.Join("\n", logger.AllMessages)); var labels = instance.GetItems(ContainerLabel); if (includeSourceControl) { @@ -179,7 +179,7 @@ public void CanComputeTagsForSupportedSDKVersions(string sdkVersion, string tfm, }, projectName: $"{nameof(CanComputeTagsForSupportedSDKVersions)}_{sdkVersion}_{tfm}_{expectedTag}"); using var _ = d; var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None); - instance.Build(new[] { "_ComputeContainerBaseImageTag" }, new[] { logger }, null, out var outputs).Should().BeTrue(String.Join(Environment.NewLine, logger.Errors)); + instance.Build(new[] { "_ComputeContainerBaseImageTag" }, new[] { logger }, null, out var outputs).Should().BeTrue(string.Join(Environment.NewLine, logger.Errors)); var computedTag = instance.GetProperty("_ContainerBaseImageTag").EvaluatedValue; computedTag.Should().Be(expectedTag); } @@ -202,7 +202,7 @@ public void CanComputeContainerUser(string tfm, string rid, string expectedUser) }, projectName: $"{nameof(CanComputeContainerUser)}_{tfm}_{rid}_{expectedUser}"); using var _ = d; var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None); - instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().BeTrue(String.Join(Environment.NewLine, logger.Errors)); + instance.Build(new[] { ComputeContainerConfig }, new[] { logger }, null, out var outputs).Should().BeTrue(string.Join(Environment.NewLine, logger.Errors)); var computedTag = instance.GetProperty("ContainerUser")?.EvaluatedValue; computedTag.Should().Be(expectedUser); } @@ -221,7 +221,7 @@ public void WindowsUsersGetLinuxContainers(string sdkPortableRid, string expecte }, projectName: $"{nameof(WindowsUsersGetLinuxContainers)}_{sdkPortableRid}_{expectedRid}"); using var _ = d; var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None); - instance.Build(new[] { ComputeContainerConfig }, null, null, out var outputs).Should().BeTrue(String.Join(Environment.NewLine, logger.Errors)); + instance.Build(new[] { ComputeContainerConfig }, null, null, out var outputs).Should().BeTrue(string.Join(Environment.NewLine, logger.Errors)); var computedRid = instance.GetProperty(KnownStrings.Properties.ContainerRuntimeIdentifier)?.EvaluatedValue; computedRid.Should().Be(expectedRid); } @@ -243,7 +243,7 @@ public void CanTakeContainerBaseFamilyIntoAccount(string sdkVersion, string tfmM }, projectName: $"{nameof(CanTakeContainerBaseFamilyIntoAccount)}_{sdkVersion}_{tfmMajMin}_{containerFamily}_{expectedTag}"); using var _ = d; var instance = project.CreateProjectInstance(global::Microsoft.Build.Execution.ProjectInstanceSettings.None); - instance.Build(new[] { _ComputeContainerBaseImageTag }, null, null, out var outputs).Should().BeTrue(String.Join(Environment.NewLine, logger.Errors)); + instance.Build(new[] { _ComputeContainerBaseImageTag }, null, null, out var outputs).Should().BeTrue(string.Join(Environment.NewLine, logger.Errors)); var computedBaseImageTag = instance.GetProperty(KnownStrings.Properties._ContainerBaseImageTag)?.EvaluatedValue; computedBaseImageTag.Should().Be(expectedTag); } diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithLibrariesAndRid.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithLibrariesAndRid.cs index ae47d39b56d8..a05d354f3651 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithLibrariesAndRid.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithLibrariesAndRid.cs @@ -106,7 +106,7 @@ public void It_builds_a_framework_dependent_RID_specific_runnable_output() $"libuv{FileConstants.DynamicLibSuffix}" }; - outputDirectory.Should().OnlyHaveFiles(expectedFiles.Where(x => !String.IsNullOrEmpty(x)).ToList()); + outputDirectory.Should().OnlyHaveFiles(expectedFiles.Where(x => !string.IsNullOrEmpty(x)).ToList()); new DotnetCommand(Log, Path.Combine(outputDirectory.FullName, "App.dll")) .Execute() diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs index e259797d1dee..fc7e71781cee 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishASelfContainedApp.cs @@ -94,7 +94,7 @@ public void It_can_make_a_Windows_GUI_exe() targetFramework: TargetFramework, runtimeIdentifier: runtimeIdentifier).FullName; byte[] fileContent = File.ReadAllBytes(Path.Combine(outputDirectory, TestProjectName + ".exe")); - UInt32 peHeaderOffset = BitConverter.ToUInt32(fileContent, PEHeaderPointerOffset); + uint peHeaderOffset = BitConverter.ToUInt32(fileContent, PEHeaderPointerOffset); BitConverter .ToUInt16(fileContent, (int)(peHeaderOffset + SubsystemOffset)) .Should() diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackRelease.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackRelease.cs index fbdeee9b0f51..5ec12445ce7e 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackRelease.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackRelease.cs @@ -41,7 +41,7 @@ public GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackReleas List testProjects = new List(); var testProject = new TestProject("TestProject") { - TargetFrameworks = String.Join(";", exeProjTfms), + TargetFrameworks = string.Join(";", exeProjTfms), IsExe = true }; testProject.RecordProperties("Configuration", "Optimize", PReleaseProperty); @@ -52,7 +52,7 @@ public GivenThatWeWantToTestAMultitargetedSolutionWithPublishReleaseOrPackReleas var libraryProject = new TestProject("LibraryProject") { - TargetFrameworks = String.Join(";", libraryProjTfms), + TargetFrameworks = string.Join(";", libraryProjTfms), IsExe = false }; libraryProject.RecordProperties("Configuration", "Optimize", PReleaseProperty); @@ -271,7 +271,7 @@ public void ItFailsIfNet7DefinesPublishReleaseFalseButNet8PlusDefinesNone() .Should() .Fail() .And - .HaveStdErrContaining(String.Format(Strings.SolutionProjectConfigurationsConflict, PublishRelease, "")); ; + .HaveStdErrContaining(string.Format(Strings.SolutionProjectConfigurationsConflict, PublishRelease, "")); ; } [Fact] diff --git a/src/Tests/Microsoft.NET.Publish.Tests/PublishDepsFilePathTests.cs b/src/Tests/Microsoft.NET.Publish.Tests/PublishDepsFilePathTests.cs index d67653cef8c7..e55975a3132b 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/PublishDepsFilePathTests.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/PublishDepsFilePathTests.cs @@ -41,7 +41,7 @@ public void PublishDepsFilePathIsEmptyForSingleFileApps() var targetFramework = testProject.TargetFrameworks; var publishDepsFilePath = GetPropertyValue(projectPath, targetFramework, "PublishDepsFilePath"); - String.IsNullOrEmpty(publishDepsFilePath).Should().BeTrue(); + string.IsNullOrEmpty(publishDepsFilePath).Should().BeTrue(); } string GetPropertyValue(string projectPath, string targetFramework, string property) diff --git a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs index dcdf8a758dfd..dc2dd85448a3 100644 --- a/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs +++ b/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmBuildIntegrationTest.cs @@ -739,7 +739,7 @@ public void Build_WithJiterpreter_Advanced() private void BuildWasmMinimalAndValidateBootConfig((string name, string value)[] properties, Action validateBootConfig) { var testAppName = "BlazorWasmMinimal"; - var testInstance = CreateAspNetSdkTestAsset(testAppName, identifier: String.Join("-", properties.Select(p => p.name + p.value ?? "null"))); + var testInstance = CreateAspNetSdkTestAsset(testAppName, identifier: string.Join("-", properties.Select(p => p.name + p.value ?? "null"))); foreach (var property in properties) { diff --git a/src/Tests/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs b/src/Tests/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs index 1f397b66e283..264dd4a1fdbc 100644 --- a/src/Tests/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs +++ b/src/Tests/Microsoft.NET.TestFramework/Assertions/StringAssertionsExtensions.cs @@ -17,7 +17,7 @@ private static string NormalizeLineEndings(string s) public static AndConstraint BeVisuallyEquivalentTo(this StringAssertions assertions, string expected, string because = "", params object[] becauseArgs) { Execute.Assertion - .ForCondition(String.Compare(NormalizeLineEndings(assertions.Subject), NormalizeLineEndings(expected), CultureInfo.CurrentCulture, CompareOptions.IgnoreSymbols) == 0) + .ForCondition(string.Compare(NormalizeLineEndings(assertions.Subject), NormalizeLineEndings(expected), CultureInfo.CurrentCulture, CompareOptions.IgnoreSymbols) == 0) .BecauseOf(because, becauseArgs) .FailWith($"String \"{assertions.Subject}\" is not visually equivalent to expected string \"{expected}\"."); diff --git a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs index 6e28bec5f1aa..d3fbb0dfa379 100644 --- a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs +++ b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs @@ -278,7 +278,7 @@ internal void Create(TestAsset targetTestAsset, string testProjectsSourceFolder, if (SelfContained != "") { - propertyGroup.Add(new XElement(ns + "SelfContained", String.Equals(SelfContained, "true", StringComparison.OrdinalIgnoreCase) ? "true" : "false")); + propertyGroup.Add(new XElement(ns + "SelfContained", string.Equals(SelfContained, "true", StringComparison.OrdinalIgnoreCase) ? "true" : "false")); } if (ReferencedProjects.Any()) @@ -497,7 +497,7 @@ public Dictionary GetPropertyValues(string testRoot, string targ if (colonIndex > 0) { string propertyName = line.Substring(0, colonIndex); - string propertyValue = line.Length == colonIndex + 1 ? String.Empty : line.Substring(colonIndex + 2); + string propertyValue = line.Length == colonIndex + 1 ? string.Empty : line.Substring(colonIndex + 2); propertyValues[propertyName] = propertyValue; } } diff --git a/src/Tests/Microsoft.NET.TestFramework/TestAssetsManager.cs b/src/Tests/Microsoft.NET.TestFramework/TestAssetsManager.cs index 1c747316663f..f77da496f781 100644 --- a/src/Tests/Microsoft.NET.TestFramework/TestAssetsManager.cs +++ b/src/Tests/Microsoft.NET.TestFramework/TestAssetsManager.cs @@ -10,7 +10,7 @@ public class TestAssetsManager { public string TestAssetsRoot { get; private set; } - private List TestDestinationDirectories { get; } = new List(); + private List TestDestinationDirectories { get; } = new List(); protected ITestOutputHelper Log { get; } diff --git a/src/Tests/Microsoft.NET.TestFramework/TestPackageReference.cs b/src/Tests/Microsoft.NET.TestFramework/TestPackageReference.cs index e44a279ae3d3..f58a57ba3991 100644 --- a/src/Tests/Microsoft.NET.TestFramework/TestPackageReference.cs +++ b/src/Tests/Microsoft.NET.TestFramework/TestPackageReference.cs @@ -25,7 +25,7 @@ public TestPackageReference(string id, string version = null, string nupkgPath = public bool UpdatePackageReference { get; private set; } public bool NuGetPackageExists() { - return File.Exists(Path.Combine(NupkgPath, String.Concat(ID + "." + Version + ".nupkg"))); + return File.Exists(Path.Combine(NupkgPath, string.Concat(ID + "." + Version + ".nupkg"))); } } } diff --git a/src/Tests/Microsoft.Win32.Msi.Manual.Tests/Program.cs b/src/Tests/Microsoft.Win32.Msi.Manual.Tests/Program.cs index 690dc0f5910a..b140a87655df 100644 --- a/src/Tests/Microsoft.Win32.Msi.Manual.Tests/Program.cs +++ b/src/Tests/Microsoft.Win32.Msi.Manual.Tests/Program.cs @@ -104,7 +104,7 @@ void ClearLine() Console.SetCursorPosition(0, top); } - void OnActionData(Object sender, ActionDataEventArgs e) + void OnActionData(object sender, ActionDataEventArgs e) { if (ActionDataEnabled) { @@ -115,7 +115,7 @@ void OnActionData(Object sender, ActionDataEventArgs e) e.Result = DialogResult.IDOK; } - void OnActionStart(Object send, ActionStartEventArgs e) + void OnActionStart(object send, ActionStartEventArgs e) { if (ActionDataEnabled) { @@ -134,7 +134,7 @@ void OnActionStart(Object send, ActionStartEventArgs e) e.Result = DialogResult.IDOK; } - void OnProgress(Object send, ProgressEventArgs e) + void OnProgress(object send, ProgressEventArgs e) { e.Result = DialogResult.IDOK; diff --git a/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsVbProj.cs b/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsVbProj.cs index da047095d427..cd39acaa7629 100644 --- a/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsVbProj.cs +++ b/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsVbProj.cs @@ -46,7 +46,7 @@ public void ItFailsWhenTryingToUseLaunchProfileSharingTheSameNameWithAnotherProf .WithWorkingDirectory(testInstance.Path) .Execute("--launch-profile", "first"); - string expectedError = String.Format(LocalizableStrings.DuplicateCaseInsensitiveLaunchProfileNames, "\tfirst," + (OperatingSystem.IsWindows() ? "\r" : "") + "\n\tFIRST"); + string expectedError = string.Format(LocalizableStrings.DuplicateCaseInsensitiveLaunchProfileNames, "\tfirst," + (OperatingSystem.IsWindows() ? "\r" : "") + "\n\tFIRST"); runResult .Should() .Fail() @@ -69,7 +69,7 @@ public void ItFailsWithSpecificErrorMessageIfLaunchProfileDoesntExist() .Should() .Pass() .And - .HaveStdErrContaining(String.Format(LocalizableStrings.LaunchProfileDoesNotExist, invalidLaunchProfileName)); + .HaveStdErrContaining(string.Format(LocalizableStrings.LaunchProfileDoesNotExist, invalidLaunchProfileName)); } [Theory] diff --git a/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index 1ee0cc229fa4..c0dd197651fc 100644 --- a/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -241,7 +241,7 @@ public void TestWillCreateTrxLoggerInTheSpecifiedResultsDirectoryBySwitch() .Execute("--logger", "trx", "--results-directory", trxLoggerDirectory); // Verify - String[] trxFiles = Directory.GetFiles(trxLoggerDirectory, "*.trx"); + string[] trxFiles = Directory.GetFiles(trxLoggerDirectory, "*.trx"); Assert.Single(trxFiles); result.StdOut.Should().Contain(trxFiles[0]); diff --git a/src/Tests/dotnet-workload-install.Tests/GivenDotnetWorkloadInstall.cs b/src/Tests/dotnet-workload-install.Tests/GivenDotnetWorkloadInstall.cs index e70abd5297c9..3038ffcd8095 100644 --- a/src/Tests/dotnet-workload-install.Tests/GivenDotnetWorkloadInstall.cs +++ b/src/Tests/dotnet-workload-install.Tests/GivenDotnetWorkloadInstall.cs @@ -37,7 +37,7 @@ public void GivenWorkloadInstallItErrorsOnFakeWorkloadName() .Should() .Fail() .And - .HaveStdErrContaining(String.Format(Workloads.Workload.Install.LocalizableStrings.WorkloadNotRecognized, "fake")); + .HaveStdErrContaining(string.Format(Workloads.Workload.Install.LocalizableStrings.WorkloadNotRecognized, "fake")); } [Fact(Skip = "https://github.com/dotnet/sdk/issues/26624")] @@ -51,7 +51,7 @@ public void ItErrorUsingSkipManifestAndRollback() .Should() .Fail() .And - .HaveStdErrContaining(String.Format(Workloads.Workload.Install.LocalizableStrings.CannotCombineSkipManifestAndRollback, "skip-manifest-update", "from-rollback-file", "skip-manifest-update", "from-rollback-file")); + .HaveStdErrContaining(string.Format(Workloads.Workload.Install.LocalizableStrings.CannotCombineSkipManifestAndRollback, "skip-manifest-update", "from-rollback-file", "skip-manifest-update", "from-rollback-file")); } @@ -328,7 +328,7 @@ public void GivenWorkloadInstallItErrorsOnUnsupportedPlatform() var exceptionThrown = Assert.Throws(() => new WorkloadInstallCommand(parseResult, reporter: _reporter, workloadResolver: workloadResolver, workloadInstaller: installer, nugetPackageDownloader: nugetDownloader, workloadManifestUpdater: manifestUpdater, userProfileDir: testDirectory, dotnetDir: dotnetRoot, version: "6.0.100", installedFeatureBand: "6.0.100")); - exceptionThrown.Message.Should().Be(String.Format(Workloads.Workload.Install.LocalizableStrings.WorkloadNotSupportedOnPlatform, mockWorkloadId)); + exceptionThrown.Message.Should().Be(string.Format(Workloads.Workload.Install.LocalizableStrings.WorkloadNotSupportedOnPlatform, mockWorkloadId)); } [Theory] @@ -583,7 +583,7 @@ public void ShowManifestUpdatesWhenVerbosityIsDetailedOrDiagnostic(string verbos installManager.InstallWorkloads(new List(), false); // Don't actually do any installs, just update manifests string.Join(" ", _reporter.Lines).Should().Contain(Workloads.Workload.Install.LocalizableStrings.CheckForUpdatedWorkloadManifests); - string.Join(" ", _reporter.Lines).Should().Contain(String.Format(Workloads.Workload.Install.LocalizableStrings.CheckForUpdatedWorkloadManifests, "mock-manifest")); + string.Join(" ", _reporter.Lines).Should().Contain(string.Format(Workloads.Workload.Install.LocalizableStrings.CheckForUpdatedWorkloadManifests, "mock-manifest")); } private string AppendForUserLocal(string identifier, bool userLocal) diff --git a/src/Tests/dotnet-workload-install.Tests/GivenWorkloadManifestUpdater.cs b/src/Tests/dotnet-workload-install.Tests/GivenWorkloadManifestUpdater.cs index aec297b76db5..df7863887220 100644 --- a/src/Tests/dotnet-workload-install.Tests/GivenWorkloadManifestUpdater.cs +++ b/src/Tests/dotnet-workload-install.Tests/GivenWorkloadManifestUpdater.cs @@ -271,7 +271,7 @@ public void ItCanFallbackAndAdvertiseCorrectUpdate(bool useOfflineCache) // check that update did not fail _reporter.Lines.Should().NotContain(l => l.ToLowerInvariant().Contains("fail")); - _reporter.Lines.Should().NotContain(String.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName)); + _reporter.Lines.Should().NotContain(string.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName)); } @@ -339,7 +339,7 @@ public void ItCanFallbackWithNoUpdates(bool useOfflineCache) // Assert _reporter.Lines.Should().NotContain(l => l.ToLowerInvariant().Contains("fail")); - _reporter.Lines.Should().Contain(String.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName)); + _reporter.Lines.Should().Contain(string.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName)); } [Theory] @@ -405,7 +405,7 @@ public void GivenNoUpdatesAreAvailableAndNoRollbackItGivesAppropriateMessage(boo Directory.GetFiles(adManifestDir).Should().BeEmpty(); _reporter.Lines.Should().NotContain(l => l.ToLowerInvariant().Contains("fail")); - _reporter.Lines.Should().Contain(String.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName)); + _reporter.Lines.Should().Contain(string.Format(Workloads.Workload.Install.LocalizableStrings.AdManifestPackageDoesNotExist, testManifestName)); } [Fact] diff --git a/src/WebSdk/Publish/Tasks/Kudu/KuduConnect.cs b/src/WebSdk/Publish/Tasks/Kudu/KuduConnect.cs index 07cb33cfd89e..7505b53a53cc 100644 --- a/src/WebSdk/Publish/Tasks/Kudu/KuduConnect.cs +++ b/src/WebSdk/Publish/Tasks/Kudu/KuduConnect.cs @@ -33,7 +33,7 @@ protected string AuthorizationInfo { lock (_syncObject) { - string authInfo = String.Format("{0}:{1}", _connectionInfo.UserName, _connectionInfo.Password); + string authInfo = string.Format("{0}:{1}", _connectionInfo.UserName, _connectionInfo.Password); return Convert.ToBase64String(Encoding.UTF8.GetBytes(authInfo)); } } diff --git a/src/WebSdk/Publish/Tasks/Kudu/KuduVfsDeploy.cs b/src/WebSdk/Publish/Tasks/Kudu/KuduVfsDeploy.cs index b18edca37c03..fb73a958d274 100644 --- a/src/WebSdk/Publish/Tasks/Kudu/KuduVfsDeploy.cs +++ b/src/WebSdk/Publish/Tasks/Kudu/KuduVfsDeploy.cs @@ -24,7 +24,7 @@ public override string DestinationUrl { get { - return String.Format(ConnectionInfo.DestinationUrl, ConnectionInfo.SiteName, "vfs/site/wwwroot/"); + return string.Format(ConnectionInfo.DestinationUrl, ConnectionInfo.SiteName, "vfs/site/wwwroot/"); } } @@ -51,7 +51,7 @@ private System.Threading.Tasks.Task PostFilesAsync(string file, string sourcePat return System.Threading.Tasks.Task.Run( async () => { - string relPath = file.Replace(sourcePath, String.Empty); + string relPath = file.Replace(sourcePath, string.Empty); string relUrl = relPath.Replace(Path.DirectorySeparatorChar, '/'); string apiUrl = DestinationUrl + relUrl; @@ -74,14 +74,14 @@ private System.Threading.Tasks.Task PostFilesAsync(string file, string sourcePat { lock (_syncObject) { - _logger.LogMessage(Microsoft.Build.Framework.MessageImportance.High, String.Format(Resources.KUDUDEPLOY_AddingFileFailed, ConnectionInfo.SiteName + "/" + relUrl, response.ReasonPhrase)); + _logger.LogMessage(Microsoft.Build.Framework.MessageImportance.High, string.Format(Resources.KUDUDEPLOY_AddingFileFailed, ConnectionInfo.SiteName + "/" + relUrl, response.ReasonPhrase)); } } else { lock (_syncObject) { - _logger.LogMessage(Microsoft.Build.Framework.MessageImportance.High, String.Format(Resources.KUDUDEPLOY_AddingFile, ConnectionInfo.SiteName + "/" + relUrl)); + _logger.LogMessage(Microsoft.Build.Framework.MessageImportance.High, string.Format(Resources.KUDUDEPLOY_AddingFile, ConnectionInfo.SiteName + "/" + relUrl)); } } } diff --git a/src/WebSdk/Publish/Tasks/Kudu/KuduZipDeploy.cs b/src/WebSdk/Publish/Tasks/Kudu/KuduZipDeploy.cs index 4cd09a605529..c2420fab9bb9 100644 --- a/src/WebSdk/Publish/Tasks/Kudu/KuduZipDeploy.cs +++ b/src/WebSdk/Publish/Tasks/Kudu/KuduZipDeploy.cs @@ -21,7 +21,7 @@ public override string DestinationUrl { get { - return String.Format(ConnectionInfo.DestinationUrl, ConnectionInfo.SiteName, "zip/site/wwwroot/"); + return string.Format(ConnectionInfo.DestinationUrl, ConnectionInfo.SiteName, "zip/site/wwwroot/"); } } @@ -31,7 +31,7 @@ public async System.Threading.Tasks.Task DeployAsync(string zipFileFullPat if (!File.Exists(zipFileFullPath)) { // If the source file directory does not exist quit early. - _logger.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_DeployOutputPathEmpty)); + _logger.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_DeployOutputPathEmpty)); return false; } @@ -41,7 +41,7 @@ public async System.Threading.Tasks.Task DeployAsync(string zipFileFullPat private async System.Threading.Tasks.Task PostZipAsync(string zipFilePath) { - if (String.IsNullOrEmpty(zipFilePath)) + if (string.IsNullOrEmpty(zipFilePath)) { return false; } @@ -63,7 +63,7 @@ private async System.Threading.Tasks.Task PostZipAsync(string zipFilePath) { if (!response.IsSuccessStatusCode) { - _logger.LogError(String.Format(Resources.KUDUDEPLOY_PublishZipFailedReason, ConnectionInfo.SiteName, response.ReasonPhrase)); + _logger.LogError(string.Format(Resources.KUDUDEPLOY_PublishZipFailedReason, ConnectionInfo.SiteName, response.ReasonPhrase)); return false; } } diff --git a/src/WebSdk/Publish/Tasks/Tasks/Kudu/KuduDeploy.cs b/src/WebSdk/Publish/Tasks/Tasks/Kudu/KuduDeploy.cs index 9ddaa9c05c40..f8b2e8d26e9d 100644 --- a/src/WebSdk/Publish/Tasks/Tasks/Kudu/KuduDeploy.cs +++ b/src/WebSdk/Publish/Tasks/Tasks/Kudu/KuduDeploy.cs @@ -73,14 +73,14 @@ internal KuduConnectionInfo GetConnectionInfo() public override bool Execute() { - if (String.IsNullOrEmpty(PublishIntermediateOutputPath)) + if (string.IsNullOrEmpty(PublishIntermediateOutputPath)) { Log.LogError(Resources.KUDUDEPLOY_DeployOutputPathEmpty); return false; } KuduConnectionInfo connectionInfo = GetConnectionInfo(); - if (String.IsNullOrEmpty(connectionInfo.UserName) || String.IsNullOrEmpty(connectionInfo.Password) || String.IsNullOrEmpty(connectionInfo.DestinationUrl)) + if (string.IsNullOrEmpty(connectionInfo.UserName) || string.IsNullOrEmpty(connectionInfo.Password) || string.IsNullOrEmpty(connectionInfo.DestinationUrl)) { Log.LogError(Resources.KUDUDEPLOY_ConnectionInfoMissing); return false; @@ -118,12 +118,12 @@ internal bool DeployFiles(KuduConnectionInfo connectionInfo) success = deployTask.Wait(TimeoutMilliseconds); if (!success) { - Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_OperationTimeout)); + Log.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_OperationTimeout)); } } catch (AggregateException ae) { - Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, ae.Flatten().Message)); + Log.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, ae.Flatten().Message)); success = false; } @@ -144,12 +144,12 @@ internal bool DeployZipFile(KuduConnectionInfo connectionInfo) success = zipTask.Wait(TimeoutMilliseconds); if (!success) { - Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_OperationTimeout)); + Log.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_OperationTimeout)); } } catch (AggregateException ae) { - Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, ae.Flatten().Message)); + Log.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, ae.Flatten().Message)); success = false; } @@ -162,8 +162,8 @@ internal bool DeployZipFile(KuduConnectionInfo connectionInfo) internal string CreateZipFile(string sourcePath) { // Zip the files from PublishOutput path. - string zipFileFullPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), String.Format("Publish{0}.zip", new Random().Next(Int32.MaxValue))); - Log.LogMessage(Microsoft.Build.Framework.MessageImportance.High, String.Format(Resources.KUDUDEPLOY_CopyingToTempLocation, zipFileFullPath)); + string zipFileFullPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), string.Format("Publish{0}.zip", new Random().Next(int.MaxValue))); + Log.LogMessage(Microsoft.Build.Framework.MessageImportance.High, string.Format(Resources.KUDUDEPLOY_CopyingToTempLocation, zipFileFullPath)); try { @@ -171,7 +171,7 @@ internal string CreateZipFile(string sourcePath) } catch (Exception e) { - Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, e.Message)); + Log.LogError(string.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, e.Message)); // If we are unable to zip the file, then we fail. return null; } diff --git a/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/GetPassword.cs b/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/GetPassword.cs index 41fe0907f368..3d085cfd2505 100644 --- a/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/GetPassword.cs +++ b/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/GetPassword.cs @@ -33,7 +33,7 @@ public string GetClearTextPassword(string base64EncodedString) return GetClearTextPassword(encryptedData); } - public static string GetClearTextPassword(Byte[] encryptedData) + public static string GetClearTextPassword(byte[] encryptedData) { if (encryptedData == null) { @@ -44,7 +44,7 @@ public static string GetClearTextPassword(Byte[] encryptedData) try { #pragma warning disable CA1416 // This functionality is only expected to work in Windows. - Byte[] uncrypted = System.Security.Cryptography.ProtectedData.Unprotect(encryptedData, null, System.Security.Cryptography.DataProtectionScope.CurrentUser); + byte[] uncrypted = System.Security.Cryptography.ProtectedData.Unprotect(encryptedData, null, System.Security.Cryptography.DataProtectionScope.CurrentUser); #pragma warning restore CA1416 // This functionality is only expected to work in Windows. plainPWD = Encoding.Unicode.GetString(uncrypted); } diff --git a/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/VsMsdeploy.cs b/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/VsMsdeploy.cs index 45bed329f597..76abef1fa857 100644 --- a/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/VsMsdeploy.cs +++ b/src/WebSdk/Publish/Tasks/Tasks/MsDeploy/VsMsdeploy.cs @@ -450,7 +450,7 @@ protected override void BeforeSync() // Utility function to log all public instance property to CustomerBuildEventArgs - private static void AddAllPropertiesToCustomBuildWithPropertyEventArgs(CustomBuildWithPropertiesEventArgs cbpEventArg, System.Object obj) + private static void AddAllPropertiesToCustomBuildWithPropertyEventArgs(CustomBuildWithPropertiesEventArgs cbpEventArg, object obj) { #if NET472 if (obj != null) diff --git a/src/WebSdk/Publish/Tasks/Tasks/ValidateParameter.cs b/src/WebSdk/Publish/Tasks/Tasks/ValidateParameter.cs index 3480155a1363..a6f21a24fbc0 100644 --- a/src/WebSdk/Publish/Tasks/Tasks/ValidateParameter.cs +++ b/src/WebSdk/Publish/Tasks/Tasks/ValidateParameter.cs @@ -16,9 +16,9 @@ public class ValidateParameter : Build.Utilities.Task public override bool Execute() { - if (String.IsNullOrEmpty(ParameterValue)) + if (string.IsNullOrEmpty(ParameterValue)) { - Log.LogError(String.Format(CultureInfo.CurrentCulture, Resources.ValidateParameter_ArgumentNullError, ParameterName)); + Log.LogError(string.Format(CultureInfo.CurrentCulture, Resources.ValidateParameter_ArgumentNullError, ParameterName)); return false; } diff --git a/src/WebSdk/Publish/Tasks/Tasks/Xdt/TaskTransformationLogger.cs b/src/WebSdk/Publish/Tasks/Tasks/Xdt/TaskTransformationLogger.cs index 32a631025d62..ddc5d8ba92d4 100644 --- a/src/WebSdk/Publish/Tasks/Tasks/Xdt/TaskTransformationLogger.cs +++ b/src/WebSdk/Publish/Tasks/Tasks/Xdt/TaskTransformationLogger.cs @@ -37,7 +37,7 @@ private string IndentString { if (indentString == null) { - indentString = String.Empty; + indentString = string.Empty; for (int i = 0; i < indentLevel; i++) { indentString += indentStringPiece; @@ -86,7 +86,7 @@ void IXmlTransformationLogger.LogMessage(MessageType type, string message, param break; } - loggingHelper.LogMessage(importance, String.Concat(IndentString, message), messageArgs); + loggingHelper.LogMessage(importance, string.Concat(IndentString, message), messageArgs); } void IXmlTransformationLogger.LogWarning(string message, params object[] messageArgs) @@ -161,7 +161,7 @@ void IXmlTransformationLogger.LogErrorFromException(Exception ex, string file, i { sb.AppendFormat("{0} : {1}", exIterator.GetType().Name, exIterator.Message); sb.AppendLine(); - if (!String.IsNullOrEmpty(exIterator.StackTrace)) + if (!string.IsNullOrEmpty(exIterator.StackTrace)) { sb.Append(exIterator.StackTrace); } diff --git a/src/WebSdk/Publish/Tasks/Tasks/Xdt/TransformXml.cs b/src/WebSdk/Publish/Tasks/Tasks/Xdt/TransformXml.cs index 4fe3c7ea659c..69ab1dcdeb81 100644 --- a/src/WebSdk/Publish/Tasks/Tasks/Xdt/TransformXml.cs +++ b/src/WebSdk/Publish/Tasks/Tasks/Xdt/TransformXml.cs @@ -19,7 +19,7 @@ public class TransformXml : Task private bool stackTrace = false; [Required] - public String Source + public string Source { get { @@ -42,7 +42,7 @@ public bool IgnoreError [Required] - public String Transform + public string Transform { get { @@ -72,7 +72,7 @@ public string TransformRootPath [Required] - public String Destination + public string Destination { get { diff --git a/src/WebSdk/Publish/Tasks/WebConfigTransform.cs b/src/WebSdk/Publish/Tasks/WebConfigTransform.cs index d5a583d59226..d23a99fd9234 100644 --- a/src/WebSdk/Publish/Tasks/WebConfigTransform.cs +++ b/src/WebSdk/Publish/Tasks/WebConfigTransform.cs @@ -117,7 +117,7 @@ private static void TransformAspNetCore(XElement aspNetCoreElement, string appNa // if the app path is already there in the web.config, don't do anything. if (string.Equals(appPath, (string)argumentsAttribute, StringComparison.OrdinalIgnoreCase)) { - appPath = String.Empty; + appPath = string.Empty; } attributes.Insert(processPathIndex + 1, new XAttribute("arguments", (appPath + " " + (string)argumentsAttribute).Trim()));