7 types derived from GracefulException
dotnet (5)
NugetPackageDownloader\ToolPackageException.cs (1)
10internal class NuGetPackageInstallerException : GracefulException
NugetSearch\NugetSearchApiRequestException.cs (1)
10internal class NugetSearchApiRequestException(string message) : GracefulException([message], null, false)
ToolManifest\ToolManifestCannotBeFoundException.cs (1)
10internal class ToolManifestCannotBeFoundException : GracefulException
ToolManifest\ToolManifestException.cs (1)
10internal class ToolManifestException(string message) : GracefulException([message], null, false)
ToolPackage\ToolPackageException.cs (1)
10internal class ToolPackageException : GracefulException
Microsoft.DotNet.Cli.Utils (2)
CommandAvailableAsDotNetToolException.cs (1)
6public class CommandAvailableAsDotNetToolException : GracefulException
CommandUnknownException.cs (1)
6public class CommandUnknownException : GracefulException
150 instantiations of GracefulException
dotnet (146)
CommandFactory\CommandResolution\LocalToolsCommandResolver.cs (2)
91throw new GracefulException(string.Format(CliStrings.NeedRunToolRestore, 100throw new GracefulException(string.Format(CliStrings.NeedRunToolRestore,
CommandFactory\CommandResolution\PackagedCommandSpecFactory.cs (1)
80throw new GracefulException(string.Format(
CommandFactory\CommandResolution\PackagedCommandSpecFactoryWithCliRuntime.cs (1)
24throw new GracefulException(string.Format(CliStrings.CouldNotFindToolRuntimeConfigFile,
CommandFactory\CommandResolution\ProjectFactory.cs (1)
78throw new GracefulException(string.Format(
CommandFactory\CommandResolution\ProjectToolsCommandResolver.cs (2)
323throw new GracefulException(CliStrings.DepsJsonGeneratorProjectNotSet); 426throw new GracefulException(string.Format(CliStrings.UnableToGenerateDepsJson, toolDepsJsonGeneratorProject));
CommandFactory\CommandResolution\ToolPathCalculator.cs (1)
33throw new GracefulException(string.Format(
Commands\Package\Add\PackageAddCommand.cs (4)
56throw new GracefulException(string.Format(CliCommandStrings.CmdDGFileIOException, projectFilePath), ioex); 102throw new GracefulException(string.Format(CliCommandStrings.CmdDGFileException, projectFilePath)); 162throw new GracefulException(CliCommandStrings.InvalidOptionForFileBasedApp, option.Name); 171throw new GracefulException(CliCommandStrings.PrereleaseAndVersionAreNotSupportedAtTheSameTime);
Commands\Package\List\PackageListCommand.cs (5)
107throw new GracefulException(CliCommandStrings.OptionsCannotBeCombined); 144throw new GracefulException(CliStrings.MoreThanOneSolutionInDirectory, resultPath); 161throw new GracefulException(CliCommandStrings.NoProjectsOrSolutions, resultPath); 171throw new GracefulException(CliStrings.MoreThanOneProjectInDirectory, resultPath); 178throw new GracefulException(CliCommandStrings.PackageListFileNotFound, resultPath);
Commands\Package\PackageCommandParser.cs (1)
62(true, true) => throw new GracefulException(CliCommandStrings.CannotCombineOptions, FileOption.Name, ProjectOption.Name),
Commands\Package\Remove\PackageRemoveCommand.cs (1)
21throw new GracefulException(CliCommandStrings.PackageRemoveSpecifyExactlyOnePackageReference);
Commands\Project\Convert\ProjectConvertCommand.cs (2)
25throw new GracefulException(CliCommandStrings.InvalidFilePath, file); 165throw new GracefulException(CliCommandStrings.DirectoryAlreadyExists, targetDirectory);
Commands\Reference\Remove\ReferenceRemoveCommand.cs (1)
29throw new GracefulException(CliStrings.SpecifyAtLeastOneReferenceToRemove);
Commands\Run\LaunchSettings\LaunchSettingsManager.cs (1)
61throw new GracefulException(CliCommandStrings.DuplicateCaseInsensitiveLaunchProfileNames,
Commands\Run\RunCommand.cs (12)
141throw new GracefulException(CliCommandStrings.CannotCombineOptions, RunCommandParser.NoCacheOption.Name, RunCommandParser.NoBuildOption.Name); 177throw new GracefulException( 331throw new GracefulException(CliCommandStrings.RunCommandException); 495throw new GracefulException(CliCommandStrings.RunCommandEvaluationExceptionBuildFailed, Constants.ComputeRunArguments); 508throw new GracefulException(CliCommandStrings.RunCommandExceptionUnableToRunSpecifyFramework, "--framework"); 512throw new GracefulException( 544throw new GracefulException(CliCommandStrings.CmdNonExistentFileErrorDescription, projectFilePath); 555throw new GracefulException(CliCommandStrings.RunCommandExceptionNoProjects, projectFileOrDirectoryPath, "--project"); 571throw new GracefulException(CliCommandStrings.RunCommandExceptionMultipleProjects, directory); 640throw new GracefulException(CliCommandStrings.CannotCombineOptions, RunCommandParser.ProjectOption.Name, RunCommandParser.FileOption.Name); 660throw new GracefulException(CliCommandStrings.InvalidOptionForStdin, RunCommandParser.NoBuildOption.Name); 665throw new GracefulException(CliCommandStrings.InvalidOptionForStdin, RunCommandParser.LaunchProfileOption.Name);
Commands\Run\VirtualProjectBuildingCommand.cs (2)
1884throw new GracefulException(CliStrings.CouldNotFindProjectOrDirectory, resolvedProjectPath); 1972throw new GracefulException($"{sourceFile.GetLocationString(span)}: {CliCommandStrings.DirectiveError}: {message}", inner);
Commands\Sdk\Check\ProductCollectionProvider.cs (2)
23throw new GracefulException(string.Format(CliCommandStrings.ReleasesLibraryFailed, e.Message)); 35throw new GracefulException(string.Format(CliCommandStrings.ReleasesLibraryFailed, e.Message));
Commands\Sdk\Check\SdkCheckCommand.cs (2)
69throw new GracefulException([CliCommandStrings.RuntimePropertyNotFound], [], isUserError: false); 72throw new GracefulException([CliCommandStrings.HostFxrCouldNotBeLoaded], [hostFxrNotFoundException.Message], isUserError: false);
Commands\Solution\Add\SolutionAddCommand.cs (2)
55throw new GracefulException(CliStrings.SpecifyAtLeastOneProjectToAdd); 183throw new GracefulException(string.Format(CliStrings.SolutionFolderAlreadyContainsProjectWithFilename, rootFolder.Name, projectFileName));
Commands\Solution\List\SolutionListCommand.cs (1)
28throw new GracefulException(CliStrings.InvalidSolutionFormatString, solutionFileFullPath, ex.Message);
Commands\Solution\Migrate\SolutionMigrateCommand.cs (2)
25throw new GracefulException(CliCommandStrings.CannotMigrateSlnx); 33throw new GracefulException(ex.Message, ex);
Commands\Solution\Remove\SolutionRemoveCommand.cs (3)
33throw new GracefulException(CliStrings.SpecifyAtLeastOneProjectToRemove); 53throw new GracefulException(CliStrings.InvalidSolutionFormatString, solutionFileFullPath, ex.Message); 55throw new GracefulException(ex.Message, ex);
Commands\Solution\SolutionArgumentValidator.cs (3)
24throw new GracefulException(message); 32throw new GracefulException(CliCommandStrings.SolutionFolderAndInRootMutuallyExclusive); 54throw new GracefulException(
Commands\Store\StoreCommand.cs (1)
34throw new GracefulException(CliCommandStrings.SpecifyManifests);
Commands\Test\MTP\SolutionAndProjectUtility.cs (2)
316throw new GracefulException( 358throw new GracefulException(CliCommandStrings.RunCommandEvaluationExceptionBuildFailed, s_computeRunArgumentsTarget[0]);
Commands\Test\MTP\ValidationUtility.cs (6)
30throw new GracefulException(CliCommandStrings.CmdMultipleBuildPathOptionsErrorDescription); 46throw new GracefulException(CliCommandStrings.CmdOptionCannotBeUsedWithTestModulesDescription); 88throw new GracefulException(CliCommandStrings.TestCommandUseSolution); 94throw new GracefulException(CliCommandStrings.TestCommandUseProject); 100throw new GracefulException(CliCommandStrings.TestCommandUseTestModules); 104throw new GracefulException(CliCommandStrings.TestCommandUseDirectoryWithSwitch);
Commands\Tool\Common\ToolAppliedOption.cs (3)
77throw new GracefulException( 101throw new GracefulException( 113throw new GracefulException(
Commands\Tool\Common\ToolManifestFinderExtensions.cs (1)
32throw new GracefulException([e.Message, CliCommandStrings.ToolCommonNoManifestGuide], verboseMessages: [e.VerboseMessage], isUserError: false);
Commands\Tool\Install\ParseResultExtension.cs (3)
20throw new GracefulException(CliStrings.PackageIdentityArgumentVersionOptionConflict); 29throw new GracefulException( 50throw new GracefulException(
Commands\Tool\Install\ToolInstallCommand.cs (1)
41throw new GracefulException(
Commands\Tool\Install\ToolInstallGlobalOrToolPathCommand.cs (6)
135throw new GracefulException(CliCommandStrings.ToolInstallPackageIdMissing); 149throw new GracefulException(string.Format(CliCommandStrings.ToolInstallNuGetConfigurationFileDoesNotExist, Path.GetFullPath(_configFilePath))); 265throw new GracefulException( 289throw new GracefulException( 311throw new GracefulException( 338throw new GracefulException(messages:
Commands\Tool\Install\ToolInstallLocalCommand.cs (1)
126throw new GracefulException(
Commands\Tool\Install\ToolInstallLocalInstaller.cs (2)
53throw new GracefulException( 91throw new GracefulException(
Commands\Tool\List\ToolListGlobalOrToolPathCommand.cs (1)
42throw new GracefulException(
Commands\Tool\Run\ToolRunCommand.cs (1)
40throw new GracefulException([string.Format(CliCommandStrings.CannotFindCommandName, toolCommandName)], isUserError: false);
Commands\Tool\ToolCommandSpecCreator.cs (1)
36throw new GracefulException(string.Format(CliStrings.ToolSettingsUnsupportedRunner,
Commands\Tool\Uninstall\ToolUninstallGlobalOrToolPathCommand.cs (4)
42throw new GracefulException( 63throw new GracefulException(messages: [string.Format(CliCommandStrings.ToolUninstallToolNotInstalled, packageId)], isUserError: false); 68throw new GracefulException(messages: [string.Format(CliCommandStrings.ToolUninstallToolHasMultipleVersionsInstalled, packageId)], isUserError: false); 89throw new GracefulException(
Commands\Tool\Uninstall\ToolUninstallLocalCommand.cs (1)
49throw new GracefulException([string.Format(CliCommandStrings.NoManifestFileContainPackageId, _packageId)], isUserError: false);
Commands\Tool\Update\ToolUpdateCommand.cs (2)
80throw new GracefulException(message); 89throw new GracefulException(CliStrings.PackageIdentityArgumentVersionOptionConflict);
Commands\Workload\Clean\WorkloadCleanCommand.cs (1)
38throw new GracefulException(CliCommandStrings.SdkVersionOptionNotSupported);
Commands\Workload\Elevate\WorkloadElevateCommand.cs (2)
27throw new GracefulException(e.Message, isUserError: false); 36throw new GracefulException(CliCommandStrings.RequiresWindows, isUserError: false);
Commands\Workload\Install\NetSdkMsiInstallerClient.cs (3)
365throw new GracefulException(string.Format(CliCommandStrings.WorkloadVersionRequestedNotFound, workloadSetVersion), ex is NuGetPackageNotFoundException ? ex : ex.InnerException); 791throw new GracefulException(string.Format(CliCommandStrings.FailedToExtractMsi, msiPath)); 806throw new GracefulException(string.Format(CliCommandStrings.ExpectedSingleManifest, nupkgPath));
Commands\Workload\Install\WorkloadInstallCommand.cs (7)
49throw new GracefulException(CliCommandStrings.CannotSpecifyVersionAndWorkloadIdsByComponent, isUserError: true); 101throw new GracefulException(string.Format(exceptionMessage, workloadId), isUserError: false); 150throw new GracefulException(string.Format(CliCommandStrings.WorkloadInstallWorkloadCacheDownloadFailed, e.Message), e, isUserError: false); 155throw new GracefulException(string.Format(CliCommandStrings.CannotCombineSkipManifestAndRollback, 160throw new GracefulException(string.Format(CliCommandStrings.CannotCombineSkipManifestAndVersion, 167throw new GracefulException(string.Format(CliCommandStrings.CannotUseSkipManifestWithGlobalJsonWorkloadVersion, 197throw new GracefulException(string.Format(CliCommandStrings.WorkloadInstallationFailed, e.Message), e, isUserError: false);
Commands\Workload\Install\WorkloadInstallerFactory.cs (1)
46throw new GracefulException(CliCommandStrings.InadequatePermissions, isUserError: false);
Commands\Workload\InstallingWorkloadCommand.cs (8)
66throw new GracefulException(CliCommandStrings.NoWorkloadHistoryRecords, isUserError: true); 73throw new GracefulException(CliCommandStrings.WorkloadHistoryRecordInvalidIdValue, isUserError: true); 120throw new GracefulException(CliCommandStrings.SdkVersionOptionNotSupported); 143throw new GracefulException(string.Format(CliCommandStrings.CannotSpecifyVersionOnCommandLineAndInGlobalJson, _globalJsonPath), isUserError: true); 147throw new GracefulException(string.Format(CliCommandStrings.CannotCombineOptions, 153throw new GracefulException(string.Format(CliCommandStrings.CannotCombineOptions, 159throw new GracefulException(CliCommandStrings.SpecifiedWorkloadVersionAndSpecificNonWorkloadVersion, isUserError: true); 163throw new GracefulException(CliCommandStrings.SpecifiedNoWorkloadVersionAndSpecificWorkloadVersion, isUserError: true);
Commands\Workload\Repair\WorkloadRepairCommand.cs (2)
44throw new GracefulException(CliCommandStrings.SdkVersionOptionNotSupported); 94throw new GracefulException(string.Format(CliCommandStrings.WorkloadRepairFailed, e.Message), e, isUserError: false);
Commands\Workload\Restore\WorkloadRestoreCommand.cs (2)
94throw new GracefulException( 139throw new GracefulException(
Commands\Workload\Search\WorkloadSearchCommand.cs (1)
29throw new GracefulException(CliCommandStrings.SdkVersionOptionNotSupported);
Commands\Workload\Search\WorkloadSearchVersionsCommand.cs (1)
42throw new GracefulException(CliCommandStrings.SdkVersionOptionNotSupported);
Commands\Workload\Uninstall\WorkloadUninstallCommand.cs (2)
39throw new GracefulException(CliCommandStrings.SdkVersionOptionNotSupported); 88throw new GracefulException(string.Format(CliCommandStrings.WorkloadUninstallFailed, e.Message), e, isUserError: false);
Commands\Workload\Update\WorkloadUpdateCommand.cs (2)
81throw new GracefulException(string.Format(CliCommandStrings.WorkloadUpdateWorkloadCacheDownloadFailed, e.Message), e, isUserError: false); 136throw new GracefulException(string.Format(CliCommandStrings.WorkloadUpdateFailed, e.Message), e, isUserError: false);
Commands\Workload\WorkloadCommandBase.cs (1)
156throw new GracefulException(CliCommandStrings.SkipSignCheckInvalidOption);
CommonArguments.cs (2)
48throw new GracefulException(CliStrings.PackageIdentityArgumentIdOrVersionIsNull); 58throw new GracefulException(string.Format(CliStrings.InvalidVersion, versionString));
CommonOptions.cs (4)
401throw new GracefulException(CliStrings.SelfContainAndNoSelfContainedConflict); 409throw new GracefulException(CliStrings.CannotSpecifyBothRuntimeAndArchOptions); 425throw new GracefulException(CliStrings.CannotSpecifyBothRuntimeAndOsOptions); 461throw new GracefulException(CliStrings.CannotResolveRuntimeIdentifier);
Extensions\ParseResultExtensions.cs (1)
187throw new GracefulException(CliStrings.OnlyOneProjectAllowed);
MsbuildProject.cs (8)
55throw new GracefulException(CliStrings.ProjectDoesNotExist, projectPath); 61throw new GracefulException(CliStrings.ProjectIsInvalid, projectPath); 74throw new GracefulException(CliStrings.FoundInvalidProject, projectFile.FullName); 89throw new GracefulException(CliStrings.CouldNotFindProjectOrDirectory, projectDirectory); 94throw new GracefulException(CliStrings.CouldNotFindProjectOrDirectory, projectDirectory); 100throw new GracefulException( 107throw new GracefulException(CliStrings.MoreThanOneProjectInDirectory, projectDirectory); 230throw new GracefulException(string.Format(
NugetSearch\NugetSearchApiParameter.cs (1)
59throw new GracefulException(
ReleasePropertyProjectLocator.cs (1)
207throw new GracefulException(Strings.SolutionProjectConfigurationsConflict, _propertyToCheck, string.Join("\n", (configuredProjects).Select(x => x.FullPath)));
ShellShim\ShellShimTemplateFinder.cs (1)
50throw new GracefulException(string.Format(CliStrings.InvalidRuntimeIdentifier, rid, string.Join(" ", validRids)));
SlnFileFactory.cs (7)
25throw new GracefulException(CliStrings.CouldNotFindSolutionOrDirectory); 36throw new GracefulException( 42throw new GracefulException( 48throw new GracefulException( 79throw new GracefulException( 99throw new GracefulException( 122.Select(path => originalSolution.FindProject(path) ?? throw new GracefulException(
Microsoft.DotNet.Cli.Utils (2)
Extensions\LockFileFormatExtensions.cs (1)
19throw new GracefulException(string.Join(
PathUtility.cs (1)
382throw new GracefulException(
Microsoft.DotNet.PackageInstall.Tests (2)
ToolPackageDownloaderTests.cs (2)
366static void FailedStepAfterSuccessRestore() => throw new GracefulException("simulated error"); 452static void FailedStepAfterSuccessDownload() => throw new GracefulException("simulated error");
75 references to GracefulException
dotnet (5)
Commands\Run\VirtualProjectBuildingCommand.cs (1)
1887catch (GracefulException e)
Commands\Solution\Remove\SolutionRemoveCommand.cs (1)
49catch (Exception ex) when (ex is not GracefulException)
Parser.cs (1)
267if (exception is GracefulException)
ReleasePropertyProjectLocator.cs (2)
132catch (GracefulException) // Fall back to looking for a solution if multiple project files are found, or there's no project in the directory. 160catch (GracefulException)
dotnet.Tests (68)
CommandFactoryTests\GivenALocalToolsCommandResolver.cs (2)
152action.Should().Throw<GracefulException>(string.Format(CliStrings.NeedRunToolRestore, 176action.Should().Throw<GracefulException>(string.Format(CliStrings.NeedRunToolRestore,
CommandTests\MSBuild\GivenDotnetOsArchOptions.cs (4)
95var exceptionThrown = Assert.Throws<GracefulException>(() => BuildCommand.FromArgs(["--os", "os", "--runtime", "rid"], msbuildPath)); 106var exceptionThrown = Assert.Throws<GracefulException>(() => BuildCommand.FromArgs(["--arch", "arch", "--runtime", "rid"], msbuildPath));
CommandTests\Package\List\GivenDotnetListPackage.cs (1)
355Assert.Throws<GracefulException>(checkRules);
CommandTests\Project\Convert\DotnetProjectConvertTests.cs (1)
1303convert.Should().Throw<GracefulException>().WithMessage(expectedWildcardPattern);
CommandTests\Tool\Install\ToolInstallCommandTests.cs (5)
30a.Should().Throw<GracefulException>().And.Message 74a.Should().Throw<GracefulException>().And.Message 91a.Should().Throw<GracefulException>().And.Message 109a.Should().Throw<GracefulException>().And.Message 127a.Should().Throw<GracefulException>().And.Message
CommandTests\Tool\Install\ToolInstallGlobalOrToolPathCommandTests.cs (7)
280a.Should().Throw<GracefulException>().And.Message 301a.Should().Throw<GracefulException>().And.Message 325a.Should().Throw<GracefulException>().And.Message 398.Should().Throw<GracefulException>() 595a.Should().Throw<GracefulException>(); 718a.Should().Throw<GracefulException>(); 796a.Should().Throw<GracefulException>().And.Message
CommandTests\Tool\Install\ToolInstallLocalCommandTests.cs (3)
169a.Should().Throw<GracefulException>() 285a.Should().Throw<GracefulException>() 305a.Should().Throw<GracefulException>();
CommandTests\Tool\List\ToolListCommandTests.cs (2)
23a.Should().Throw<GracefulException>().And.Message 39a.Should().Throw<GracefulException>().And.Message
CommandTests\Tool\List\ToolListGlobalOrToolPathCommandTests.cs (1)
56a.Should().Throw<GracefulException>()
CommandTests\Tool\Search\NugetSearchApiParameterTests.cs (2)
17a.Should().Throw<GracefulException>(); 26a.Should().Throw<GracefulException>();
CommandTests\Tool\Uninstall\ToolUninstallCommandTests.cs (4)
33a.Should().Throw<GracefulException>().And.Message 48a.Should().Throw<GracefulException>().And.Message 63a.Should().Throw<GracefulException>().And.Message 77a.Should().Throw<GracefulException>().And.Message
CommandTests\Tool\Uninstall\ToolUninstallGlobalOrToolPathCommandTests.cs (3)
50a.Should().Throw<GracefulException>() 199a.Should().Throw<GracefulException>() 221a.Should().Throw<GracefulException>()
CommandTests\Tool\Uninstall\ToolUninstallLocalCommandTests.cs (3)
66a.Should().Throw<GracefulException>() 70a.Should().Throw<GracefulException>() 83a.Should().Throw<GracefulException>()
CommandTests\Tool\Update\ToolUpdateCommandTests.cs (7)
32a.Should().Throw<GracefulException>().And.Message 48a.Should().Throw<GracefulException>().And.Message 65a.Should().Throw<GracefulException>().And.Message 81a.Should().Throw<GracefulException>().And.Message 97a.Should().Throw<GracefulException>().And.Message 113a.Should().Throw<GracefulException>().And.Message 128a.Should().Throw<GracefulException>().And.Message
CommandTests\Tool\Update\ToolUpdateGlobalOrToolPathCommandTests.cs (4)
133a.Should().Throw<GracefulException>().And.Message 257a.Should().Throw<GracefulException>().And.Message 317a.Should().Throw<GracefulException>().And.Message 379a.Should().Throw<GracefulException>().And.Message.Should().Contain(
CommandTests\Tool\Update\ToolUpdateLocalCommandTests.cs (1)
372a.Should().Throw<GracefulException>().And.Message.Should().Contain(string.Format(
CommandTests\Workload\Install\GivenDotnetWorkloadInstall.cs (10)
93var exceptionThrown = Assert.Throws<GracefulException>(() => installManager.Execute()); 118var exceptionThrown = Assert.Throws<GracefulException>(() => installManager.Execute()); 342var exceptionThrown = Assert.Throws<GracefulException>(() => command.Execute()); 380var exceptionThrown = Assert.Throws<GracefulException>(() => installCommand.Execute()); 521var ex = Assert.Throws<GracefulException>(() => installCommand.Execute());
CommandTests\Workload\Uninstall\GivenDotnetWorkloadUninstall.cs (2)
56var exceptionThrown = Assert.Throws<GracefulException>(() => UninstallWorkload("mock-1", testDirectory, "6.0.100"));
CommandTests\Workload\Update\GivenDotnetWorkloadUpdate.cs (6)
406var exceptionThrown = Assert.Throws<GracefulException>(() => command.Execute()); 494var exceptionThrown = Assert.Throws<GracefulException>(() => new WorkloadUpdateCommand(updateParseResult, reporter: _reporter, workloadResolverFactory: workloadResolverFactory)); 607var exception = Assert.Throws<GracefulException>(() => updateCommand.Execute());
Microsoft.DotNet.PackageInstall.Tests (2)
ToolPackageDownloaderTests.cs (2)
387a.Should().Throw<GracefulException>().WithMessage("simulated error"); 490a.Should().Throw<GracefulException>().WithMessage("simulated error");