dotnet crashes with an unresolved 'platform' dependency.
Fixed by calling TryGetValue instead of a dictionary indexer when looking up platform dependencies in ProjectContextBuilder. Fix #2693
This commit is contained in:
parent
6482aa0221
commit
17175864cf
5 changed files with 66 additions and 1 deletions
36
test/dotnet.Tests/GivenThatDotNetRunsCommands.cs
Normal file
36
test/dotnet.Tests/GivenThatDotNetRunsCommands.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Tests
|
||||
{
|
||||
public class GivenThatDotNetRunsCommands : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void UnresolvedPlatformReferencesFailAsExpected()
|
||||
{
|
||||
var testAssetsManager = GetTestGroupTestAssetsManager("NonRestoredTestProjects");
|
||||
var testInstance = testAssetsManager.CreateTestInstance("TestProjectWithUnresolvedPlatformDependency");
|
||||
|
||||
new RestoreCommand()
|
||||
.WithWorkingDirectory(testInstance.TestRoot)
|
||||
.Execute()
|
||||
.Should()
|
||||
.Fail();
|
||||
new DirectoryInfo(testInstance.TestRoot)
|
||||
.Should()
|
||||
.HaveFile("project.lock.json");
|
||||
|
||||
new DotnetCommand()
|
||||
.ExecuteWithCapturedOutput("crash")
|
||||
.Should()
|
||||
.Fail()
|
||||
.And
|
||||
.HaveStdErrContaining("No executable found matching command \"dotnet-crash\"");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue