Merge branch 'troy/1569' into rel/1.0.0
This commit is contained in:
commit
b63705198c
12 changed files with 113 additions and 13 deletions
|
@ -3,7 +3,7 @@
|
|||
"frameworks": {
|
||||
"dnxcore50": {
|
||||
"dependencies":{
|
||||
"System.Runtime": "4.0.21-beta-*",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"System.Console": "4.0.0-beta-*"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"frameworks": {
|
||||
"dnxcore50": {
|
||||
"dependencies":{
|
||||
"System.Runtime": "4.0.21-*"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"frameworks": {
|
||||
"dnxcore50": {
|
||||
"dependencies": {
|
||||
"System.Runtime": "4.0.21-*"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"projects": ["src"]]
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
|
||||
<clear />
|
||||
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
|
||||
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
12
TestAssets/ProjectModelServer/IncorrectGlobalJson/src/Project1/Program.cs
Executable file
12
TestAssets/ProjectModelServer/IncorrectGlobalJson/src/Project1/Program.cs
Executable file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace ConsoleApplication
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
}
|
||||
}
|
14
TestAssets/ProjectModelServer/IncorrectGlobalJson/src/Project1/project.json
Executable file
14
TestAssets/ProjectModelServer/IncorrectGlobalJson/src/Project1/project.json
Executable file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"
|
||||
},
|
||||
"frameworks": {
|
||||
[]
|
||||
}
|
||||
}
|
|
@ -74,14 +74,18 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
CleanNuGetTempCache();
|
||||
|
||||
var dotnet = DotNetCli.Stage2;
|
||||
|
||||
dotnet.Restore("--fallbacksource", Dirs.TestPackages)
|
||||
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestProjects"))
|
||||
.Execute().EnsureSuccessful();
|
||||
|
||||
|
||||
// The 'ProjectModelServer' directory contains intentionally-unresolved dependencies, so don't check for success. Also, suppress the output
|
||||
dotnet.Restore().WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectModelServer"))
|
||||
.CaptureStdErr()
|
||||
.CaptureStdOut()
|
||||
dotnet.Restore()
|
||||
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectModelServer", "DthTestProjects"))
|
||||
.Execute();
|
||||
|
||||
dotnet.Restore()
|
||||
.WorkingDirectory(Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "ProjectModelServer", "DthUpdateSearchPathSample"))
|
||||
.Execute();
|
||||
|
||||
return c.Success();
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
public int Column { get; private set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
{
|
||||
return $"{Path}({Line},{Column}): Error: {base.ToString()}";
|
||||
}
|
||||
|
||||
|
|
|
@ -122,10 +122,8 @@ namespace Microsoft.DotNet.ProjectModel.Server
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// TODO: review error handing logic
|
||||
|
||||
_log.LogError($"Error occurred: {ex}");
|
||||
|
||||
_log.LogError("A unexpected exception occurred: {0}", ex.ToString());
|
||||
|
||||
var error = new ErrorMessage
|
||||
{
|
||||
Message = ex.Message
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
@ -286,5 +285,57 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvalidProjectJson()
|
||||
{
|
||||
var testAssetsPath = Path.Combine(RepoRoot, "TestAssets", "ProjectModelServer");
|
||||
var assetsManager = new TestAssetsManager(testAssetsPath);
|
||||
var testSource = assetsManager.CreateTestInstance("IncorrectProjectJson").TestRoot;
|
||||
|
||||
using (var server = new DthTestServer(_loggerFactory))
|
||||
using (var client = new DthTestClient(server))
|
||||
{
|
||||
client.Initialize(Path.Combine(_testAssetsManager.AssetsRoot, "EmptyLibrary"));
|
||||
client.Initialize(testSource);
|
||||
|
||||
// Error for invalid project.json
|
||||
var messages = client.DrainAllMessages();
|
||||
messages.Single(msg => msg.MessageType == MessageTypes.Error)
|
||||
.Payload.AsJObject()
|
||||
.AssertProperty<string>("Path", v => v.Contains("IncorrectProjectJson"));
|
||||
|
||||
// Successfully initialize the other project
|
||||
messages.Single(msg => msg.MessageType == MessageTypes.ProjectInformation)
|
||||
.Payload.AsJObject()
|
||||
.AssertProperty<string>("Name", v => string.Equals(v, "EmptyLibrary", StringComparison.Ordinal));
|
||||
|
||||
// Successfully initialize another project afterwards
|
||||
client.Initialize(Path.Combine(_testAssetsManager.AssetsRoot, "EmptyConsoleApp"));
|
||||
messages = client.DrainAllMessages();
|
||||
messages.Single(msg => msg.MessageType == MessageTypes.ProjectInformation)
|
||||
.Payload.AsJObject()
|
||||
.AssertProperty<string>("Name", v => string.Equals(v, "EmptyConsoleApp", StringComparison.Ordinal));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvalidGlobalJson()
|
||||
{
|
||||
var testAssetsPath = Path.Combine(RepoRoot, "TestAssets", "ProjectModelServer");
|
||||
var assetsManager = new TestAssetsManager(testAssetsPath);
|
||||
var testSource = assetsManager.CreateTestInstance("IncorrectGlobalJson");
|
||||
|
||||
using (var server = new DthTestServer(_loggerFactory))
|
||||
using (var client = new DthTestClient(server))
|
||||
{
|
||||
client.Initialize(Path.Combine(testSource.TestRoot, "src", "Project1"));
|
||||
|
||||
var messages = client.DrainAllMessages();
|
||||
messages.ContainsMessage(MessageTypes.Error)
|
||||
.Single().Payload.AsJObject()
|
||||
.AssertProperty<string>("Path", v => v.Contains("InvalidGlobalJson"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue