Skip to content

Commit 13f25fc

Browse files
committed
Applied cleanup for IDE0049 to the solution.
1 parent bb86103 commit 13f25fc

File tree

60 files changed

+171
-171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+171
-171
lines changed

src/BuiltInTools/dotnet-watch/Internal/ProcessRunner.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public ProcessState(Process process, IReporter reporter)
182182
// events.
183183
//
184184
// See the remarks here: https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.waitforexit#System_Diagnostics_Process_WaitForExit_System_Int32_
185-
if (!_process.WaitForExit(Int32.MaxValue))
185+
if (!_process.WaitForExit(int.MaxValue))
186186
{
187187
throw new TimeoutException();
188188
}

src/Cli/Microsoft.DotNet.Cli.Sln.Internal/SlnFile.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ private SlnSectionType ToSectionType(int curLineNum, string s)
504504
}
505505
throw new InvalidSolutionFormatException(
506506
curLineNum,
507-
String.Format(LocalizableStrings.InvalidSectionTypeError, s));
507+
string.Format(LocalizableStrings.InvalidSectionTypeError, s));
508508
}
509509

510510
private string FromSectionType(bool isProjectSection, SlnSectionType type)

src/Cli/Microsoft.DotNet.Cli.Utils/NativeMethods.cs

+12-12
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@ internal enum JobObjectLimitFlags : uint
2323
[StructLayout(LayoutKind.Sequential)]
2424
internal struct JobObjectBasicLimitInformation
2525
{
26-
public Int64 PerProcessUserTimeLimit;
27-
public Int64 PerJobUserTimeLimit;
26+
public long PerProcessUserTimeLimit;
27+
public long PerJobUserTimeLimit;
2828
public JobObjectLimitFlags LimitFlags;
2929
public UIntPtr MinimumWorkingSetSize;
3030
public UIntPtr MaximumWorkingSetSize;
31-
public UInt32 ActiveProcessLimit;
31+
public uint ActiveProcessLimit;
3232
public UIntPtr Affinity;
33-
public UInt32 PriorityClass;
34-
public UInt32 SchedulingClass;
33+
public uint PriorityClass;
34+
public uint SchedulingClass;
3535
}
3636

3737
[StructLayout(LayoutKind.Sequential)]
3838
internal struct IoCounters
3939
{
40-
public UInt64 ReadOperationCount;
41-
public UInt64 WriteOperationCount;
42-
public UInt64 OtherOperationCount;
43-
public UInt64 ReadTransferCount;
44-
public UInt64 WriteTransferCount;
45-
public UInt64 OtherTransferCount;
40+
public ulong ReadOperationCount;
41+
public ulong WriteOperationCount;
42+
public ulong OtherOperationCount;
43+
public ulong ReadTransferCount;
44+
public ulong WriteTransferCount;
45+
public ulong OtherTransferCount;
4646
}
4747

4848
[StructLayout(LayoutKind.Sequential)]
@@ -73,7 +73,7 @@ internal struct PROCESS_BASIC_INFORMATION
7373
internal static extern SafeWaitHandle CreateJobObjectW(IntPtr lpJobAttributes, string lpName);
7474

7575
[DllImport("kernel32.dll", SetLastError = true)]
76-
internal static extern bool SetInformationJobObject(IntPtr hJob, JobObjectInfoClass jobObjectInformationClass, IntPtr lpJobObjectInformation, UInt32 cbJobObjectInformationLength);
76+
internal static extern bool SetInformationJobObject(IntPtr hJob, JobObjectInfoClass jobObjectInformationClass, IntPtr lpJobObjectInformation, uint cbJobObjectInformationLength);
7777

7878
[DllImport("kernel32.dll", SetLastError = true)]
7979
internal static extern bool AssignProcessToJobObject(IntPtr hJob, IntPtr hProcess);

src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private static string GetFreeBSDVersion()
8282
// This is same as sysctl kern.version
8383
// FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016 [email protected]:/usr/obj/usr/src/sys/GENERIC
8484
// What we want is major release as minor releases should be compatible.
85-
String version = RuntimeInformation.OSDescription;
85+
string version = RuntimeInformation.OSDescription;
8686
try
8787
{
8888
// second token up to first dot

src/Cli/Microsoft.DotNet.Cli.Utils/UILanguageOverride.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private static bool CurrentPlatformOfficiallySupportsUTF8Encoding()
126126

127127
private static bool ForceUniversalEncodingOptInEnabled()
128128
{
129-
return String.Equals(Environment.GetEnvironmentVariable("DOTNET_CLI_FORCE_UTF8_ENCODING"), "true", StringComparison.OrdinalIgnoreCase);
129+
return string.Equals(Environment.GetEnvironmentVariable("DOTNET_CLI_FORCE_UTF8_ENCODING"), "true", StringComparison.OrdinalIgnoreCase);
130130
}
131131
}
132132
}

src/Cli/dotnet/Installer/Windows/InstallClientElevationContext.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public override void Elevate()
7575
}
7676
}
7777

78-
private void ServerExited(Object sender, EventArgs e)
78+
private void ServerExited(object sender, EventArgs e)
7979
{
8080
_log?.LogMessage($"Elevated command instance has exited.");
8181
}

src/Cli/dotnet/ReleasePropertyProjectLocator.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public IEnumerable<string> GetCustomDefaultConfigurationValueIfSpecified()
6262
// Setup
6363
Debug.Assert(_propertyToCheck == MSBuildPropertyNames.PUBLISH_RELEASE || _propertyToCheck == MSBuildPropertyNames.PACK_RELEASE, "Only PackRelease or PublishRelease are currently expected.");
6464
var nothing = Enumerable.Empty<string>();
65-
if (String.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DISABLE_PUBLISH_AND_PACK_RELEASE), "true", StringComparison.OrdinalIgnoreCase))
65+
if (string.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DISABLE_PUBLISH_AND_PACK_RELEASE), "true", StringComparison.OrdinalIgnoreCase))
6666
{
6767
return nothing;
6868
}
@@ -160,7 +160,7 @@ public IEnumerable<string> GetCustomDefaultConfigurationValueIfSpecified()
160160
HashSet<string> configValues = new HashSet<string>();
161161
object projectDataLock = new object();
162162

163-
if (String.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DOTNET_CLI_LAZY_PUBLISH_AND_PACK_RELEASE_FOR_SOLUTIONS), "true", StringComparison.OrdinalIgnoreCase))
163+
if (string.Equals(Environment.GetEnvironmentVariable(EnvironmentVariableNames.DOTNET_CLI_LAZY_PUBLISH_AND_PACK_RELEASE_FOR_SOLUTIONS), "true", StringComparison.OrdinalIgnoreCase))
164164
{
165165
// 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.)
166166
return GetSingleProjectFromSolution(sln, globalProps);
@@ -197,7 +197,7 @@ public IEnumerable<string> GetCustomDefaultConfigurationValueIfSpecified()
197197
// 1) This error should not be thrown in VS because it is part of the SDK CLI code
198198
// 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
199199
// 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
200-
throw new GracefulException(Strings.SolutionProjectConfigurationsConflict, _propertyToCheck, String.Join("\n", (configuredProjects).Select(x => x.FullPath)));
200+
throw new GracefulException(Strings.SolutionProjectConfigurationsConflict, _propertyToCheck, string.Join("\n", (configuredProjects).Select(x => x.FullPath)));
201201
}
202202
return configuredProjects.FirstOrDefault();
203203
}

src/Cli/dotnet/SlnFileExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ private static string GetMatchingProjectKey(IDictionary<string, string> projectK
205205
return projectKey;
206206
}
207207

