From 26b6b207fdcb3612c325b02ab8888b61f8be7a98 Mon Sep 17 00:00:00 2001 From: Nikolay Pianikov Date: Fri, 17 Jan 2025 12:49:15 +0300 Subject: [PATCH] Code cleanup --- CSharpInteractive.HostApi/BuildMessage.cs | 14 +- CSharpInteractive.HostApi/BuildStatistics.cs | 12 +- CSharpInteractive.HostApi/DockerRun.cs | 16 +- CSharpInteractive.HostApi/DotNetCommands.cs | 614 +++++++++--------- CSharpInteractive.HostApi/DotNetCustom.cs | 6 +- CSharpInteractive.HostApi/IBuildRunner.cs | 4 +- .../ICommandLineRunner.cs | 4 +- CSharpInteractive.HostApi/IHost.cs | 4 +- .../DotNet/DotNetCommandLineExtensions.cs | 2 +- CSharpInteractive.HostApi/MSBuild.cs | 22 +- .../NuGetRestoreSettings.cs | 16 +- CSharpInteractive.HostApi/TestResult.cs | 4 +- CSharpInteractive.HostApi/VSTest.cs | 18 +- .../AddNuGetReferenceCommandFactoryTests.cs | 2 +- .../AddNuGetReferenceCommandRunnerTests.cs | 2 +- CSharpInteractive.Tests/BuildContextTests.cs | 8 +- .../BuildMessageLogWriterTests.cs | 8 +- CSharpInteractive.Tests/BuildRunnerTests.cs | 2 +- CSharpInteractive.Tests/CISettingsTests.cs | 4 +- .../CSharpScriptCommandRunnerTests.cs | 4 +- .../CommandsRunnerTests.cs | 12 +- .../CustomMessagesProcessorTests.cs | 4 +- .../DefaultBuildMessagesProcessorTests.cs | 8 +- .../Integration/Core/TestComposition.cs | 4 +- .../NuGetReferenceResolverTests.cs | 4 +- CSharpInteractive.Tests/NuGetServiceTests.cs | 2 +- .../ProcessResultHandlerTests.cs | 2 +- CSharpInteractive.Tests/ProcessRunnerTests.cs | 34 +- CSharpInteractive.Tests/ScriptRunnerTests.cs | 4 +- .../UsageScenarios/BaseScenario.cs | 6 +- .../CommandLineAsyncCancellation.cs | 2 +- .../CommandLineWithTimeoutScenario.cs | 2 +- .../UsageScenarios/DotNetCustomScenario.cs | 2 +- .../DotNetNuGetConfigGetScenario.cs | 2 +- .../DotNetNuGetConfigSetScenario.cs | 2 +- .../DotNetNuGetConfigUnsetScenario.cs | 2 +- .../Core/AddNuGetReferenceCommandRunner.cs | 2 +- .../Core/AssembliesScriptOptionsProvider.cs | 2 +- CSharpInteractive/Core/BuildContext.cs | 10 +- .../Core/BuildOutputProcessor.cs | 2 +- CSharpInteractive/Core/BuildRunner.cs | 6 +- .../Core/CSharpScriptCommandRunner.cs | 2 +- CSharpInteractive/Core/CSharpScriptRunner.cs | 4 +- CSharpInteractive/Core/CommandLineResult.cs | 4 +- CSharpInteractive/Core/CommandLineRunner.cs | 4 +- CSharpInteractive/Core/CommandResult.cs | 2 +- CSharpInteractive/Core/CommandsRunner.cs | 2 +- CSharpInteractive/Core/ConsoleSource.cs | 2 +- CSharpInteractive/Core/Environment.cs | 4 +- CSharpInteractive/Core/ExitCodeParser.cs | 2 +- CSharpInteractive/Core/ExitTracker.cs | 4 +- CSharpInteractive/Core/HelpCommandRunner.cs | 2 +- CSharpInteractive/Core/HostService.cs | 12 +- CSharpInteractive/Core/IProcessMonitor.cs | 2 +- .../Core/IStartInfoDescription.cs | 4 +- .../Core/MSBuildArgumentsTool.cs | 2 +- CSharpInteractive/Core/MessagesReader.cs | 2 +- .../Core/NuGetReferenceResolver.cs | 2 +- CSharpInteractive/Core/ProcessInfo.cs | 2 +- CSharpInteractive/Core/ProcessManager.cs | 12 +- CSharpInteractive/Core/ProcessMonitor.cs | 2 +- CSharpInteractive/Core/ProcessOutputWriter.cs | 2 +- CSharpInteractive/Core/ProcessResult.cs | 4 +- .../Core/ProcessResultHandler.cs | 4 +- CSharpInteractive/Core/ProcessRunner.cs | 8 +- CSharpInteractive/Core/RuntimeExplorer.cs | 4 +- CSharpInteractive/Core/ScriptRunner.cs | 2 +- .../Core/SettingCommandRunner.cs | 2 +- .../Core/StartInfoDescription.cs | 4 +- CSharpInteractive/Core/Summary.cs | 2 +- CSharpInteractive/Core/TextReplacer.cs | 2 +- CSharpInteractive/Core/TextToColorStrings.cs | 2 +- CSharpInteractive/Host.cs | 26 +- CSharpInteractive/Program.cs | 2 +- 74 files changed, 508 insertions(+), 508 deletions(-) diff --git a/CSharpInteractive.HostApi/BuildMessage.cs b/CSharpInteractive.HostApi/BuildMessage.cs index 965fc1e3..d1e09502 100644 --- a/CSharpInteractive.HostApi/BuildMessage.cs +++ b/CSharpInteractive.HostApi/BuildMessage.cs @@ -29,7 +29,7 @@ namespace HostApi; public record BuildMessage( Output Output, BuildMessageState State, - IServiceMessage? ServiceMessage = default, + IServiceMessage? ServiceMessage = null, string Text = "", string ErrorDetails = "", string Code = "", @@ -37,11 +37,11 @@ public record BuildMessage( string Subcategory = "", string ProjectFile = "", string SenderName = "", - int? ColumnNumber = default, - int? EndColumnNumber = default, - int? LineNumber = default, - int? EndLineNumber = default, - DotNetMessageImportance? Importance = default) + int? ColumnNumber = null, + int? EndColumnNumber = null, + int? LineNumber = null, + int? EndLineNumber = null, + DotNetMessageImportance? Importance = null) { /// /// Contains the result of test execution when is set to . @@ -49,7 +49,7 @@ public record BuildMessage( public TestResult? TestResult => ServiceMessage != null && TryGetTestState(ServiceMessage.Name, out var testState) ? CreateResult(CreateKey(ServiceMessage), ServiceMessage, testState) - : default(TestResult?); + : null; /// public override string ToString() => Text; diff --git a/CSharpInteractive.HostApi/BuildStatistics.cs b/CSharpInteractive.HostApi/BuildStatistics.cs index 9ea94028..e803b3b6 100644 --- a/CSharpInteractive.HostApi/BuildStatistics.cs +++ b/CSharpInteractive.HostApi/BuildStatistics.cs @@ -14,12 +14,12 @@ namespace HostApi; [ExcludeFromCodeCoverage] [Target] public record BuildStatistics( - int Errors = default, - int Warnings = default, - int Tests = default, - int FailedTests = default, - int IgnoredTests = default, - int PassedTests = default) + int Errors = 0, + int Warnings = 0, + int Tests = 0, + int FailedTests = 0, + int IgnoredTests = 0, + int PassedTests = 0) { /// /// True> if the statistic is empty, False if it contains any information. diff --git a/CSharpInteractive.HostApi/DockerRun.cs b/CSharpInteractive.HostApi/DockerRun.cs index 59943630..02e2d651 100644 --- a/CSharpInteractive.HostApi/DockerRun.cs +++ b/CSharpInteractive.HostApi/DockerRun.cs @@ -71,19 +71,19 @@ public partial record DockerRun( IEnumerable<(string host, string ip)> Hosts, string ExecutablePath = "", string WorkingDirectory = "", - int? CPUs = default, + int? CPUs = null, string EntryPoint = "", string HostName = "", - int? KernelMemory = default, - int? Memory = default, - string? Name = default, + int? KernelMemory = null, + int? Memory = null, + string? Name = null, string Network = "", string Platform = "", - bool? Privileged = default, - DockerPullType? Pull = default, + bool? Privileged = null, + DockerPullType? Pull = null, bool Quiet = false, - bool? ReadOnly = default, - bool? AutoRemove = default, + bool? ReadOnly = null, + bool? AutoRemove = null, string User = "", string ContainerWorkingDirectory = "", string EnvFile = "", diff --git a/CSharpInteractive.HostApi/DotNetCommands.cs b/CSharpInteractive.HostApi/DotNetCommands.cs index fa561193..a91af67e 100644 --- a/CSharpInteractive.HostApi/DotNetCommands.cs +++ b/CSharpInteractive.HostApi/DotNetCommands.cs @@ -44,12 +44,12 @@ public partial record DotNet( string PathToApplication = "", string AdditionalDeps = "", string FxVersion = "", - DotNetRollForward? RollForward = default, - bool? Diagnostics = default, - bool? Info = default, - bool? Version = default, - bool? ListRuntimes = default, - bool? ListSdks = default, + DotNetRollForward? RollForward = null, + bool? Diagnostics = null, + bool? Info = null, + bool? Version = null, + bool? ListRuntimes = null, + bool? ListSdks = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -135,9 +135,9 @@ public partial record DotNetExec( string DepsFile = "", string AdditionalDeps = "", string FxVersion = "", - DotNetRollForward? RollForward = default, + DotNetRollForward? RollForward = null, string RuntimeConfig = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -224,11 +224,11 @@ public partial record DotNetAddPackage( string Project = "", string Package = "", string Framework = "", - bool? NoRestore = default, + bool? NoRestore = null, string PackageDirectory = "", - bool? Prerelease = default, + bool? Prerelease = null, string Version = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -328,14 +328,14 @@ public partial record DotNetListPackage( IEnumerable Sources, string Project = "", string Config = "", - bool? Deprecated = default, - bool? HighestMinor = default, - bool? HighestPatch = default, - bool? IncludePrerelease = default, - bool? IncludeTransitive = default, - bool? Outdated = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + bool? Deprecated = null, + bool? HighestMinor = null, + bool? HighestPatch = null, + bool? IncludePrerelease = null, + bool? IncludeTransitive = null, + bool? Outdated = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -424,7 +424,7 @@ public partial record DotNetRemovePackage( IEnumerable<(string name, string value)> Vars, string Project = "", string Package = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -502,7 +502,7 @@ public partial record DotNetAddReference( IEnumerable References, string Project = "", string Framework = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -583,7 +583,7 @@ public partial record DotNetListReference( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string Project = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -671,7 +671,7 @@ public partial record DotNetRemoveReference( IEnumerable References, string Project = "", string Framework = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -777,23 +777,23 @@ public partial record DotNetBuild( string Arch = "", string ArtifactsPath = "", string Configuration = "", - bool? DisableBuildServers = default, + bool? DisableBuildServers = null, string Framework = "", - bool? Force = default, - bool? NoDependencies = default, - bool? NoIncremental = default, - bool? NoRestore = default, - bool? NoLogo = default, - bool? NoSelfContained = default, + bool? Force = null, + bool? NoDependencies = null, + bool? NoIncremental = null, + bool? NoRestore = null, + bool? NoLogo = null, + bool? NoSelfContained = null, string Output = "", string OS = "", string Runtime = "", - bool? SelfContained = default, - DotNetTerminalLogger? TerminalLogger = default, - DotNetVerbosity? Verbosity = default, - bool? UseCurrentRuntime = default, + bool? SelfContained = null, + DotNetTerminalLogger? TerminalLogger = null, + DotNetVerbosity? Verbosity = null, + bool? UseCurrentRuntime = null, string VersionSuffix = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -885,7 +885,7 @@ public partial record DotNetBuildServerShutdown( IEnumerable Args, IEnumerable<(string name, string value)> Vars, IEnumerable Servers, - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -970,12 +970,12 @@ public partial record DotNetClean( string ArtifactsPath = "", string Configuration = "", string Framework = "", - bool? NoLogo = default, + bool? NoLogo = null, string Output = "", string Runtime = "", - DotNetTerminalLogger? TerminalLogger = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetTerminalLogger? TerminalLogger = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -1072,17 +1072,17 @@ public IStartInfo GetStartInfo(IHost host) public partial record DotNetDevCertsHttps( IEnumerable Args, IEnumerable<(string name, string value)> Vars, - bool? Check = default, - bool? Clean = default, + bool? Check = null, + bool? Clean = null, string ExportPath = "", - DotNetCertificateFormat? Format = default, - bool? Import = default, - bool? NoPassword = default, + DotNetCertificateFormat? Format = null, + bool? Import = null, + bool? NoPassword = null, string Password = "", - bool? Quiet = default, - bool? Trust = default, - bool? Verbose = default, - bool? Diagnostics = default, + bool? Quiet = null, + bool? Trust = null, + bool? Verbose = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -1179,11 +1179,11 @@ public partial record DotNetFormat( IEnumerable Includes, IEnumerable Excludes, string Project = "", - DotNetFormatSeverity? Severity = default, - bool? NoRestore = default, - bool? VerifyNoChanges = default, - bool? IncludeGenerated = default, - DotNetVerbosity? Verbosity = default, + DotNetFormatSeverity? Severity = null, + bool? NoRestore = null, + bool? VerifyNoChanges = null, + bool? IncludeGenerated = null, + DotNetVerbosity? Verbosity = null, string BinaryLog = "", string Report = "", string ExecutablePath = "", @@ -1280,12 +1280,12 @@ public partial record DotNetFormatStyle( IEnumerable Includes, IEnumerable Excludes, string Project = "", - bool? Folder = default, - DotNetFormatSeverity? Severity = default, - bool? NoRestore = default, - bool? VerifyNoChanges = default, - bool? IncludeGenerated = default, - DotNetVerbosity? Verbosity = default, + bool? Folder = null, + DotNetFormatSeverity? Severity = null, + bool? NoRestore = null, + bool? VerifyNoChanges = null, + bool? IncludeGenerated = null, + DotNetVerbosity? Verbosity = null, string BinaryLog = "", string Report = "", string ExecutablePath = "", @@ -1383,11 +1383,11 @@ public partial record DotNetFormatAnalyzers( IEnumerable Includes, IEnumerable Excludes, string Project = "", - DotNetFormatSeverity? Severity = default, - bool? NoRestore = default, - bool? VerifyNoChanges = default, - bool? IncludeGenerated = default, - DotNetVerbosity? Verbosity = default, + DotNetFormatSeverity? Severity = null, + bool? NoRestore = null, + bool? VerifyNoChanges = null, + bool? IncludeGenerated = null, + DotNetVerbosity? Verbosity = null, string BinaryLog = "", string Report = "", string ExecutablePath = "", @@ -1481,17 +1481,17 @@ public partial record DotNetNew( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string TemplateName = "", - bool? DryRun = default, - bool? Force = default, - DotNetLanguage? Language = default, + bool? DryRun = null, + bool? Force = null, + DotNetLanguage? Language = null, string Name = "", string Framework = "", - bool? NoUpdateCheck = default, + bool? NoUpdateCheck = null, string Output = "", - bool? NoRestore = default, + bool? NoRestore = null, string Project = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -1582,15 +1582,15 @@ public partial record DotNetNewList( IEnumerable Columns, string TemplateName = "", string Author = "", - bool? ColumnsAll = default, - bool? IgnoreConstraints = default, - DotNetLanguage? Language = default, + bool? ColumnsAll = null, + bool? IgnoreConstraints = null, + DotNetLanguage? Language = null, string Output = "", string Project = "", string Tag = "", - DotNetTemplateType? Type = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetTemplateType? Type = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -1681,13 +1681,13 @@ public partial record DotNetNewSearch( IEnumerable Columns, string TemplateName = "", string Author = "", - bool? ColumnsAll = default, - DotNetLanguage? Language = default, + bool? ColumnsAll = null, + DotNetLanguage? Language = null, string Package = "", string Tag = "", - DotNetTemplateType? Type = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetTemplateType? Type = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -1770,9 +1770,9 @@ public partial record DotNetNewDetails( IEnumerable<(string name, string value)> Vars, IEnumerable Sources, string TemplateName = "", - bool? Force = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + bool? Force = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -1850,9 +1850,9 @@ public partial record DotNetNewInstall( IEnumerable<(string name, string value)> Vars, IEnumerable Sources, string Package = "", - bool? Force = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + bool? Force = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -1927,8 +1927,8 @@ public partial record DotNetNewUninstall( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string Package = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2002,10 +2002,10 @@ public partial record DotNetNewUpdate( IEnumerable Args, IEnumerable<(string name, string value)> Vars, IEnumerable Sources, - bool? CheckOnly = default, - bool? DryRun = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + bool? CheckOnly = null, + bool? DryRun = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2087,11 +2087,11 @@ public partial record DotNetNuGetDelete( IEnumerable<(string name, string value)> Vars, string Package = "", string PackageVersion = "", - bool? ForceEnglishOutput = default, + bool? ForceEnglishOutput = null, string ApiKey = "", - bool? NoServiceEndpoint = default, + bool? NoServiceEndpoint = null, string Source = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2168,9 +2168,9 @@ public IStartInfo GetStartInfo(IHost host) public partial record DotNetNuGetLocalsClear( IEnumerable Args, IEnumerable<(string name, string value)> Vars, - NuGetCacheLocation? CacheLocation = default, - bool? ForceEnglishOutput = default, - bool? Diagnostics = default, + NuGetCacheLocation? CacheLocation = null, + bool? ForceEnglishOutput = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2240,9 +2240,9 @@ public IStartInfo GetStartInfo(IHost host) public partial record DotNetNuGetLocalsList( IEnumerable Args, IEnumerable<(string name, string value)> Vars, - NuGetCacheLocation? CacheLocation = default, - bool? ForceEnglishOutput = default, - bool? Diagnostics = default, + NuGetCacheLocation? CacheLocation = null, + bool? ForceEnglishOutput = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2328,18 +2328,18 @@ public partial record DotNetNuGetPush( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string Package = "", - bool? DisableBuffering = default, - bool? ForceEnglishOutput = default, + bool? DisableBuffering = null, + bool? ForceEnglishOutput = null, string ApiKey = "", - bool? NoSymbols = default, - bool? NoServiceEndpoint = default, + bool? NoSymbols = null, + bool? NoServiceEndpoint = null, string Source = "", - bool? SkipDuplicate = default, + bool? SkipDuplicate = null, string SymbolApiKey = "", string SymbolSource = "", - int? Timeout = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + int? Timeout = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2431,12 +2431,12 @@ public partial record DotNetNuGetAddSource( IEnumerable ValidAuthenticationTypes, string Source = "", string ConfigFile = "", - bool? AllowInsecureConnections = default, + bool? AllowInsecureConnections = null, string Name = "", string Password = "", - bool? StorePasswordInClearText = default, + bool? StorePasswordInClearText = null, string Username = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2517,7 +2517,7 @@ public partial record DotNetNuGetDisableSource( IEnumerable<(string name, string value)> Vars, string Name = "", string ConfigFile = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2592,7 +2592,7 @@ public partial record DotNetNuGetEnableSource( IEnumerable<(string name, string value)> Vars, string Name = "", string ConfigFile = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2666,8 +2666,8 @@ public partial record DotNetNuGetListSource( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string ConfigFile = "", - NuGetListFormat? Format = default, - bool? Diagnostics = default, + NuGetListFormat? Format = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2742,7 +2742,7 @@ public partial record DotNetNuGetRemoveSource( IEnumerable<(string name, string value)> Vars, string Name = "", string ConfigFile = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2826,9 +2826,9 @@ public partial record DotNetNuGetUpdateSource( string ConfigFile = "", string Password = "", string Source = "", - bool? StorePasswordInClearText = default, + bool? StorePasswordInClearText = null, string Username = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2902,10 +2902,10 @@ public partial record DotNetNuGetVerify( IEnumerable<(string name, string value)> Vars, IEnumerable Packages, IEnumerable Fingerprints, - bool? All = default, + bool? All = null, string ConfigFile = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -2973,8 +2973,8 @@ public partial record DotNetNuGetTrustList( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string ConfigFile = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3038,8 +3038,8 @@ public partial record DotNetNuGetTrustSync( IEnumerable<(string name, string value)> Vars, string Name = "", string ConfigFile = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3104,8 +3104,8 @@ public partial record DotNetNuGetTrustRemove( IEnumerable<(string name, string value)> Vars, string Name = "", string ConfigFile = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3172,10 +3172,10 @@ public partial record DotNetNuGetTrustAuthor( IEnumerable<(string name, string value)> Vars, string Name = "", string Package = "", - bool? AllowUntrustedRoot = default, + bool? AllowUntrustedRoot = null, string ConfigFile = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3246,10 +3246,10 @@ public partial record DotNetNuGetTrustRepository( IEnumerable Owners, string Name = "", string Package = "", - bool? AllowUntrustedRoot = default, + bool? AllowUntrustedRoot = null, string ConfigFile = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3320,11 +3320,11 @@ public partial record DotNetNuGetTrustCertificate( IEnumerable<(string name, string value)> Vars, string Name = "", string Fingerprint = "", - NuGetCertificateAlgorithm? Algorithm = default, - bool? AllowUntrustedRoot = default, + NuGetCertificateAlgorithm? Algorithm = null, + bool? AllowUntrustedRoot = null, string ConfigFile = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3396,8 +3396,8 @@ public partial record DotNetNuGetTrustSource( string Name = "", string ConfigFile = "", string SourceUrl = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3494,13 +3494,13 @@ public partial record DotNetNuGetSign( string CertificateSubjectName = "", string CertificateFingerprint = "", string CertificatePassword = "", - NuGetCertificateAlgorithm? HashAlgorithm = default, + NuGetCertificateAlgorithm? HashAlgorithm = null, string Output = "", - bool? Overwrite = default, - NuGetCertificateAlgorithm? TimestampHashAlgorithm = default, + bool? Overwrite = null, + NuGetCertificateAlgorithm? TimestampHashAlgorithm = null, string TimestampingServer = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3588,7 +3588,7 @@ public partial record DotNetNuGetWhy( IEnumerable Frameworks, string Project = "", string Package = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3664,9 +3664,9 @@ public partial record DotNetNuGetConfigGet( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string ConfigKey = "ALL", - bool? ShowPath = default, + bool? ShowPath = null, string Directory = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3746,7 +3746,7 @@ public partial record DotNetNuGetConfigSet( string ConfigKey = "", string ConfigValue = "", string ConfigFile = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3822,7 +3822,7 @@ public partial record DotNetNuGetConfigUnset( IEnumerable<(string name, string value)> Vars, string ConfigKey = "", string ConfigFile = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -3895,7 +3895,7 @@ public partial record DotNetNuGetConfigPaths( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string Directory = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -4001,24 +4001,24 @@ public partial record DotNetPack( string Project = "", string ArtifactsPath = "", string Configuration = "", - bool? Force = default, + bool? Force = null, string IncludeSource = "", string IncludeSymbols = "", - bool? NoBuild = default, - bool? NoDependencies = default, - bool? NoIncremental = default, - bool? NoRestore = default, - bool? NoLogo = default, - bool? NoSelfContained = default, + bool? NoBuild = null, + bool? NoDependencies = null, + bool? NoIncremental = null, + bool? NoRestore = null, + bool? NoLogo = null, + bool? NoSelfContained = null, string Output = "", string OS = "", string Runtime = "", - bool? SelfContained = default, - DotNetTerminalLogger? TerminalLogger = default, - DotNetVerbosity? Verbosity = default, - bool? UseCurrentRuntime = default, + bool? SelfContained = null, + DotNetTerminalLogger? TerminalLogger = null, + DotNetVerbosity? Verbosity = null, + bool? UseCurrentRuntime = null, string VersionSuffix = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -4141,13 +4141,13 @@ public partial record DotNetPackageSearch( IEnumerable Sources, string SearchTerm = "", string ConfigFile = "", - bool? ExactMatch = default, - DotNetPackageSearchResultFormat? Format = default, - bool? Prerelease = default, - int? Skip = default, - int? Take = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + bool? ExactMatch = null, + DotNetPackageSearchResultFormat? Format = null, + bool? Prerelease = null, + int? Skip = null, + int? Take = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -4256,23 +4256,23 @@ public partial record DotNetPublish( string Arch = "", string ArtifactsPath = "", string Configuration = "", - bool? DisableBuildServers = default, + bool? DisableBuildServers = null, string Framework = "", - bool? Force = default, - bool? NoBuild = default, - bool? NoDependencies = default, - bool? NoLogo = default, - bool? NoRestore = default, + bool? Force = null, + bool? NoBuild = null, + bool? NoDependencies = null, + bool? NoLogo = null, + bool? NoRestore = null, string Output = "", string OS = "", - bool? SelfContained = default, - bool? NoSelfContained = default, + bool? SelfContained = null, + bool? NoSelfContained = null, string Runtime = "", - DotNetTerminalLogger? TerminalLogger = default, - bool? UseCurrentRuntime = default, - DotNetVerbosity? Verbosity = default, + DotNetTerminalLogger? TerminalLogger = null, + bool? UseCurrentRuntime = null, + DotNetVerbosity? Verbosity = null, string VersionSuffix = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -4391,22 +4391,22 @@ public partial record DotNetRestore( string Project = "", string Arch = "", string ConfigFile = "", - bool? DisableBuildServers = default, - bool? DisableParallel = default, - bool? Force = default, - bool? ForceEvaluate = default, - bool? IgnoreFailedSources = default, + bool? DisableBuildServers = null, + bool? DisableParallel = null, + bool? Force = null, + bool? ForceEvaluate = null, + bool? IgnoreFailedSources = null, string LockFilePath = "", - bool? LockedMode = default, - bool? NoCache = default, - bool? NoDependencies = default, + bool? LockedMode = null, + bool? NoCache = null, + bool? NoDependencies = null, string Packages = "", string Runtime = "", - DotNetTerminalLogger? TerminalLogger = default, - bool? UseCurrentRuntime = default, - bool? UseLockFile = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetTerminalLogger? TerminalLogger = null, + bool? UseCurrentRuntime = null, + bool? UseLockFile = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -4518,18 +4518,18 @@ public partial record DotNetRun( string Arch = "", string Configuration = "", string Framework = "", - bool? Force = default, + bool? Force = null, string LaunchProfile = "", - bool? NoBuild = default, - bool? NoDependencies = default, - bool? NoLaunchProfile = default, - bool? NoRestore = default, + bool? NoBuild = null, + bool? NoDependencies = null, + bool? NoLaunchProfile = null, + bool? NoRestore = null, string OS = "", string Project = "", string Runtime = "", - DotNetTerminalLogger? TerminalLogger = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetTerminalLogger? TerminalLogger = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -4626,7 +4626,7 @@ public IStartInfo GetStartInfo(IHost host) public partial record DotNetSdkCheck( IEnumerable Args, IEnumerable<(string name, string value)> Vars, - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -4695,7 +4695,7 @@ public partial record DotNetSlnList( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string Solution = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -4776,9 +4776,9 @@ public partial record DotNetSlnAdd( IEnumerable<(string name, string value)> Vars, IEnumerable Projects, string Solution = "", - bool? InRoot = default, + bool? InRoot = null, string SolutionFolder = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -4853,7 +4853,7 @@ public partial record DotNetSlnRemove( IEnumerable<(string name, string value)> Vars, IEnumerable Projects, string Solution = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -4940,11 +4940,11 @@ public partial record DotNetStore( string Runtime = "", string FrameworkVersion = "", string Output = "", - bool? SkipOptimization = default, - bool? SkipSymbols = default, - DotNetVerbosity? Verbosity = default, + bool? SkipOptimization = null, + bool? SkipSymbols = null, + DotNetVerbosity? Verbosity = null, string Directory = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5061,30 +5061,30 @@ public partial record DotNetTest( string TestAdapterPath = "", string Arch = "", string ArtifactsPath = "", - bool? Blame = default, - bool? BlameCrash = default, - DotNetBlameDumpType? BlameCrashDumpType = default, - bool? BlameCrashCollectAlways = default, - bool? BlameHang = default, - DotNetBlameDumpType? BlameHangDumpType = default, - TimeSpan? BlameHangTimeout = default, + bool? Blame = null, + bool? BlameCrash = null, + DotNetBlameDumpType? BlameCrashDumpType = null, + bool? BlameCrashCollectAlways = null, + bool? BlameHang = null, + DotNetBlameDumpType? BlameHangDumpType = null, + TimeSpan? BlameHangTimeout = null, string Configuration = "", string Collect = "", string Diag = "", string Framework = "", string Filter = "", - bool? NoBuild = default, - bool? NoLogo = default, - bool? NoRestore = default, + bool? NoBuild = null, + bool? NoLogo = null, + bool? NoRestore = null, string Output = "", string OS = "", string ResultsDirectory = "", string Runtime = "", string Settings = "", - bool? ListTests = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, - DotNetTerminalLogger? TerminalLogger = default, + bool? ListTests = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, + DotNetTerminalLogger? TerminalLogger = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5207,22 +5207,22 @@ public partial record DotNetToolInstall( IEnumerable<(string name, string value)> Vars, IEnumerable Sources, string Package = "", - bool? AllowDowngrade = default, + bool? AllowDowngrade = null, string Arch = "", string ConfigFile = "", - bool? CreateManifestIfNeeded = default, - bool? DisableParallel = default, + bool? CreateManifestIfNeeded = null, + bool? DisableParallel = null, string Framework = "", - bool? Global = default, - bool? IgnoreFailedSources = default, - bool? Local = default, - bool? NoCache = default, - bool? Prerelease = default, + bool? Global = null, + bool? IgnoreFailedSources = null, + bool? Local = null, + bool? NoCache = null, + bool? Prerelease = null, string ToolManifest = "", string ToolPath = "", - DotNetVerbosity? Verbosity = default, + DotNetVerbosity? Verbosity = null, string Version = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5316,10 +5316,10 @@ public partial record DotNetToolList( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string Package = "", - bool? Global = default, - bool? Local = default, + bool? Global = null, + bool? Local = null, string ToolPath = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5405,11 +5405,11 @@ public partial record DotNetToolRestore( IEnumerable Sources, string ConfigFile = "", string ToolManifest = "", - bool? DisableParallel = default, - bool? IgnoreFailedSources = default, - bool? NoCache = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + bool? DisableParallel = null, + bool? IgnoreFailedSources = null, + bool? NoCache = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5496,7 +5496,7 @@ public partial record DotNetToolRun( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string CommandName = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5572,11 +5572,11 @@ public partial record DotNetToolSearch( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string Package = "", - bool? Detail = default, - bool? Prerelease = default, - int? Skip = default, - int? Take = default, - bool? Diagnostics = default, + bool? Detail = null, + bool? Prerelease = null, + int? Skip = null, + int? Take = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5654,10 +5654,10 @@ public partial record DotNetToolUninstall( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string Package = "", - bool? Global = default, + bool? Global = null, string ToolPath = "", string ToolManifest = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5748,20 +5748,20 @@ public partial record DotNetToolUpdate( IEnumerable<(string name, string value)> Vars, IEnumerable Sources, string Package = "", - bool? AllowDowngrade = default, + bool? AllowDowngrade = null, string ConfigFile = "", - bool? DisableParallel = default, + bool? DisableParallel = null, string Framework = "", - bool? Global = default, - bool? IgnoreFailedSources = default, - bool? Local = default, - bool? NoCache = default, - bool? Prerelease = default, + bool? Global = null, + bool? IgnoreFailedSources = null, + bool? Local = null, + bool? NoCache = null, + bool? Prerelease = null, string ToolManifest = "", string ToolPath = "", - DotNetVerbosity? Verbosity = default, + DotNetVerbosity? Verbosity = null, string Version = "", - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5837,9 +5837,9 @@ public IStartInfo GetStartInfo(IHost host) public partial record DotNetWorkload( IEnumerable Args, IEnumerable<(string name, string value)> Vars, - bool? Version = default, - bool? Info = default, - bool? Diagnostics = default, + bool? Version = null, + bool? Info = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5906,8 +5906,8 @@ public IStartInfo GetStartInfo(IHost host) public partial record DotNetWorkloadConfig( IEnumerable Args, IEnumerable<(string name, string value)> Vars, - DotNetWorkloadUpdateMode? UpdateMode = default, - bool? Diagnostics = default, + DotNetWorkloadUpdateMode? UpdateMode = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -5990,15 +5990,15 @@ public partial record DotNetWorkloadInstall( IEnumerable Workloads, IEnumerable Sources, string ConfigFile = "", - bool? DisableParallel = default, - bool? IgnoreFailedSources = default, - bool? IncludePreviews = default, - bool? NoCache = default, - bool? SkipManifestUpdate = default, + bool? DisableParallel = null, + bool? IgnoreFailedSources = null, + bool? IncludePreviews = null, + bool? NoCache = null, + bool? SkipManifestUpdate = null, string TempDir = "", - DotNetVerbosity? Verbosity = default, - bool? Version = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Version = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -6077,8 +6077,8 @@ public IStartInfo GetStartInfo(IHost host) public partial record DotNetWorkloadList( IEnumerable Args, IEnumerable<(string name, string value)> Vars, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -6156,13 +6156,13 @@ public partial record DotNetWorkloadRepair( IEnumerable<(string name, string value)> Vars, IEnumerable Sources, string ConfigFile = "", - bool? DisableParallel = default, - bool? IgnoreFailedSources = default, - bool? IncludePreviews = default, - bool? NoCache = default, + bool? DisableParallel = null, + bool? IgnoreFailedSources = null, + bool? IncludePreviews = null, + bool? NoCache = null, string TempDir = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -6252,15 +6252,15 @@ public partial record DotNetWorkloadRestore( IEnumerable Sources, string Project = "", string ConfigFile = "", - bool? DisableParallel = default, - bool? IgnoreFailedSources = default, - bool? IncludePreviews = default, - bool? NoCache = default, - bool? SkipManifestUpdate = default, + bool? DisableParallel = null, + bool? IgnoreFailedSources = null, + bool? IncludePreviews = null, + bool? NoCache = null, + bool? SkipManifestUpdate = null, string TempDir = "", - DotNetVerbosity? Verbosity = default, - bool? Version = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Version = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -6342,8 +6342,8 @@ public partial record DotNetWorkloadSearch( IEnumerable Args, IEnumerable<(string name, string value)> Vars, string SearchString = "", - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -6415,7 +6415,7 @@ public partial record DotNetWorkloadUninstall( IEnumerable Args, IEnumerable<(string name, string value)> Vars, IEnumerable Workloads, - bool? Diagnostics = default, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -6495,17 +6495,17 @@ public partial record DotNetWorkloadUpdate( IEnumerable Args, IEnumerable<(string name, string value)> Vars, IEnumerable Sources, - bool? AdvertisingManifestsOnly = default, + bool? AdvertisingManifestsOnly = null, string ConfigFile = "", - bool? DisableParallel = default, - bool? FromPreviousSdk = default, - bool? IgnoreFailedSources = default, - bool? IncludePreviews = default, - bool? NoCache = default, + bool? DisableParallel = null, + bool? FromPreviousSdk = null, + bool? IgnoreFailedSources = null, + bool? IncludePreviews = null, + bool? NoCache = null, string TempDir = "", - DotNetVerbosity? Verbosity = default, - bool? Version = default, - bool? Diagnostics = default, + DotNetVerbosity? Verbosity = null, + bool? Version = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") @@ -6597,8 +6597,8 @@ public partial record DotNetCsi( IEnumerable<(string name, string value)> Props, IEnumerable Sources, string Script = "", - bool? Version = default, - bool? Diagnostics = default, + bool? Version = null, + bool? Diagnostics = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") diff --git a/CSharpInteractive.HostApi/DotNetCustom.cs b/CSharpInteractive.HostApi/DotNetCustom.cs index 5c728054..dd2a9494 100644 --- a/CSharpInteractive.HostApi/DotNetCustom.cs +++ b/CSharpInteractive.HostApi/DotNetCustom.cs @@ -29,9 +29,9 @@ namespace HostApi; public partial record DotNetCustom( IEnumerable Args, IEnumerable<(string name, string value)> Vars, - bool? Build = default, - bool? Tests = default, - DotNetVerbosity? Verbosity = default, + bool? Build = null, + bool? Tests = null, + DotNetVerbosity? Verbosity = null, string ExecutablePath = "", string WorkingDirectory = "", string ShortName = "") diff --git a/CSharpInteractive.HostApi/IBuildRunner.cs b/CSharpInteractive.HostApi/IBuildRunner.cs index 913a9ed8..ef1147a7 100644 --- a/CSharpInteractive.HostApi/IBuildRunner.cs +++ b/CSharpInteractive.HostApi/IBuildRunner.cs @@ -38,7 +38,7 @@ public interface IBuildRunner /// IBuildResult Build( ICommandLine commandLine, - Action? handler = default, + Action? handler = null, TimeSpan timeout = default); /// @@ -60,6 +60,6 @@ IBuildResult Build( /// Task BuildAsync( ICommandLine commandLine, - Action? handler = default, + Action? handler = null, CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/CSharpInteractive.HostApi/ICommandLineRunner.cs b/CSharpInteractive.HostApi/ICommandLineRunner.cs index 55eb702f..171d87c1 100644 --- a/CSharpInteractive.HostApi/ICommandLineRunner.cs +++ b/CSharpInteractive.HostApi/ICommandLineRunner.cs @@ -32,7 +32,7 @@ public interface ICommandLineRunner /// ICommandLineResult Run( ICommandLine commandLine, - Action? handler = default, + Action? handler = null, TimeSpan timeout = default); /// @@ -54,6 +54,6 @@ ICommandLineResult Run( /// Task RunAsync( ICommandLine commandLine, - Action? handler = default, + Action? handler = null, CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/CSharpInteractive.HostApi/IHost.cs b/CSharpInteractive.HostApi/IHost.cs index 100813bb..34f22418 100644 --- a/CSharpInteractive.HostApi/IHost.cs +++ b/CSharpInteractive.HostApi/IHost.cs @@ -75,7 +75,7 @@ public interface IHost /// /// Error message. /// Unique error identifier, optional. - void Error(string? error, string? errorId = default); + void Error(string? error, string? errorId = null); /// /// Writes a warning to stdOut. This warning will affect the summary run statistics. @@ -116,7 +116,7 @@ public interface IHost /// /// Trace message. /// Source of the trace message, optional. - void Trace(string? trace, string? origin = default); + void Trace(string? trace, string? origin = null); /// /// Provides an instance of a service by its type. diff --git a/CSharpInteractive.HostApi/Internal/DotNet/DotNetCommandLineExtensions.cs b/CSharpInteractive.HostApi/Internal/DotNet/DotNetCommandLineExtensions.cs index 493b2a18..aade645b 100644 --- a/CSharpInteractive.HostApi/Internal/DotNet/DotNetCommandLineExtensions.cs +++ b/CSharpInteractive.HostApi/Internal/DotNet/DotNetCommandLineExtensions.cs @@ -70,7 +70,7 @@ public static string GetShortName(this string baseName, string description, stri } [Pure] - public static CommandLine AddMSBuildLoggers(this CommandLine cmd, IHost host, DotNetVerbosity? verbosity = default) + public static CommandLine AddMSBuildLoggers(this CommandLine cmd, IHost host, DotNetVerbosity? verbosity = null) { // ReSharper disable once UseDeconstruction var components = host.GetService(); diff --git a/CSharpInteractive.HostApi/MSBuild.cs b/CSharpInteractive.HostApi/MSBuild.cs index fdb10082..b2241c3d 100644 --- a/CSharpInteractive.HostApi/MSBuild.cs +++ b/CSharpInteractive.HostApi/MSBuild.cs @@ -66,22 +66,22 @@ public partial record MSBuild( string WorkingDirectory = "", string Project = "", string Target = "", - int? MaxCpuCount = default, + int? MaxCpuCount = null, string ToolsVersion = "", - bool? NodeReuse = default, + bool? NodeReuse = null, string Preprocess = "", bool DetailedSummary = false, - bool? Restore = default, + bool? Restore = null, string ProfileEvaluation = "", - bool? IsolateProjects = default, + bool? IsolateProjects = null, string OutputResultsCache = "", - bool? GraphBuild = default, - bool? LowPriority = default, - bool? NoAutoResponse = default, - bool? NoLogo = default, - bool? DisplayVersion = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + bool? GraphBuild = null, + bool? LowPriority = null, + bool? NoAutoResponse = null, + bool? NoLogo = null, + bool? DisplayVersion = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ShortName = "") { /// diff --git a/CSharpInteractive.HostApi/NuGetRestoreSettings.cs b/CSharpInteractive.HostApi/NuGetRestoreSettings.cs index 3cf829c5..56527462 100644 --- a/CSharpInteractive.HostApi/NuGetRestoreSettings.cs +++ b/CSharpInteractive.HostApi/NuGetRestoreSettings.cs @@ -30,14 +30,14 @@ public record NuGetRestoreSettings( string PackageId, IEnumerable Sources, IEnumerable FallbackFolders, - VersionRange? VersionRange = default, - string? TargetFrameworkMoniker = default, - string? PackagesPath = default, - NuGetPackageType? PackageType = default, - bool? DisableParallel = default, - bool? IgnoreFailedSources = default, - bool? HideWarningsAndErrors = default, - bool? NoCache = default) + VersionRange? VersionRange = null, + string? TargetFrameworkMoniker = null, + string? PackagesPath = null, + NuGetPackageType? PackageType = null, + bool? DisableParallel = null, + bool? IgnoreFailedSources = null, + bool? HideWarningsAndErrors = null, + bool? NoCache = null) { /// /// Creates a new instance of the settings. diff --git a/CSharpInteractive.HostApi/TestResult.cs b/CSharpInteractive.HostApi/TestResult.cs index 9f9a8235..5475856e 100644 --- a/CSharpInteractive.HostApi/TestResult.cs +++ b/CSharpInteractive.HostApi/TestResult.cs @@ -67,8 +67,8 @@ public TestResult(TestState state, string name) string.Empty, string.Empty, Guid.Empty, - default, - default) + null, + null) { } /// diff --git a/CSharpInteractive.HostApi/VSTest.cs b/CSharpInteractive.HostApi/VSTest.cs index 58f34a5f..1cb60d3c 100644 --- a/CSharpInteractive.HostApi/VSTest.cs +++ b/CSharpInteractive.HostApi/VSTest.cs @@ -65,20 +65,20 @@ public partial record VSTest( string Tests = "", string TestCaseFilter = "", string Framework = "", - VSTestPlatform? Platform = default, + VSTestPlatform? Platform = null, string Settings = "", - bool? ListTests = default, - bool? Parallel = default, + bool? ListTests = null, + bool? Parallel = null, string TestAdapterPath = "", - bool? Blame = default, + bool? Blame = null, string Diag = "", string ResultsDirectory = "", - int? ParentProcessId = default, - int? Port = default, + int? ParentProcessId = null, + int? Port = null, string Collect = "", - bool? InIsolation = default, - DotNetVerbosity? Verbosity = default, - bool? Diagnostics = default, + bool? InIsolation = null, + DotNetVerbosity? Verbosity = null, + bool? Diagnostics = null, string ShortName = "") { /// diff --git a/CSharpInteractive.Tests/AddNuGetReferenceCommandFactoryTests.cs b/CSharpInteractive.Tests/AddNuGetReferenceCommandFactoryTests.cs index 239becb9..98b98171 100644 --- a/CSharpInteractive.Tests/AddNuGetReferenceCommandFactoryTests.cs +++ b/CSharpInteractive.Tests/AddNuGetReferenceCommandFactoryTests.cs @@ -101,7 +101,7 @@ internal void ShouldCreateCommands(string replCommand, ICommand[] expectedComman new object[] { "#r \"nuget:Abc\"", - new[] {new AddNuGetReferenceCommand("Abc", default)}, + new[] {new AddNuGetReferenceCommand("Abc", null)}, false }, // Errors diff --git a/CSharpInteractive.Tests/AddNuGetReferenceCommandRunnerTests.cs b/CSharpInteractive.Tests/AddNuGetReferenceCommandRunnerTests.cs index 3a0cabc7..e227b571 100644 --- a/CSharpInteractive.Tests/AddNuGetReferenceCommandRunnerTests.cs +++ b/CSharpInteractive.Tests/AddNuGetReferenceCommandRunnerTests.cs @@ -31,7 +31,7 @@ public void ShouldSkipWhenNotPassAddPackageReferenceCommand() var result = runner.TryRun(command); // Then - result.ShouldBe(new CommandResult(command, default)); + result.ShouldBe(new CommandResult(command, null)); } [Fact] diff --git a/CSharpInteractive.Tests/BuildContextTests.cs b/CSharpInteractive.Tests/BuildContextTests.cs index e5d3b298..0a606876 100644 --- a/CSharpInteractive.Tests/BuildContextTests.cs +++ b/CSharpInteractive.Tests/BuildContextTests.cs @@ -13,7 +13,7 @@ public void ShouldProcessStdOutput() // Given var result = CreateInstance(); var output = new Output(Mock.Of(), false, "Abc", 33); - var msg = new BuildMessage(output, BuildMessageState.StdOut, default, "Abc"); + var msg = new BuildMessage(output, BuildMessageState.StdOut, null, "Abc"); // When var messages = result.ProcessOutput(output); @@ -30,7 +30,7 @@ public void ShouldProcessErrOutput() // Given var result = CreateInstance(); var output = new Output(Mock.Of(), true, "Abc", 33); - var msg = new BuildMessage(output, BuildMessageState.StdError, default, "Abc"); + var msg = new BuildMessage(output, BuildMessageState.StdError, null, "Abc"); // When var messages = result.ProcessOutput(output); @@ -226,7 +226,7 @@ public void ShouldProcessMessage(string status, BuildMessageState state) var buildMessage = new BuildMessage( output, state, - default, + null, "some text", "error details", "xUnit1026", @@ -292,7 +292,7 @@ public void ShouldBuildProblem() var buildMessage = new BuildMessage( output, BuildMessageState.BuildProblem, - default, + null, "Problem description", "error details", "xUnit1026", diff --git a/CSharpInteractive.Tests/BuildMessageLogWriterTests.cs b/CSharpInteractive.Tests/BuildMessageLogWriterTests.cs index 760cd270..42728c58 100644 --- a/CSharpInteractive.Tests/BuildMessageLogWriterTests.cs +++ b/CSharpInteractive.Tests/BuildMessageLogWriterTests.cs @@ -15,7 +15,7 @@ public void ShouldWriteInfo() var writer = CreateInstance(); // When - writer.Write(ProcessInfo, new BuildMessage(Output, BuildMessageState.StdOut, default, "Abc")); + writer.Write(ProcessInfo, new BuildMessage(Output, BuildMessageState.StdOut, null, "Abc")); // Then _stdOut.Verify(i => i.WriteLine(It.Is(text => text.SequenceEqual(new[] {new Text("Abc")})))); @@ -28,7 +28,7 @@ public void ShouldWriteStdErr() var writer = CreateInstance(); // When - writer.Write(ProcessInfo, new BuildMessage(Output, BuildMessageState.StdError, default, "Abc")); + writer.Write(ProcessInfo, new BuildMessage(Output, BuildMessageState.StdError, null, "Abc")); // Then _stdErr.Verify(i => i.WriteLine(It.Is(text => text.SequenceEqual(new[] {new Text("Abc")})))); @@ -41,7 +41,7 @@ public void ShouldWriteWarning() var writer = CreateInstance(); // When - writer.Write(ProcessInfo, new BuildMessage(Output, BuildMessageState.Warning, default, "Abc")); + writer.Write(ProcessInfo, new BuildMessage(Output, BuildMessageState.Warning, null, "Abc")); // Then _log.Verify(i => i.Warning(It.IsAny())); @@ -56,7 +56,7 @@ public void ShouldWriteError(BuildMessageState state) var writer = CreateInstance(); // When - writer.Write(ProcessInfo, new BuildMessage(Output, state, default, "Abc")); + writer.Write(ProcessInfo, new BuildMessage(Output, state, null, "Abc")); // Then _log.Verify(i => i.Error(ErrorId.Build, It.IsAny())); diff --git a/CSharpInteractive.Tests/BuildRunnerTests.cs b/CSharpInteractive.Tests/BuildRunnerTests.cs index a6cf3a42..041c7219 100644 --- a/CSharpInteractive.Tests/BuildRunnerTests.cs +++ b/CSharpInteractive.Tests/BuildRunnerTests.cs @@ -90,7 +90,7 @@ public void ShouldRunBuildWhenHasNoHandler() .Returns(_processResult); // When - var result = buildService.Build(_process.Object, default, TimeSpan.FromSeconds(1)); + var result = buildService.Build(_process.Object, null, TimeSpan.FromSeconds(1)); // Then output.Handled.ShouldBeTrue(); diff --git a/CSharpInteractive.Tests/CISettingsTests.cs b/CSharpInteractive.Tests/CISettingsTests.cs index 466d41fa..45e74ac5 100644 --- a/CSharpInteractive.Tests/CISettingsTests.cs +++ b/CSharpInteractive.Tests/CISettingsTests.cs @@ -38,7 +38,7 @@ public void ShouldProvideIsUnderTeamCity(string? projectName, string? version, b [InlineData("Abc", true)] [InlineData("", false)] [InlineData(" ", false)] - [InlineData(default, false)] + [InlineData(null, false)] public void ShouldProvideIsGitLab(string? pipelineId, bool expectedIsUnderGitLab) { // Given @@ -56,7 +56,7 @@ public void ShouldProvideIsGitLab(string? pipelineId, bool expectedIsUnderGitLab [InlineData("Abc", true)] [InlineData("", false)] [InlineData(" ", false)] - [InlineData(default, false)] + [InlineData(null, false)] public void ShouldProvideIsAzureDevOps(string? pipelineId, bool expectedIsUnderAzureDevOps) { // Given diff --git a/CSharpInteractive.Tests/CSharpScriptCommandRunnerTests.cs b/CSharpInteractive.Tests/CSharpScriptCommandRunnerTests.cs index 0a4360e9..8dd49752 100644 --- a/CSharpInteractive.Tests/CSharpScriptCommandRunnerTests.cs +++ b/CSharpInteractive.Tests/CSharpScriptCommandRunnerTests.cs @@ -13,7 +13,7 @@ public void ShouldRunScriptCommand(bool result) var command = new ScriptCommand("abc", "code"); var commandRunner = CreateInstance(); // ReSharper disable once RedundantArgumentDefaultValue - _csharpScriptRunner.Setup(i => i.Run(command, "code")).Returns(new CommandResult(command, result, default)); + _csharpScriptRunner.Setup(i => i.Run(command, "code")).Returns(new CommandResult(command, result, null)); // When var actualResult = commandRunner.TryRun(command); @@ -52,7 +52,7 @@ public void ShouldSkipUnhandledCommand() // Then actualResult.Command.ShouldBe(command); - actualResult.Success.ShouldBe(default); + actualResult.Success.ShouldBe(null); } private CSharpScriptCommandRunner CreateInstance() => diff --git a/CSharpInteractive.Tests/CommandsRunnerTests.cs b/CSharpInteractive.Tests/CommandsRunnerTests.cs index 96c071e8..66f1c643 100644 --- a/CSharpInteractive.Tests/CommandsRunnerTests.cs +++ b/CSharpInteractive.Tests/CommandsRunnerTests.cs @@ -14,12 +14,12 @@ public CommandsRunnerTests() { _commandRunner1 = new Mock(); _commandRunner1.Setup(i => i.TryRun(HelpCommand.Shared)).Returns(new CommandResult(HelpCommand.Shared, true)); - _commandRunner1.Setup(i => i.TryRun(ResetCommand.Shared)).Returns(new CommandResult(HelpCommand.Shared, default)); - _commandRunner1.Setup(i => i.TryRun(new CodeCommand(false))).Returns(new CommandResult(new CodeCommand(), default)); + _commandRunner1.Setup(i => i.TryRun(ResetCommand.Shared)).Returns(new CommandResult(HelpCommand.Shared, null)); + _commandRunner1.Setup(i => i.TryRun(new CodeCommand(false))).Returns(new CommandResult(new CodeCommand(), null)); _commandRunner2 = new Mock(); _commandRunner2.Setup(i => i.TryRun(ResetCommand.Shared)).Returns(new CommandResult(ResetCommand.Shared, false)); - _commandRunner2.Setup(i => i.TryRun(HelpCommand.Shared)).Returns(new CommandResult(HelpCommand.Shared, default)); - _commandRunner2.Setup(i => i.TryRun(new CodeCommand(false))).Returns(new CommandResult(new CodeCommand(), default)); + _commandRunner2.Setup(i => i.TryRun(HelpCommand.Shared)).Returns(new CommandResult(HelpCommand.Shared, null)); + _commandRunner2.Setup(i => i.TryRun(new CodeCommand(false))).Returns(new CommandResult(new CodeCommand(), null)); _statisticsToken = new Mock(); _statisticsRegistry = new Mock(); _statisticsRegistry.Setup(i => i.Start()).Returns(_statisticsToken.Object); @@ -55,12 +55,12 @@ internal void ShouldRunCommands(ICommand[] commands, CommandResult[] expectedRes new object[] { new[] {new CodeCommand()}, - new[] {new CommandResult(new CodeCommand(), default)} + new[] {new CommandResult(new CodeCommand(), null)} }, new object[] { new[] {new CodeCommand(), HelpCommand.Shared, ResetCommand.Shared}, - new[] {new CommandResult(new CodeCommand(), default), new CommandResult(HelpCommand.Shared, true), new CommandResult(ResetCommand.Shared, false)} + new[] {new CommandResult(new CodeCommand(), null), new CommandResult(HelpCommand.Shared, true), new CommandResult(ResetCommand.Shared, false)} } }; diff --git a/CSharpInteractive.Tests/CustomMessagesProcessorTests.cs b/CSharpInteractive.Tests/CustomMessagesProcessorTests.cs index df6cb851..c9ed422f 100644 --- a/CSharpInteractive.Tests/CustomMessagesProcessorTests.cs +++ b/CSharpInteractive.Tests/CustomMessagesProcessorTests.cs @@ -11,8 +11,8 @@ public void ShouldProcessMessages() { // Given var output = new Output(_startInfo.Object, false, "Output", 11); - var msg1 = new BuildMessage(Output, BuildMessageState.StdOut, default, "Msg1"); - var msg2 = new BuildMessage(Output, BuildMessageState.StdError, default, "Msg2"); + var msg1 = new BuildMessage(Output, BuildMessageState.StdOut, null, "Msg1"); + var msg2 = new BuildMessage(Output, BuildMessageState.StdError, null, "Msg2"); var messages = new[] {msg1, msg2}; var nextHandler = new Mock>(); var processor = CreateInstance(); diff --git a/CSharpInteractive.Tests/DefaultBuildMessagesProcessorTests.cs b/CSharpInteractive.Tests/DefaultBuildMessagesProcessorTests.cs index e5d30189..dde6fb97 100644 --- a/CSharpInteractive.Tests/DefaultBuildMessagesProcessorTests.cs +++ b/CSharpInteractive.Tests/DefaultBuildMessagesProcessorTests.cs @@ -25,7 +25,7 @@ public void ShouldSendServiceMessagesToTeamCityViaProcessOutputWhenIsUnderTeamCi var output = new Output(_startInfo.Object, false, "Output", 11); var messages = new BuildMessage[] { - new(Output, BuildMessageState.StdOut, default, "Msg1"), + new(Output, BuildMessageState.StdOut, null, "Msg1"), new(Output, state, Mock.Of()) }; @@ -46,7 +46,7 @@ public void ShouldProcessBuildMessageWhenIsNotUnderTeamCity() { // Given var output = new Output(_startInfo.Object, false, "Output", 11); - var msg1 = new BuildMessage(Output, BuildMessageState.StdOut, default, "Msg1"); + var msg1 = new BuildMessage(Output, BuildMessageState.StdOut, null, "Msg1"); var msg2 = new BuildMessage(Output, BuildMessageState.ServiceMessage, Mock.Of()); _teamCitySettings.SetupGet(i => i.CIType).Returns(CIType.Unknown); @@ -68,8 +68,8 @@ public void ShouldProcessBuildMessageWhenHasNotTeamCityServiceMessages() { // Given var output = new Output(_startInfo.Object, false, "Output", 11); - var msg1 = new BuildMessage(Output, BuildMessageState.StdOut, default, "Msg1"); - var msg2 = new BuildMessage(Output, BuildMessageState.StdError, default, "Error"); + var msg1 = new BuildMessage(Output, BuildMessageState.StdOut, null, "Msg1"); + var msg2 = new BuildMessage(Output, BuildMessageState.StdError, null, "Error"); _teamCitySettings.SetupGet(i => i.CIType).Returns(CIType.TeamCity); var nextHandler = new Mock>(); diff --git a/CSharpInteractive.Tests/Integration/Core/TestComposition.cs b/CSharpInteractive.Tests/Integration/Core/TestComposition.cs index a2dd7988..249ac606 100644 --- a/CSharpInteractive.Tests/Integration/Core/TestComposition.cs +++ b/CSharpInteractive.Tests/Integration/Core/TestComposition.cs @@ -11,7 +11,7 @@ internal partial class TestComposition private static void Setup() => DI.Setup(nameof(TestComposition)) .Bind().To() - .Root("FileSystem", default, RootKinds.Static) + .Root("FileSystem", null, RootKinds.Static) .Bind().To() - .Root("ServiceMessageParser", default, RootKinds.Static); + .Root("ServiceMessageParser", null, RootKinds.Static); } \ No newline at end of file diff --git a/CSharpInteractive.Tests/NuGetReferenceResolverTests.cs b/CSharpInteractive.Tests/NuGetReferenceResolverTests.cs index c5e94a95..78ee41a1 100644 --- a/CSharpInteractive.Tests/NuGetReferenceResolverTests.cs +++ b/CSharpInteractive.Tests/NuGetReferenceResolverTests.cs @@ -36,7 +36,7 @@ public NuGetReferenceResolverTests() Sources, FallbackFolders, _command.VersionRange, - default, + null, PackagesPath); _nugetRestoreService.Setup(i => i.TryRestore(settings, out projectAssetsJson)).Returns(true); @@ -76,7 +76,7 @@ public void ShouldFailWhenRestoreFail() Sources, FallbackFolders, _command.VersionRange, - default, + null, PackagesPath); _nugetRestoreService.Setup(i => i.TryRestore(settings, out projectAssetsJson)).Returns(false); var result = resolver.TryResolveAssemblies(_command.PackageId, _command.VersionRange, out _); diff --git a/CSharpInteractive.Tests/NuGetServiceTests.cs b/CSharpInteractive.Tests/NuGetServiceTests.cs index 0dc170fa..8220cf7a 100644 --- a/CSharpInteractive.Tests/NuGetServiceTests.cs +++ b/CSharpInteractive.Tests/NuGetServiceTests.cs @@ -43,7 +43,7 @@ public NuGetServiceTests() { new object?[] {"myPackages", false, Path.Combine("WD", "myPackages")}, new object?[] {"myPackages", true, "myPackages"}, - new object?[] {default, true, "defaultPackagesPath"} + new object?[] {null, true, "defaultPackagesPath"} }; [Theory] diff --git a/CSharpInteractive.Tests/ProcessResultHandlerTests.cs b/CSharpInteractive.Tests/ProcessResultHandlerTests.cs index f5eb33a9..1f36a186 100644 --- a/CSharpInteractive.Tests/ProcessResultHandlerTests.cs +++ b/CSharpInteractive.Tests/ProcessResultHandlerTests.cs @@ -89,7 +89,7 @@ public void ShouldLogErrorWhenFailedAndHasNoHandlerAndHasError() var error = new Exception("Some error."); // When - handler.Handle(new ProcessResult(_processInfo, ProcessState.FailedToStart, 12, _description, default, error), default(Action)); + handler.Handle(new ProcessResult(_processInfo, ProcessState.FailedToStart, 12, _description, null, error), default(Action)); // Then _log.Verify(i => i.Error(ErrorId.Process, It.Is(text => text.Length == 3))); diff --git a/CSharpInteractive.Tests/ProcessRunnerTests.cs b/CSharpInteractive.Tests/ProcessRunnerTests.cs index fde2e513..0bc3a46f 100644 --- a/CSharpInteractive.Tests/ProcessRunnerTests.cs +++ b/CSharpInteractive.Tests/ProcessRunnerTests.cs @@ -23,7 +23,7 @@ public void ShouldKillWhenTimeoutIsExpired() _processManager.Setup(i => i.Start(_startInfo.Object, out exception)).Returns(true); _processManager.Setup(i => i.WaitForExit(timeout)).Returns(false); _processManager.SetupGet(i => i.Id).Returns(99); - _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Canceled, default, default)).Returns(_processResult); + _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Canceled, null, null)).Returns(_processResult); var instance = CreateInstance(); // When @@ -33,7 +33,7 @@ public void ShouldKillWhenTimeoutIsExpired() _processManager.Verify(i => i.WaitForExit(timeout)); _processManager.Verify(i => i.Kill()); _monitor.Verify(i => i.Started(_startInfo.Object, 99)); - _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Canceled, default, default)); + _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Canceled, null, null)); } [Fact] @@ -47,7 +47,7 @@ public void ShouldRunWhenTimeoutIsSpecified() _processManager.Setup(i => i.WaitForExit(timeout)).Returns(true); _processManager.SetupGet(i => i.ExitCode).Returns(1); _processManager.SetupGet(i => i.Id).Returns(99); - _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, default)).Returns(_processResult); + _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, null)).Returns(_processResult); var instance = CreateInstance(); // When @@ -57,7 +57,7 @@ public void ShouldRunWhenTimeoutIsSpecified() _processManager.Verify(i => i.WaitForExit(timeout)); _processManager.Verify(i => i.Kill(), Times.Never); _monitor.Verify(i => i.Started(_startInfo.Object, 99)); - _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, default)); + _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, null)); } [Fact] @@ -71,7 +71,7 @@ public void ShouldRunWhenTimeoutIsNotSpecified() _processManager.Setup(i => i.WaitForExit(TimeSpan.Zero)).Returns(true); _processManager.SetupGet(i => i.ExitCode).Returns(1); _processManager.SetupGet(i => i.Id).Returns(99); - _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, default)).Returns(_processResult); + _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, null)).Returns(_processResult); var instance = CreateInstance(); // When @@ -81,7 +81,7 @@ public void ShouldRunWhenTimeoutIsNotSpecified() _processManager.Verify(i => i.WaitForExit(TimeSpan.Zero)); _processManager.Verify(i => i.Kill(), Times.Never); _monitor.Verify(i => i.Started(_startInfo.Object, 99)); - _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, default)); + _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, null)); } [Fact] @@ -94,7 +94,7 @@ public void ShouldNotWaitWhenCannotStart() var exception = cannotStart; _processManager.Setup(i => i.Start(_startInfo.Object, out exception)).Returns(false); _processManager.SetupGet(i => i.Id).Returns(99); - _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.FailedToStart, default, exception)).Returns(_processResult); + _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.FailedToStart, null, exception)).Returns(_processResult); var instance = CreateInstance(); // When @@ -102,7 +102,7 @@ public void ShouldNotWaitWhenCannotStart() // Then _processManager.Verify(i => i.WaitForExit(TimeSpan.Zero), Times.Never); - _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.FailedToStart, default, exception)); + _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.FailedToStart, null, exception)); } [Fact] @@ -135,7 +135,7 @@ public void ShouldRun() _processManager.Setup(i => i.WaitForExit(TimeSpan.FromDays(1))).Returns(true); _processManager.SetupGet(i => i.ExitCode).Returns(1); _processManager.SetupGet(i => i.Id).Returns(99); - _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, default)).Returns(_processResult); + _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, null)).Returns(_processResult); var instance = CreateInstance(); // When @@ -144,7 +144,7 @@ public void ShouldRun() // Then _processManager.Verify(i => i.Kill(), Times.Never); _monitor.Verify(i => i.Started(_startInfo.Object, 99)); - _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, default)); + _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, null)); } [Fact] @@ -157,7 +157,7 @@ public void ShouldRunWhenStateProviderIsNotDefined() _processManager.Setup(i => i.WaitForExit(TimeSpan.FromDays(1))).Returns(true); _processManager.SetupGet(i => i.ExitCode).Returns(1); _processManager.SetupGet(i => i.Id).Returns(99); - _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, default)).Returns(_processResult); + _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 1, null)).Returns(_processResult); var instance = CreateInstance(); // When @@ -178,7 +178,7 @@ public async Task ShouldRunAsync() _processManager.SetupGet(i => i.ExitCode).Returns(2); _processManager.SetupAdd(i => i.OnExit += It.IsAny()).Callback(i => i()); _processManager.SetupGet(i => i.Id).Returns(99); - _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 2, default)).Returns(_processResult); + _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 2, null)).Returns(_processResult); var cancellationTokenSource = new CancellationTokenSource(); var instance = CreateInstance(); @@ -189,7 +189,7 @@ public async Task ShouldRunAsync() // Then _processManager.Verify(i => i.Kill(), Times.Never); _monitor.Verify(i => i.Started(_startInfo.Object, 99)); - _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 2, default)); + _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 2, null)); } [Fact] @@ -202,7 +202,7 @@ public async Task ShouldKillWhenCanceled() _processManager.SetupGet(i => i.ExitCode).Returns(2); _processManager.SetupAdd(i => i.OnExit += It.IsAny()).Callback(i => i()); _processManager.SetupGet(i => i.Id).Returns(99); - _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 2, default)).Returns(_processResult); + _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 2, null)).Returns(_processResult); var cancellationTokenSource = new CancellationTokenSource(); var instance = CreateInstance(); @@ -213,7 +213,7 @@ public async Task ShouldKillWhenCanceled() // Then _processManager.Verify(i => i.Kill(), Times.Once); _monitor.Verify(i => i.Started(_startInfo.Object, 99)); - _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Canceled, default, default)); + _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Canceled, null, null)); } [Fact] @@ -226,7 +226,7 @@ public async Task ShouldThrowException() _processManager.SetupGet(i => i.ExitCode).Returns(2); _processManager.SetupAdd(i => i.OnExit += It.IsAny()).Callback(i => i()); _processManager.SetupGet(i => i.Id).Returns(99); - _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 2, default)).Returns(_processResult); + _monitor.Setup(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Finished, 2, null)).Returns(_processResult); var cancellationTokenSource = new CancellationTokenSource(); var instance = CreateInstance(); @@ -237,7 +237,7 @@ public async Task ShouldThrowException() // Then _processManager.Verify(i => i.Kill(), Times.Once); _monitor.Verify(i => i.Started(_startInfo.Object, 99)); - _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Canceled, default, default)); + _monitor.Verify(i => i.Finished(It.Is(j => j.StartInfo == _startInfo.Object), It.IsAny(), ProcessState.Canceled, null, null)); } private void Handler(Output output) => _output.Add(output); diff --git a/CSharpInteractive.Tests/ScriptRunnerTests.cs b/CSharpInteractive.Tests/ScriptRunnerTests.cs index 75f5fbbc..138d88ea 100644 --- a/CSharpInteractive.Tests/ScriptRunnerTests.cs +++ b/CSharpInteractive.Tests/ScriptRunnerTests.cs @@ -62,7 +62,7 @@ internal void ShouldRun(CommandResult[] results, string[] errors, string[] warni new object[] { - new CommandResult[] {new(new CodeCommand(), default), new(new CodeCommand(), default), new(new ScriptCommand(string.Empty, string.Empty), default)}, + new CommandResult[] {new(new CodeCommand(), null), new(new CodeCommand(), null), new(new ScriptCommand(string.Empty, string.Empty), null)}, Array.Empty(), Array.Empty(), 0 @@ -71,7 +71,7 @@ internal void ShouldRun(CommandResult[] results, string[] errors, string[] warni // Warnings new object[] { - new CommandResult[] {new(new CodeCommand(), default), new(new CodeCommand(), default), new(new ScriptCommand(string.Empty, string.Empty), true)}, + new CommandResult[] {new(new CodeCommand(), null), new(new CodeCommand(), null), new(new ScriptCommand(string.Empty, string.Empty), true)}, Array.Empty(), new[] {"warn"}, 0 diff --git a/CSharpInteractive.Tests/UsageScenarios/BaseScenario.cs b/CSharpInteractive.Tests/UsageScenarios/BaseScenario.cs index 5fc9dd51..f08029cb 100644 --- a/CSharpInteractive.Tests/UsageScenarios/BaseScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/BaseScenario.cs @@ -22,7 +22,7 @@ public BaseScenario(ITestOutputHelper output) { _output = output; Composition.Shared.Root.TestEnvironment.IsTesting = true; - Composition.Shared.Root.TestEnvironment.ExitCode = default; + Composition.Shared.Root.TestEnvironment.ExitCode = null; _tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()[..4]); Directory.CreateDirectory(_tempDir); _prevCurDir = Environment.CurrentDirectory; @@ -69,13 +69,13 @@ public bool HasSdk(string sdkVersion) public void WriteLine(T line, Color color = Color.Default) => Composition.Shared.Root.Host.WriteLine(line, color); - public void Error(string? error, string? errorId = default) => Composition.Shared.Root.Host.Error(error, errorId); + public void Error(string? error, string? errorId = null) => Composition.Shared.Root.Host.Error(error, errorId); public void Warning(string? warning) => Composition.Shared.Root.Host.Warning(warning); public void Info(string? text) => Composition.Shared.Root.Host.Info(text); - public void Trace(string? trace, string? origin = default) => Composition.Shared.Root.Host.Trace(trace, origin); + public void Trace(string? trace, string? origin = null) => Composition.Shared.Root.Host.Trace(trace, origin); private class Properties : IProperties { diff --git a/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncCancellation.cs b/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncCancellation.cs index 9392abb7..696bcc40 100644 --- a/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncCancellation.cs +++ b/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncCancellation.cs @@ -25,7 +25,7 @@ public void Run() var cancellationTokenSource = new CancellationTokenSource(); var task = new CommandLine("cmd", "/c", "TIMEOUT", "/T", "120") - .RunAsync(default, cancellationTokenSource.Token); + .RunAsync(null, cancellationTokenSource.Token); cancellationTokenSource.CancelAfter(TimeSpan.FromMilliseconds(100)); task.IsCompleted.ShouldBeFalse(); diff --git a/CSharpInteractive.Tests/UsageScenarios/CommandLineWithTimeoutScenario.cs b/CSharpInteractive.Tests/UsageScenarios/CommandLineWithTimeoutScenario.cs index 03f858aa..0ecf2dce 100644 --- a/CSharpInteractive.Tests/UsageScenarios/CommandLineWithTimeoutScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/CommandLineWithTimeoutScenario.cs @@ -25,7 +25,7 @@ public void Run() // ## using HostApi; var exitCode = new CommandLine("cmd", "/c", "TIMEOUT", "/T", "120") - .Run(default, TimeSpan.FromMilliseconds(1)) + .Run(null, TimeSpan.FromMilliseconds(1)) .ExitCode; // } diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetCustomScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetCustomScenario.cs index 46556909..1c2a1bba 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetCustomScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetCustomScenario.cs @@ -23,7 +23,7 @@ public void Run() // ## using HostApi; // Gets the dotnet version, running a command like: "dotnet --version" - NuGetVersion? version = default; + NuGetVersion? version = null; new DotNetCustom("--version") .Run(message => NuGetVersion.TryParse(message.Line, out version)) .EnsureSuccess(); diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigGetScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigGetScenario.cs index a84afc24..bbaf2b1d 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigGetScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigGetScenario.cs @@ -32,7 +32,7 @@ public void Run() // { // ## using HostApi; - string? repositoryPath = default; + string? repositoryPath = null; new DotNetNuGetConfigGet() .WithConfigKey("repositoryPath") .Run(output => repositoryPath = output.Line).EnsureSuccess(); diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigSetScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigSetScenario.cs index 1b288734..5deb4e42 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigSetScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigSetScenario.cs @@ -32,7 +32,7 @@ public void Run() .Run().EnsureSuccess(); // } - string? repositoryPath = default; + string? repositoryPath = null; new DotNetNuGetConfigGet() .WithConfigKey("repositoryPath") .Run(output => repositoryPath = output.Line).EnsureSuccess(); diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigUnsetScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigUnsetScenario.cs index dfec7322..2abc744b 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigUnsetScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetNuGetConfigUnsetScenario.cs @@ -15,7 +15,7 @@ public class DotNetNuGetConfigUnsetScenario(ITestOutputHelper output) : BaseScen public void Run() { Skip.IfNot(HasSdk("8.0.10")); - ExpectedExitCode = default; + ExpectedExitCode = null; var configFile = Path.GetFullPath("nuget.config"); File.WriteAllText(configFile, ""); new DotNetNuGetConfigSet() diff --git a/CSharpInteractive/Core/AddNuGetReferenceCommandRunner.cs b/CSharpInteractive/Core/AddNuGetReferenceCommandRunner.cs index 84807b83..f91d002c 100644 --- a/CSharpInteractive/Core/AddNuGetReferenceCommandRunner.cs +++ b/CSharpInteractive/Core/AddNuGetReferenceCommandRunner.cs @@ -13,7 +13,7 @@ public CommandResult TryRun(ICommand command) { if (command is not AddNuGetReferenceCommand addPackageReferenceCommand) { - return new CommandResult(command, default); + return new CommandResult(command, null); } if (!nuGetReferenceResolver.TryResolveAssemblies(addPackageReferenceCommand.PackageId, addPackageReferenceCommand.VersionRange, out var assemblies)) diff --git a/CSharpInteractive/Core/AssembliesScriptOptionsProvider.cs b/CSharpInteractive/Core/AssembliesScriptOptionsProvider.cs index ad37d5b5..57b5816c 100644 --- a/CSharpInteractive/Core/AssembliesScriptOptionsProvider.cs +++ b/CSharpInteractive/Core/AssembliesScriptOptionsProvider.cs @@ -56,7 +56,7 @@ private HashSet GetAssemblies() { _log.Trace(() => [new Text("Loading assemblies.")]); var assemblies = _assembliesProvider - .GetAssemblies(Refs.Where(i => i.type != default).Select(i => i.type!)) + .GetAssemblies(Refs.Where(i => i.type != null).Select(i => i.type!)) .Where(_ => !_cancellationToken.IsCancellationRequested) .Where(i => !string.IsNullOrWhiteSpace(i.Location)) .ToHashSet(); diff --git a/CSharpInteractive/Core/BuildContext.cs b/CSharpInteractive/Core/BuildContext.cs index 1b1bf00a..53c77d44 100644 --- a/CSharpInteractive/Core/BuildContext.cs +++ b/CSharpInteractive/Core/BuildContext.cs @@ -33,12 +33,12 @@ public IReadOnlyList ProcessOutput(Output output) BuildMessage message; if (output.IsError) { - message = new BuildMessage(output, BuildMessageState.StdError, default, output.Line); + message = new BuildMessage(output, BuildMessageState.StdError, null, output.Line); _errors.Add(message); } else { - message = new BuildMessage(output, BuildMessageState.StdOut, default, output.Line); + message = new BuildMessage(output, BuildMessageState.StdOut, null, output.Line); } return [message]; @@ -153,7 +153,7 @@ private static BuildMessage CreateMessage(Output srcOutput, IServiceMessage mess var buildMessage = new BuildMessage( srcOutput, state, - default, + null, text, message.GetValue("errorDetails") ?? string.Empty, message.GetValue("code") ?? string.Empty, @@ -220,7 +220,7 @@ private class TestContext public void AddStdOut(IStartInfo info, int processId, string? text) { - if (text != default) + if (text != null) { Output.Add(new Output(info, false, text, processId)); } @@ -228,7 +228,7 @@ public void AddStdOut(IStartInfo info, int processId, string? text) public void AddStdErr(IStartInfo info, int processId, string? error) { - if (error != default) + if (error != null) { Output.Add(new Output(info, true, error, processId)); } diff --git a/CSharpInteractive/Core/BuildOutputProcessor.cs b/CSharpInteractive/Core/BuildOutputProcessor.cs index 533d417a..cd5987b8 100644 --- a/CSharpInteractive/Core/BuildOutputProcessor.cs +++ b/CSharpInteractive/Core/BuildOutputProcessor.cs @@ -10,7 +10,7 @@ internal class BuildOutputProcessor(IServiceMessageParser serviceMessageParser) public IEnumerable Convert(Output output, IBuildContext context) { var messages = new List(); - foreach (var message in serviceMessageParser.ParseServiceMessages(output.Line).Where(message => message != default)) + foreach (var message in serviceMessageParser.ParseServiceMessages(output.Line).Where(message => message != null)) { var buildMessage = new BuildMessage(output, BuildMessageState.ServiceMessage, message); if (buildMessage.TestResult.HasValue) diff --git a/CSharpInteractive/Core/BuildRunner.cs b/CSharpInteractive/Core/BuildRunner.cs index c5d1b353..dad32dac 100644 --- a/CSharpInteractive/Core/BuildRunner.cs +++ b/CSharpInteractive/Core/BuildRunner.cs @@ -25,7 +25,7 @@ internal class BuildRunner( ICommandLineStatisticsRegistry statisticsRegistry) : IBuildRunner { - public IBuildResult Build(ICommandLine commandLine, Action? handler = default, TimeSpan timeout = default) + public IBuildResult Build(ICommandLine commandLine, Action? handler = null, TimeSpan timeout = default) { ArgumentNullException.ThrowIfNull(commandLine); var buildContext = buildContextFactory(); @@ -42,7 +42,7 @@ public IBuildResult Build(ICommandLine commandLine, Action? handle return buildResult; } - public async Task BuildAsync(ICommandLine commandLine, Action? handler = default, CancellationToken cancellationToken = default) + public async Task BuildAsync(ICommandLine commandLine, Action? handler = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(commandLine); var buildContext = buildContextFactory(); @@ -75,7 +75,7 @@ private IStartInfo CreateStartInfo(ICommandLine commandLine) private void Handle(ProcessInfo processInfo, Action? handler, Output output, IBuildContext buildContext) { var messages = buildOutputProcessor.Convert(output, buildContext).ToList(); - if (handler != default) + if (handler != null) { customBuildMessagesProcessor.ProcessMessages(processInfo, output, messages, handler); } diff --git a/CSharpInteractive/Core/CSharpScriptCommandRunner.cs b/CSharpInteractive/Core/CSharpScriptCommandRunner.cs index 138e9c01..ec7dcac7 100644 --- a/CSharpInteractive/Core/CSharpScriptCommandRunner.cs +++ b/CSharpInteractive/Core/CSharpScriptCommandRunner.cs @@ -17,7 +17,7 @@ public CommandResult TryRun(ICommand command) return new CommandResult(command, true); default: - return new CommandResult(command, default); + return new CommandResult(command, null); } } } \ No newline at end of file diff --git a/CSharpInteractive/Core/CSharpScriptRunner.cs b/CSharpInteractive/Core/CSharpScriptRunner.cs index 14cd749c..5fb46b0c 100644 --- a/CSharpInteractive/Core/CSharpScriptRunner.cs +++ b/CSharpInteractive/Core/CSharpScriptRunner.cs @@ -44,7 +44,7 @@ public CommandResult Run(ICommand sourceCommand, string script) stopwatch.Stop(); log.Trace(() => [new Text($"Time Elapsed {stopwatch.Elapsed:g}")]); diagnosticsPresenter.Show(new CompilationDiagnostics(sourceCommand, _scriptState.Script.GetCompilation().GetDiagnostics().ToList().AsReadOnly())); - if (_scriptState.ReturnValue != default) + if (_scriptState.ReturnValue != null) { if (success && exitCodeParser.TryParse(_scriptState.ReturnValue, out var exitCode)) { @@ -77,6 +77,6 @@ public CommandResult Run(ICommand sourceCommand, string script) public void Reset() { log.Trace(() => [new Text("Reset state.")]); - _scriptState = default; + _scriptState = null; } } \ No newline at end of file diff --git a/CSharpInteractive/Core/CommandLineResult.cs b/CSharpInteractive/Core/CommandLineResult.cs index 695d54e6..97377fe7 100644 --- a/CSharpInteractive/Core/CommandLineResult.cs +++ b/CSharpInteractive/Core/CommandLineResult.cs @@ -8,8 +8,8 @@ internal record CommandLineResult( IStartInfo StartInfo, ProcessState State, long ElapsedMilliseconds, - int? ExitCode = default, - Exception? Error = default) + int? ExitCode = null, + Exception? Error = null) : ICommandLineResult, ISuccessDeterminant { public override string ToString() diff --git a/CSharpInteractive/Core/CommandLineRunner.cs b/CSharpInteractive/Core/CommandLineRunner.cs index 5d723a18..d8d9ee63 100644 --- a/CSharpInteractive/Core/CommandLineRunner.cs +++ b/CSharpInteractive/Core/CommandLineRunner.cs @@ -13,7 +13,7 @@ internal class CommandLineRunner( ICommandLineStatisticsRegistry statisticsRegistry) : ICommandLineRunner { - public ICommandLineResult Run(ICommandLine commandLine, Action? handler = default, TimeSpan timeout = default) + public ICommandLineResult Run(ICommandLine commandLine, Action? handler = null, TimeSpan timeout = default) { ArgumentNullException.ThrowIfNull(commandLine); var processResult = processRunner.Run(new ProcessInfo(commandLine.GetStartInfo(host), monitorFactory(), ProcessInfo.CreateRunId(), handler), timeout); @@ -24,7 +24,7 @@ public ICommandLineResult Run(ICommandLine commandLine, Action? handler return commandLineResult; } - public async Task RunAsync(ICommandLine commandLine, Action? handler = default, CancellationToken cancellationToken = default) + public async Task RunAsync(ICommandLine commandLine, Action? handler = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(commandLine); var processResult = await processRunner.RunAsync(new ProcessInfo(commandLine.GetStartInfo(host), monitorFactory(), ProcessInfo.CreateRunId(), handler), cancellationToken); diff --git a/CSharpInteractive/Core/CommandResult.cs b/CSharpInteractive/Core/CommandResult.cs index 7cae8761..51037530 100644 --- a/CSharpInteractive/Core/CommandResult.cs +++ b/CSharpInteractive/Core/CommandResult.cs @@ -7,4 +7,4 @@ namespace CSharpInteractive.Core; internal record CommandResult( ICommand Command, bool? Success, - int? ExitCode = default); \ No newline at end of file + int? ExitCode = null); \ No newline at end of file diff --git a/CSharpInteractive/Core/CommandsRunner.cs b/CSharpInteractive/Core/CommandsRunner.cs index e62e3fc7..a8c1305a 100644 --- a/CSharpInteractive/Core/CommandsRunner.cs +++ b/CSharpInteractive/Core/CommandsRunner.cs @@ -28,7 +28,7 @@ public IEnumerable Run(IEnumerable commands) if (!processed) { - yield return new CommandResult(command, default); + yield return new CommandResult(command, null); } } } diff --git a/CSharpInteractive/Core/ConsoleSource.cs b/CSharpInteractive/Core/ConsoleSource.cs index 9bdf9517..5ae67888 100644 --- a/CSharpInteractive/Core/ConsoleSource.cs +++ b/CSharpInteractive/Core/ConsoleSource.cs @@ -21,7 +21,7 @@ internal class ConsoleSource(CancellationToken cancellationToken) : ICodeSource, public bool MoveNext() { - if (Current == default) + if (Current == null) { Task.Run(() => { Current = System.Console.In.ReadLine() ?? string.Empty; }, cancellationToken).Wait(cancellationToken); } diff --git a/CSharpInteractive/Core/Environment.cs b/CSharpInteractive/Core/Environment.cs index bef30aa8..d386bc06 100644 --- a/CSharpInteractive/Core/Environment.cs +++ b/CSharpInteractive/Core/Environment.cs @@ -128,14 +128,14 @@ public bool TryGetSourceName([NotNullWhen(true)] out string? name) return !string.IsNullOrWhiteSpace(name); } - name = default; + name = null; return false; } private bool TryGetCurrentSource([NotNullWhen(true)] out ICodeSource? source) { source = _sources.LastOrDefault(); - return source != default; + return source != null; } private static string GetWorkingDirectory() => Directory.GetCurrentDirectory(); diff --git a/CSharpInteractive/Core/ExitCodeParser.cs b/CSharpInteractive/Core/ExitCodeParser.cs index e090f01e..d63bf16c 100644 --- a/CSharpInteractive/Core/ExitCodeParser.cs +++ b/CSharpInteractive/Core/ExitCodeParser.cs @@ -43,7 +43,7 @@ public bool TryParse(object returnValue, out int exitCode) return true; default: - exitCode = default; + exitCode = 0; return false; } } diff --git a/CSharpInteractive/Core/ExitTracker.cs b/CSharpInteractive/Core/ExitTracker.cs index c7f2c35d..2ae29eb1 100644 --- a/CSharpInteractive/Core/ExitTracker.cs +++ b/CSharpInteractive/Core/ExitTracker.cs @@ -47,14 +47,14 @@ private static void ClearEvents(Type type) foreach (var eventInfo in events) { var fieldInfo = type.GetField(eventInfo.Name, BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance); - if (fieldInfo?.GetValue(default) is not Delegate eventHandler) + if (fieldInfo?.GetValue(null) is not Delegate eventHandler) { continue; } foreach (var invocation in eventHandler.GetInvocationList()) { - eventInfo?.GetRemoveMethod(fieldInfo.IsPrivate)?.Invoke(default, [invocation]); + eventInfo?.GetRemoveMethod(fieldInfo.IsPrivate)?.Invoke(null, [invocation]); } } } diff --git a/CSharpInteractive/Core/HelpCommandRunner.cs b/CSharpInteractive/Core/HelpCommandRunner.cs index fee2b452..ebfbf8c4 100644 --- a/CSharpInteractive/Core/HelpCommandRunner.cs +++ b/CSharpInteractive/Core/HelpCommandRunner.cs @@ -8,7 +8,7 @@ public CommandResult TryRun(ICommand command) { if (command is not HelpCommand) { - return new CommandResult(command, default); + return new CommandResult(command, null); } info.ShowReplHelp(); diff --git a/CSharpInteractive/Core/HostService.cs b/CSharpInteractive/Core/HostService.cs index 03dbf38d..a23d6f9d 100644 --- a/CSharpInteractive/Core/HostService.cs +++ b/CSharpInteractive/Core/HostService.cs @@ -29,9 +29,9 @@ public IReadOnlyList Args public void WriteLine(T line, Color color = Color.Default) => stdOut.WriteLine(new Text(line?.ToString() ?? string.Empty, color)); - public void Error(string? error, string? errorId = default) + public void Error(string? error, string? errorId = null) { - if (error != default) + if (error != null) { log.Error(new ErrorId(errorId ?? "Unknown"), error); } @@ -39,7 +39,7 @@ public void Error(string? error, string? errorId = default) public void Warning(string? warning) { - if (warning != default) + if (warning != null) { log.Warning(warning); } @@ -47,15 +47,15 @@ public void Warning(string? warning) public void Info(string? text) { - if (text != default) + if (text != null) { log.Info(text); } } - public void Trace(string? trace, string? origin = default) + public void Trace(string? trace, string? origin = null) { - if (trace != default) + if (trace != null) { log.Trace(() => [new Text(trace)], origin ?? string.Empty); } diff --git a/CSharpInteractive/Core/IProcessMonitor.cs b/CSharpInteractive/Core/IProcessMonitor.cs index dced3700..971b19d8 100644 --- a/CSharpInteractive/Core/IProcessMonitor.cs +++ b/CSharpInteractive/Core/IProcessMonitor.cs @@ -6,5 +6,5 @@ internal interface IProcessMonitor { void Started(IStartInfo startInfo, int processId); - ProcessResult Finished(ProcessInfo processInfo, long elapsedMilliseconds, ProcessState state, int? exitCode = default, Exception? error = default); + ProcessResult Finished(ProcessInfo processInfo, long elapsedMilliseconds, ProcessState state, int? exitCode = null, Exception? error = null); } \ No newline at end of file diff --git a/CSharpInteractive/Core/IStartInfoDescription.cs b/CSharpInteractive/Core/IStartInfoDescription.cs index 072f7f44..313d589d 100644 --- a/CSharpInteractive/Core/IStartInfoDescription.cs +++ b/CSharpInteractive/Core/IStartInfoDescription.cs @@ -4,7 +4,7 @@ internal interface IStartInfoDescription { - string GetDescription(IStartInfo? startInfo, int? processId = default); + string GetDescription(IStartInfo? startInfo, int? processId = null); - IEnumerable GetDescriptionText(IStartInfo? startInfo, int? processId = default); + IEnumerable GetDescriptionText(IStartInfo? startInfo, int? processId = null); } \ No newline at end of file diff --git a/CSharpInteractive/Core/MSBuildArgumentsTool.cs b/CSharpInteractive/Core/MSBuildArgumentsTool.cs index f9bd54be..a4b54695 100644 --- a/CSharpInteractive/Core/MSBuildArgumentsTool.cs +++ b/CSharpInteractive/Core/MSBuildArgumentsTool.cs @@ -61,7 +61,7 @@ private static bool TryDecode(char ch, out int value) return true; default: - value = default; + value = 0; return false; } } diff --git a/CSharpInteractive/Core/MessagesReader.cs b/CSharpInteractive/Core/MessagesReader.cs index c29b3fee..ae224aba 100644 --- a/CSharpInteractive/Core/MessagesReader.cs +++ b/CSharpInteractive/Core/MessagesReader.cs @@ -43,7 +43,7 @@ public IEnumerable Read(string indicesFile, string messagesFile continue; } - foreach (var message in serviceMessageParser.ParseServiceMessages(line).Where(message => message != default)) + foreach (var message in serviceMessageParser.ParseServiceMessages(line).Where(message => message != null)) { yield return message; } diff --git a/CSharpInteractive/Core/NuGetReferenceResolver.cs b/CSharpInteractive/Core/NuGetReferenceResolver.cs index a73cf47a..94e8d0fc 100644 --- a/CSharpInteractive/Core/NuGetReferenceResolver.cs +++ b/CSharpInteractive/Core/NuGetReferenceResolver.cs @@ -25,7 +25,7 @@ public bool TryResolveAssemblies(string packageId, VersionRange? versionRange, o nugetEnvironment.Sources, nugetEnvironment.FallbackFolders, versionRange, - default, + null, nugetEnvironment.PackagesPath ), out var projectAssetsJson); diff --git a/CSharpInteractive/Core/ProcessInfo.cs b/CSharpInteractive/Core/ProcessInfo.cs index 6b662bfa..136defac 100644 --- a/CSharpInteractive/Core/ProcessInfo.cs +++ b/CSharpInteractive/Core/ProcessInfo.cs @@ -8,7 +8,7 @@ internal record ProcessInfo( IStartInfo StartInfo, IProcessMonitor Monitor, int RunId, - Action? Handler = default) + Action? Handler = null) { private static int _lastRunId; diff --git a/CSharpInteractive/Core/ProcessManager.cs b/CSharpInteractive/Core/ProcessManager.cs index ee196adf..3b8ad5c4 100644 --- a/CSharpInteractive/Core/ProcessManager.cs +++ b/CSharpInteractive/Core/ProcessManager.cs @@ -54,7 +54,7 @@ public bool Start(IStartInfo info, out Exception? error) { if (!_process.Start()) { - error = default; + error = null; return false; } } @@ -76,7 +76,7 @@ public bool Start(IStartInfo info, out Exception? error) _description = _startInfoDescription.GetDescription(_startInfo, Id); _process.BeginOutputReadLine(); _process.BeginErrorReadLine(); - error = default; + error = null; return true; } @@ -128,14 +128,14 @@ private void ProcessOnExited(object? sender, EventArgs e) private void ProcessOutput(DataReceivedEventArgs e, bool isError) { var line = e.Data; - if (line == default) + if (line == null) { return; } var handler = OnOutput; var output = new Output(_startInfo!, isError, line, Id); - if (handler != default) + if (handler != null) { _log.Trace(() => [isError ? StdErrPrefix : StdOutPrefix, new Text(line)], _description); handler(output); @@ -156,8 +156,8 @@ public void Dispose() return; } - OnOutput = default; - OnExit = default; + OnOutput = null; + OnExit = null; _process.Exited -= ProcessOnExited; _process.OutputDataReceived -= ProcessOnOutputDataReceived; _process.ErrorDataReceived -= ProcessOnErrorDataReceived; diff --git a/CSharpInteractive/Core/ProcessMonitor.cs b/CSharpInteractive/Core/ProcessMonitor.cs index 1811a3d5..e05dc19d 100644 --- a/CSharpInteractive/Core/ProcessMonitor.cs +++ b/CSharpInteractive/Core/ProcessMonitor.cs @@ -40,7 +40,7 @@ public void Started(IStartInfo startInfo, int processId) } } - public ProcessResult Finished(ProcessInfo processInfo, long elapsedMilliseconds, ProcessState state, int? exitCode = default, Exception? error = default) => + public ProcessResult Finished(ProcessInfo processInfo, long elapsedMilliseconds, ProcessState state, int? exitCode = null, Exception? error = null) => new( processInfo, state, diff --git a/CSharpInteractive/Core/ProcessOutputWriter.cs b/CSharpInteractive/Core/ProcessOutputWriter.cs index 90592ade..921f26a1 100644 --- a/CSharpInteractive/Core/ProcessOutputWriter.cs +++ b/CSharpInteractive/Core/ProcessOutputWriter.cs @@ -14,7 +14,7 @@ public void Write(Output output) } else { - console.WriteToOut((default, output.Line), (default, System.Environment.NewLine)); + console.WriteToOut((null, output.Line), (null, System.Environment.NewLine)); } } } \ No newline at end of file diff --git a/CSharpInteractive/Core/ProcessResult.cs b/CSharpInteractive/Core/ProcessResult.cs index cffdb430..cd2f0499 100644 --- a/CSharpInteractive/Core/ProcessResult.cs +++ b/CSharpInteractive/Core/ProcessResult.cs @@ -9,5 +9,5 @@ internal record ProcessResult( ProcessState State, long ElapsedMilliseconds, Text[] Description, - int? ExitCode = default, - Exception? Error = default); \ No newline at end of file + int? ExitCode = null, + Exception? Error = null); \ No newline at end of file diff --git a/CSharpInteractive/Core/ProcessResultHandler.cs b/CSharpInteractive/Core/ProcessResultHandler.cs index a51bdd84..12cd21c8 100644 --- a/CSharpInteractive/Core/ProcessResultHandler.cs +++ b/CSharpInteractive/Core/ProcessResultHandler.cs @@ -16,12 +16,12 @@ public void Handle(ProcessResult result, Action? handler) } var description = result.Description; - if (result.Error != default) + if (result.Error != null) { description = description + Text.Space + new Text(result.Error.Message); } - if (handler == default) + if (handler == null) { switch (result.State) { diff --git a/CSharpInteractive/Core/ProcessRunner.cs b/CSharpInteractive/Core/ProcessRunner.cs index bdf5e556..eeb1a217 100644 --- a/CSharpInteractive/Core/ProcessRunner.cs +++ b/CSharpInteractive/Core/ProcessRunner.cs @@ -61,7 +61,7 @@ private class Process(ProcessInfo processInfo, IProcessManager processManager) public bool TryStart([MaybeNullWhen(true)] out ProcessResult processResult) { - if (Handler != default) + if (Handler != null) { ProcessManager.OnOutput += Handler; } @@ -71,17 +71,17 @@ public bool TryStart([MaybeNullWhen(true)] out ProcessResult processResult) { Stopwatch.Stop(); { - processResult = Monitor.Finished(processInfo, Stopwatch.ElapsedMilliseconds, ProcessState.FailedToStart, default, error); + processResult = Monitor.Finished(processInfo, Stopwatch.ElapsedMilliseconds, ProcessState.FailedToStart, null, error); return false; } } Monitor.Started(StartInfo, ProcessManager.Id); - processResult = default; + processResult = null; return true; } - public ProcessResult Finish(bool finished, Exception? error = default) + public ProcessResult Finish(bool finished, Exception? error = null) { if (finished) { diff --git a/CSharpInteractive/Core/RuntimeExplorer.cs b/CSharpInteractive/Core/RuntimeExplorer.cs index 3cbd64fa..07ae7fdb 100644 --- a/CSharpInteractive/Core/RuntimeExplorer.cs +++ b/CSharpInteractive/Core/RuntimeExplorer.cs @@ -13,11 +13,11 @@ public bool TryFindRuntimeAssembly(string assemblyPath, [MaybeNullWhen(false)] o { if (string.IsNullOrWhiteSpace(runtimePath)) { - runtimeAssemblyPath = default; + runtimeAssemblyPath = null; return false; } runtimeAssemblyPath = fileSystem.EnumerateFileSystemEntries(runtimePath, Path.GetFileName(assemblyPath), SearchOption.TopDirectoryOnly).FirstOrDefault(); - return runtimeAssemblyPath != default; + return runtimeAssemblyPath != null; } } \ No newline at end of file diff --git a/CSharpInteractive/Core/ScriptRunner.cs b/CSharpInteractive/Core/ScriptRunner.cs index 2578374f..db4ea8e0 100644 --- a/CSharpInteractive/Core/ScriptRunner.cs +++ b/CSharpInteractive/Core/ScriptRunner.cs @@ -17,7 +17,7 @@ public int Run() var summary = new Summary(true); try { - int? exitCode = default; + int? exitCode = null; foreach (var (command, success, currentExitCode) in commandsRunner.Run(GetCommands())) { if (success.HasValue) diff --git a/CSharpInteractive/Core/SettingCommandRunner.cs b/CSharpInteractive/Core/SettingCommandRunner.cs index d9f539c2..f53ae384 100644 --- a/CSharpInteractive/Core/SettingCommandRunner.cs +++ b/CSharpInteractive/Core/SettingCommandRunner.cs @@ -11,7 +11,7 @@ public CommandResult TryRun(ICommand command) { if (command is not SettingCommand settingCommand) { - return new CommandResult(command, default); + return new CommandResult(command, null); } var previousValue = settingSetter.SetSetting(settingCommand.Value); diff --git a/CSharpInteractive/Core/StartInfoDescription.cs b/CSharpInteractive/Core/StartInfoDescription.cs index 828b49e1..e826442f 100644 --- a/CSharpInteractive/Core/StartInfoDescription.cs +++ b/CSharpInteractive/Core/StartInfoDescription.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Core; internal class StartInfoDescription : IStartInfoDescription { - public string GetDescription(IStartInfo? startInfo, int? processId = default) + public string GetDescription(IStartInfo? startInfo, int? processId = null) { var sb = new StringBuilder(); if (processId.HasValue) @@ -35,7 +35,7 @@ public string GetDescription(IStartInfo? startInfo, int? processId = default) return sb.ToString(); } - public IEnumerable GetDescriptionText(IStartInfo? startInfo, int? processId = default) + public IEnumerable GetDescriptionText(IStartInfo? startInfo, int? processId = null) { if (processId.HasValue) { diff --git a/CSharpInteractive/Core/Summary.cs b/CSharpInteractive/Core/Summary.cs index a5592518..96f1dd99 100644 --- a/CSharpInteractive/Core/Summary.cs +++ b/CSharpInteractive/Core/Summary.cs @@ -5,7 +5,7 @@ namespace CSharpInteractive.Core; using Immutype; [Target] -internal record Summary(bool? Success = default) +internal record Summary(bool? Success = null) { public static readonly Summary Empty = new(); } \ No newline at end of file diff --git a/CSharpInteractive/Core/TextReplacer.cs b/CSharpInteractive/Core/TextReplacer.cs index 4a970499..19f7bd83 100644 --- a/CSharpInteractive/Core/TextReplacer.cs +++ b/CSharpInteractive/Core/TextReplacer.cs @@ -29,6 +29,6 @@ private static IEnumerable ReadLines(TextReader reader) { yield return line; } - } while (line != default); + } while (line != null); } } \ No newline at end of file diff --git a/CSharpInteractive/Core/TextToColorStrings.cs b/CSharpInteractive/Core/TextToColorStrings.cs index 7e79cb22..2cfa90a5 100644 --- a/CSharpInteractive/Core/TextToColorStrings.cs +++ b/CSharpInteractive/Core/TextToColorStrings.cs @@ -8,7 +8,7 @@ internal class TextToColorStrings : ITextToColorStrings { private static readonly Dictionary Colors = new() { - {39, default}, + {39, null}, {30, ConsoleColor.Black}, {31, ConsoleColor.DarkRed}, {32, ConsoleColor.DarkGreen}, diff --git a/CSharpInteractive/Host.cs b/CSharpInteractive/Host.cs index 7adfa5d5..127536e3 100644 --- a/CSharpInteractive/Host.cs +++ b/CSharpInteractive/Host.cs @@ -149,7 +149,7 @@ private static void CurrentDomainOnUnhandledException(object sender, UnhandledEx /// /// Error message. /// Unique error identifier, optional. - public static void Error(string? error, string? errorId = default) => CurHost.Error(error, errorId); + public static void Error(string? error, string? errorId = null) => CurHost.Error(error, errorId); /// /// Writes a warning to stdOut. This warning will affect the summary run statistics. @@ -190,7 +190,7 @@ private static void CurrentDomainOnUnhandledException(object sender, UnhandledEx /// /// Trace message. /// Source of the trace message, optional. - public static void Trace(string? trace, string? origin = default) => CurHost.Trace(trace, origin); + public static void Trace(string? trace, string? origin = null) => CurHost.Trace(trace, origin); /// /// Provides an instance of a service by its type. @@ -227,7 +227,7 @@ private static void CurrentDomainOnUnhandledException(object sender, UnhandledEx /// public static ICommandLineResult Run( this ICommandLine commandLine, - Action? handler = default, + Action? handler = null, TimeSpan timeout = default) { ArgumentNullException.ThrowIfNull(commandLine); @@ -252,7 +252,7 @@ public static ICommandLineResult Run( /// public static Task RunAsync( this ICommandLine commandLine, - Action? handler = default, + Action? handler = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(commandLine); @@ -275,7 +275,7 @@ public static Task RunAsync( /// public static IBuildResult Build( this ICommandLine commandLine, - Action? handler = default, + Action? handler = null, TimeSpan timeout = default) { ArgumentNullException.ThrowIfNull(commandLine); @@ -300,7 +300,7 @@ public static IBuildResult Build( /// public static Task BuildAsync( this ICommandLine commandLine, - Action? handler = default, + Action? handler = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(commandLine); @@ -321,7 +321,7 @@ public static Task BuildAsync( /// public static IEnumerable EnsureSuccess( this IEnumerable result, - Func? isSuccess = default, + Func? isSuccess = null, int? failureExitCode = 1) where TResult: ICommandLineResult { @@ -344,7 +344,7 @@ public static IEnumerable EnsureSuccess( /// public static async Task> EnsureSuccess( this Task> result, - Func? isSuccess = default, + Func? isSuccess = null, int? failureExitCode = 1) where TResult: ICommandLineResult { @@ -366,7 +366,7 @@ public static async Task> EnsureSuccess( /// public static TResult[] EnsureSuccess( this TResult[] result, - Func? isSuccess = default, + Func? isSuccess = null, int? failureExitCode = 1) where TResult: ICommandLineResult { @@ -389,7 +389,7 @@ public static TResult[] EnsureSuccess( /// public static async Task EnsureSuccess( this Task result, - Func? isSuccess = default, + Func? isSuccess = null, int? failureExitCode = 1) where TResult: ICommandLineResult { @@ -418,7 +418,7 @@ public static async Task EnsureSuccess( /// public static TResult EnsureSuccess( this TResult result, - Func? isSuccess = default, + Func? isSuccess = null, int? failureExitCode = 1) where TResult: ICommandLineResult { @@ -448,7 +448,7 @@ public static TResult EnsureSuccess( /// public static async Task EnsureSuccess( this Task result, - Func? isSuccess = default, + Func? isSuccess = null, int? failureExitCode = 1) where TResult: ICommandLineResult { @@ -541,7 +541,7 @@ public static T Get( private static T EnsureSuccess( T result, - Func? isSuccess = default, + Func? isSuccess = null, int? failureExitCode = 1) where T: IEnumerable where TResult: ICommandLineResult diff --git a/CSharpInteractive/Program.cs b/CSharpInteractive/Program.cs index 7a69a410..35cafcac 100644 --- a/CSharpInteractive/Program.cs +++ b/CSharpInteractive/Program.cs @@ -69,7 +69,7 @@ internal int Run() using (Disposable.Create(_activeObjects.Select(i => i.Activate()).ToArray())) { var result = _runner().Run(); - if (_statistics.Errors.Any()) + if (_statistics.Errors.Count != 0) { result = 1; }