Skip to content

Commit ea6a8c1

Browse files
committed
Remove ListOfSearched
1 parent dff877f commit ea6a8c1

File tree

6 files changed

+12
-20
lines changed

6 files changed

+12
-20
lines changed

src/Cli/dotnet/CliStrings.resx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,8 @@ The default is 'false.' However, when targeting .NET 7 or lower, the default is
568568
<value>outputpathresolver: {0} does not exist</value>
569569
</data>
570570
<data name="CannotFindAManifestFile" xml:space="preserve">
571-
<value>Cannot find a manifest file.</value>
571+
<value>Cannot find a manifest file. The list of searched paths:
572+
{0}</value>
572573
</data>
573574
<data name="CannotFindPackageIdInManifest" xml:space="preserve">
574575
<value>Cannot find a package with the package id {0} in the manifest file.</value>
@@ -660,9 +661,6 @@ The default is 'false.' However, when targeting .NET 7 or lower, the default is
660661
<data name="LibraryNotFoundInLockFile" xml:space="preserve">
661662
<value>{0}: library not found in lock file.</value>
662663
</data>
663-
<data name="ListOfSearched" xml:space="preserve">
664-
<value>The list of searched paths:
665-
{0}</value>
666664
</data>
667665
<data name="LookingForPreferCliRuntimeFile" xml:space="preserve">
668666
<value>{0}: Looking for prefercliruntime file at `{1}`</value>

src/Cli/dotnet/ToolManifest/ToolManifestFinder.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ public IReadOnlyCollection<ToolManifestPackage> Find(FilePath? filePath = null)
4141

4242
if (!findAnyManifest)
4343
{
44-
throw new ToolManifestCannotBeFoundException(
45-
$@"{CliStrings.CannotFindAManifestFile},
46-
{string.Format(CliStrings.ListOfSearched, string.Join(Environment.NewLine, allPossibleManifests.Select(f => "\t" + f.manifestfile.Value)))}");
44+
throw new ToolManifestCannotBeFoundException(string.Format(CliStrings.CannotFindAManifestFile, string.Join(Environment.NewLine, allPossibleManifests.Select(f => "\t" + f.manifestfile.Value))));
4745
}
4846

4947
return [.. toolManifestPackageAndSource.Select(t => t.toolManifestPackage)];
@@ -181,9 +179,7 @@ public FilePath FindFirst(bool createIfNotFound = false)
181179
return new FilePath(WriteManifestFile(manifestInsertFolder));
182180
}
183181
}
184-
throw new ToolManifestCannotBeFoundException(
185-
$@"{CliStrings.CannotFindAManifestFile},
186-
{string.Format(CliStrings.ListOfSearched, string.Join(Environment.NewLine, EnumerateDefaultAllPossibleManifests().Select(f => "\t" + f.manifestfile.Value)))}");
182+
throw new ToolManifestCannotBeFoundException(string.Format(CliStrings.CannotFindAManifestFile, string.Join(Environment.NewLine, EnumerateDefaultAllPossibleManifests().Select(f => "\t" + f.manifestfile.Value))));
187183
}
188184

189185
/*
@@ -271,9 +267,7 @@ in EnumerateDefaultAllPossibleManifests())
271267

272268
if (!findAnyManifest)
273269
{
274-
throw new ToolManifestCannotBeFoundException(
275-
$@"{CliStrings.CannotFindAManifestFile}
276-
{string.Format(CliStrings.ListOfSearched, string.Join(Environment.NewLine, EnumerateDefaultAllPossibleManifests().Select(f => "\t" + f.manifestfile.Value)))}");
270+
throw new ToolManifestCannotBeFoundException(string.Format(CliStrings.CannotFindAManifestFile, string.Join(Environment.NewLine, EnumerateDefaultAllPossibleManifests().Select(f => "\t" + f.manifestfile.Value))));
277271
}
278272

279273
return result;

test/dotnet.Tests/CommandTests/Tool/Install/ToolInstallLocalCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public void GivenNoManifestFileItShouldThrowAndContainNoManifestGuide()
171171
.Contain(CliStrings.CannotFindAManifestFile);
172172

173173
a.Should().Throw<GracefulException>()
174-
.And.VerboseMessage.Should().Contain(string.Format(CliStrings.ListOfSearched, ""));
174+
.And.VerboseMessage.Should().Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
175175
}
176176

177177
[Fact]

test/dotnet.Tests/CommandTests/Tool/Uninstall/ToolUninstallLocalCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void GivenNoManifestFileItShouldThrow()
7272
.Contain(CliStrings.CannotFindAManifestFile);
7373

7474
a.Should().Throw<GracefulException>()
75-
.And.VerboseMessage.Should().Contain(string.Format(CliStrings.ListOfSearched, ""));
75+
.And.VerboseMessage.Should().Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
7676
}
7777

7878
[Fact]

test/dotnet.Tests/CommandTests/Tool/Update/ToolUpdateLocalCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public void GivenNoManifestFileItShouldThrow()
242242
.Contain(CliStrings.CannotFindAManifestFile);
243243

244244
a.Should().Throw<GracefulException>()
245-
.And.VerboseMessage.Should().Contain(string.Format(CliStrings.ListOfSearched, ""));
245+
.And.VerboseMessage.Should().Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
246246
}
247247

248248
[Fact]

test/dotnet.Tests/ToolManifestTests/ToolManifestFinderTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public void WhenCalledWithNonExistsFilePathItThrows()
257257
.Contain(CliStrings.CannotFindAManifestFile);
258258

259259
a.Should().Throw<ToolManifestCannotBeFoundException>().And.VerboseMessage.Should()
260-
.Contain(string.Format(CliStrings.ListOfSearched, ""))
260+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""))
261261
.And.Contain(
262262
Path.Combine(_testDirectoryRoot, "non-exists"),
263263
"the specificied manifest file name is in the 'searched list'");
@@ -277,7 +277,7 @@ public void GivenNoManifestFileItThrows()
277277
.Contain(CliStrings.CannotFindAManifestFile);
278278

279279
a.Should().Throw<ToolManifestCannotBeFoundException>().And.VerboseMessage.Should()
280-
.Contain(string.Format(CliStrings.ListOfSearched, ""));
280+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
281281
}
282282

283283
[Fact]
@@ -447,7 +447,7 @@ public void GivenNoManifestFileWhenFindContainPackageIdItThrows()
447447
.Contain(CliStrings.CannotFindAManifestFile);
448448

449449
a.Should().Throw<ToolManifestCannotBeFoundException>().And.VerboseMessage.Should()
450-
.Contain(string.Format(CliStrings.ListOfSearched, ""));
450+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
451451
}
452452

453453
[Fact]
@@ -743,7 +743,7 @@ public void GivenManifestFileOnSameDirectoryItThrowsWhenTheManifestFileCannotBeF
743743
.Contain(CliStrings.CannotFindAManifestFile);
744744

745745
a.Should().Throw<ToolManifestCannotBeFoundException>().And.VerboseMessage.Should()
746-
.Contain(string.Format(CliStrings.ListOfSearched, ""));
746+
.Contain(string.Format(CliStrings.CannotFindAManifestFile, ""));
747747
}
748748

749749
[Fact]

0 commit comments

Comments
 (0)