208-
var keyWithoutWhitespace = String.Concat(solutionKey.Where(c => !Char.IsWhiteSpace(c)));
208+
var keyWithoutWhitespace = string.Concat(solutionKey.Where(c => !char.IsWhiteSpace(c)));
209209
if (projectKeys.TryGetValue(keyWithoutWhitespace, out projectKey))
210210
{
211211
return projectKey;

src/Cli/dotnet/commands/dotnet-run/LaunchSettings/LaunchSettingsManager.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static LaunchSettingsApplyResult TryApplyLaunchSettings(string launchSett
6161
if (caseInsensitiveProfileMatches.Count() > 1)
6262
{
6363
throw new GracefulException(LocalizableStrings.DuplicateCaseInsensitiveLaunchProfileNames,
64-
String.Join(",\n", caseInsensitiveProfileMatches.Select(p => $"\t{p.Name}").ToArray()));
64+
string.Join(",\n", caseInsensitiveProfileMatches.Select(p => $"\t{p.Name}").ToArray()));
6565
}
6666
else if (!caseInsensitiveProfileMatches.Any())
6767
{

src/Cli/dotnet/commands/dotnet-run/RunCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public int Execute()
6969
//NOTE: MSBuild variables are not expanded like they are in VS
7070
targetCommand.EnvironmentVariable(entry.Key, value);
7171
}
72-
if (String.IsNullOrEmpty(targetCommand.CommandArgs) && launchSettings.CommandLineArgs != null)
72+
if (string.IsNullOrEmpty(targetCommand.CommandArgs) && launchSettings.CommandLineArgs != null)
7373
{
7474
targetCommand.SetCommandArgs(launchSettings.CommandLineArgs);
7575
}

src/Cli/dotnet/commands/dotnet-test/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private static TestCommand FromParseResult(ParseResult result, string[] settings
141141
result.OptionValuesToBeForwarded(TestCommandParser.GetCommand()) // all msbuild-recognized tokens
142142
.Concat(unMatchedNonSettingsArgs); // all tokens that the test-parser doesn't explicitly track (minus the settings tokens)
143143

144-
VSTestTrace.SafeWriteTrace(() => $"MSBuild args from forwarded options: {String.Join(", ", parsedArgs)}");
144+
VSTestTrace.SafeWriteTrace(() => $"MSBuild args from forwarded options: {string.Join(", ", parsedArgs)}");
145145
msbuildArgs.AddRange(parsedArgs);
146146

147147
if (settings.Any())

src/Cli/dotnet/commands/dotnet-tool/uninstall/ToolUninstallCommandLowLevelErrorConverter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static IEnumerable<string> GetUserFacingMessages(Exception ex, PackageId
1515
{
1616
userFacingMessages = new[]
1717
{
18-
String.Format(
18+
string.Format(
1919
CommonLocalizableStrings.FailedToUninstallToolPackage,
2020
packageId,
2121
ex.Message),

src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerClient.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ private void RemoveWorkloadPacks(List<WorkloadPackRecord> packsToRemove, Directo
283283
{
284284
Log?.LogMessage($"ProductCode mismatch! Cached package: {msi.ProductCode}, pack record: {record.ProductCode}.");
285285
string logFile = GetMsiLogName(record, InstallAction.Uninstall);
286-
uint error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressUninstall, id), () => UninstallMsi(record.ProductCode, logFile));
286+
uint error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressUninstall, id), () => UninstallMsi(record.ProductCode, logFile));
287287
ExitOnError(error, $"Failed to uninstall {msi.MsiPath}.");
288288
}
289289
else
@@ -586,7 +586,7 @@ public async Task ExtractManifestAsync(string nupkgPath, string targetPath)
586586
string packageDataPath = Path.Combine(extractionPath, "data");
587587
if (!Cache.TryGetMsiPathFromPackageData(packageDataPath, out string msiPath, out _))
588588
{
589-
throw new FileNotFoundException(String.Format(LocalizableStrings.ManifestMsiNotFoundInNuGetPackage, extractionPath));
589+
throw new FileNotFoundException(string.Format(LocalizableStrings.ManifestMsiNotFoundInNuGetPackage, extractionPath));
590590
}
591591
string msiExtractionPath = Path.Combine(extractionPath, "msi");
592592

@@ -604,7 +604,7 @@ public async Task ExtractManifestAsync(string nupkgPath, string targetPath)
604604
if (result != Error.SUCCESS)
605605
{
606606
Log?.LogMessage($"ExtractManifestAsync: Admin install failed: {result}");
607-
throw new GracefulException(String.Format(LocalizableStrings.FailedToExtractMsi, msiPath));
607+
throw new GracefulException(string.Format(LocalizableStrings.FailedToExtractMsi, msiPath));
608608
}
609609
}
610610

@@ -619,7 +619,7 @@ public async Task ExtractManifestAsync(string nupkgPath, string targetPath)
619619

620620
if (manifestFolder == null)
621621
{
622-
throw new GracefulException(String.Format(LocalizableStrings.ExpectedSingleManifest, nupkgPath));
622+
throw new GracefulException(string.Format(LocalizableStrings.ExpectedSingleManifest, nupkgPath));
623623
}
624624

625625
FileAccessRetrier.RetryOnMoveAccessFailure(() => DirectoryPath.MoveDirectory(manifestFolder, targetPath));
@@ -930,17 +930,17 @@ private void ExecutePackage(MsiPayload msi, InstallAction action, string display
930930
case InstallAction.MinorUpdate:
931931
case InstallAction.Install:
932932
case InstallAction.MajorUpgrade:
933-
error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressInstall, name), () => InstallMsi(msi.MsiPath, logFile));
933+
error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressInstall, name), () => InstallMsi(msi.MsiPath, logFile));
934934
ExitOnError(error, $"Failed to install {msi.Payload}.");
935935
break;
936936

937937
case InstallAction.Repair:
938-
error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressRepair, name), () => RepairMsi(msi.ProductCode, logFile));
938+
error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressRepair, name), () => RepairMsi(msi.ProductCode, logFile));
939939
ExitOnError(error, $"Failed to repair {msi.Payload}.");
940940
break;
941941

942942
case InstallAction.Uninstall:
943-
error = ExecuteWithProgress(String.Format(LocalizableStrings.MsiProgressUninstall, name), () => UninstallMsi(msi.ProductCode, logFile));
943+
error = ExecuteWithProgress(string.Format(LocalizableStrings.MsiProgressUninstall, name), () => UninstallMsi(msi.ProductCode, logFile));
944944
ExitOnError(error, $"Failed to remove {msi.Payload}.");
945945
break;
946946

src/Cli/dotnet/commands/dotnet-workload/install/NetSdkMsiInstallerServer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public static NetSdkMsiInstallerServer Create(bool verifySignatures)
133133
if ((ParentProcess == null) || (ParentProcess.StartTime > CurrentProcess.StartTime) ||
134134
!string.Equals(ParentProcess.MainModule.FileName, Environment.ProcessPath, StringComparison.OrdinalIgnoreCase))
135135
{
136-
throw new SecurityException(String.Format(LocalizableStrings.NoTrustWithParentPID, ParentProcess?.Id));
136+
throw new SecurityException(string.Format(LocalizableStrings.NoTrustWithParentPID, ParentProcess?.Id));
137137
}
138138

139139
// Configure pipe DACLs

src/Cli/dotnet/commands/dotnet-workload/install/WorkloadManifestUpdater.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ private bool BackgroundUpdatesAreDisabled() =>
470470

471471
private static string GetAdvertisingWorkloadsFilePath(string userProfileDir, SdkFeatureBand featureBand) => Path.Combine(userProfileDir, $".workloadAdvertisingUpdates{featureBand}");
472472

473-
private async Task<String> GetOnlinePackagePath(SdkFeatureBand sdkFeatureBand, ManifestId manifestId, bool includePreviews)
473+
private async Task<string> GetOnlinePackagePath(SdkFeatureBand sdkFeatureBand, ManifestId manifestId, bool includePreviews)
474474
{
475475
string packagePath = await _nugetPackageDownloader.DownloadPackageAsync(
476476
_workloadManifestInstaller.GetManifestPackageId(manifestId, sdkFeatureBand),

src/Containers/Microsoft.NET.Build.Containers/BaseImageNotFoundException.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ namespace Microsoft.NET.Build.Containers;
66
public sealed class BaseImageNotFoundException : Exception
77
{
88
internal BaseImageNotFoundException(string specifiedRuntimeIdentifier, string repositoryName, string reference, IEnumerable<string> supportedRuntimeIdentifiers)
9-
: base($"The RuntimeIdentifier '{specifiedRuntimeIdentifier}' is not supported by {repositoryName}:{reference}. The supported RuntimeIdentifiers are {String.Join(",", supportedRuntimeIdentifiers)}") { }
9+
: base($"The RuntimeIdentifier '{specifiedRuntimeIdentifier}' is not supported by {repositoryName}:{reference}. The supported RuntimeIdentifiers are {string.Join(",", supportedRuntimeIdentifiers)}") { }
1010
}

src/Containers/Microsoft.NET.Build.Containers/ContainerHelpers.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static bool TryParsePort(string? portNumber, string? portType, [NotNullWh
5050
{
5151
var portNo = 0;
5252
error = null;
53-
if (String.IsNullOrEmpty(portNumber))
53+
if (string.IsNullOrEmpty(portNumber))
5454
{
5555
error = ParsePortError.MissingPortNumber;
5656
}

src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ internal async Task<bool> ExecuteAsync(CancellationToken cancellationToken)
9898
return !Log.HasLoggedErrors;
9999
}
100100

101-
SafeLog(Strings.ContainerBuilder_StartBuildingImage, Repository, String.Join(",", ImageTags), sourceImageReference);
101+
SafeLog(Strings.ContainerBuilder_StartBuildingImage, Repository, string.Join(",", ImageTags), sourceImageReference);
102102

103103
Layer newLayer = Layer.FromDirectory(PublishDirectory, WorkingDirectory, imageBuilder.IsWindows);
104104
imageBuilder.AddLayer(newLayer);

src/Containers/Microsoft.NET.Build.Containers/Tasks/ParseContainerProperties.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public ParseContainerProperties()
8282
public override bool Execute()
8383
{
8484
string[] validTags;
85-
if (!String.IsNullOrEmpty(ContainerImageTag) && ContainerImageTags.Length >= 1)
85+
if (!string.IsNullOrEmpty(ContainerImageTag) && ContainerImageTags.Length >= 1)
8686
{
8787
Log.LogErrorWithCodeFromResources(nameof(Strings.AmbiguousTags), nameof(ContainerImageTag), nameof(ContainerImageTags));
8888
return !Log.HasLoggedErrors;
8989
}
9090

91-
if (!String.IsNullOrEmpty(ContainerImageTag))
91+
if (!string.IsNullOrEmpty(ContainerImageTag))
9292
{
9393
if (ContainerHelpers.IsValidImageTag(ContainerImageTag))
9494
{
@@ -105,7 +105,7 @@ public override bool Execute()
105105
validTags = valids;
106106
if (invalids.Any())
107107
{
108-
Log.LogErrorWithCodeFromResources(nameof(Strings.InvalidTags), nameof(ContainerImageTags), String.Join(",", invalids));
108+
Log.LogErrorWithCodeFromResources(nameof(Strings.InvalidTags), nameof(ContainerImageTags), string.Join(",", invalids));
109109
return !Log.HasLoggedErrors;
110110
}
111111
}
@@ -114,7 +114,7 @@ public override bool Execute()
114114
validTags = Array.Empty<string>();
115115
}
116116

117-
if (!String.IsNullOrEmpty(ContainerRegistry) && !ContainerHelpers.IsValidRegistry(ContainerRegistry))
117+
if (!string.IsNullOrEmpty(ContainerRegistry) && !ContainerHelpers.IsValidRegistry(ContainerRegistry))
118118
{
119119
Log.LogErrorWithCodeFromResources(nameof(Strings.CouldntRecognizeRegistry), ContainerRegistry);
120120
return !Log.HasLoggedErrors;
@@ -173,7 +173,7 @@ public override bool Execute()
173173
Log.LogMessage(MessageImportance.Low, "Image: {0}", ParsedContainerImage);
174174
Log.LogMessage(MessageImportance.Low, "Tag: {0}", ParsedContainerTag);
175175
Log.LogMessage(MessageImportance.Low, "Image Name: {0}", NewContainerRepository);
176-
Log.LogMessage(MessageImportance.Low, "Image Tags: {0}", String.Join(", ", NewContainerTags));
176+
Log.LogMessage(MessageImportance.Low, "Image Tags: {0}", string.Join(", ", NewContainerTags));
177177
}
178178

179179
return !Log.HasLoggedErrors;

0 commit comments

Comments
 (0)