Merge pull request #2732 from dotnet/prkrishn/remove-cycles

Remove references to Microsoft.Extensions.Logging
This commit is contained in:
Pranav K 2016-04-29 10:40:24 -07:00
commit 944d4e543a
11 changed files with 97 additions and 155 deletions

View file

@ -12,15 +12,19 @@ namespace Microsoft.Extensions.Testing.Abstractions
public class SourceInformationProvider : ISourceInformationProvider
{
private readonly string _pdbPath;
private readonly ILogger _logger;
private readonly IPdbReader _pdbReader;
public SourceInformationProvider(string pdbPath, ILogger logger) :
this(pdbPath, logger, new PdbReaderFactory())
public SourceInformationProvider(string pdbPath) :
this(pdbPath, new PdbReaderFactory())
{
}
public SourceInformationProvider(string pdbPath, ILogger logger, IPdbReaderFactory pdbReaderFactory)
public SourceInformationProvider(string pdbPath, ILogger logger) :
this(pdbPath, new PdbReaderFactory())
{
}
public SourceInformationProvider(string pdbPath, IPdbReaderFactory pdbReaderFactory)
{
if (string.IsNullOrWhiteSpace(pdbPath) || !File.Exists(pdbPath))
{
@ -28,7 +32,6 @@ namespace Microsoft.Extensions.Testing.Abstractions
}
_pdbPath = pdbPath;
_logger = logger;
_pdbReader = pdbReaderFactory.Create(pdbPath);
}
@ -57,7 +60,7 @@ namespace Microsoft.Extensions.Testing.Abstractions
}
catch (Exception ex)
{
_logger?.LogWarning("Failed to access source information in symbol.", ex);
Console.WriteLine("Failed to access source information in symbol.", ex);
return null;
}
}

View file

@ -1,8 +1,6 @@
// 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 Microsoft.Extensions.Logging;
namespace Microsoft.Extensions.Testing.Abstractions
{
public abstract class TestHostServices
@ -12,7 +10,5 @@ namespace Microsoft.Extensions.Testing.Abstractions
public abstract ITestExecutionSink TestExecutionSink { get; }
public abstract ISourceInformationProvider SourceInformationProvider { get; }
public abstract ILoggerFactory LoggerFactory { get; }
}
}

View file

@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Net.Sockets;
using Microsoft.DotNet.ProjectModel.Server.Models;
using Microsoft.Extensions.Logging;
namespace Microsoft.DotNet.ProjectModel.Server
{
@ -18,13 +17,12 @@ namespace Microsoft.DotNet.ProjectModel.Server
string hostName,
ProtocolManager protocolManager,
WorkspaceContext workspaceContext,
IDictionary<int, ProjectManager> projects,
ILoggerFactory loggerFactory)
IDictionary<int, ProjectManager> projects)
{
_hostName = hostName;
_projects = projects;
_queue = new ProcessingQueue(new NetworkStream(acceptedSocket), loggerFactory);
_queue = new ProcessingQueue(new NetworkStream(acceptedSocket));
_queue.OnReceive += message =>
{
if (protocolManager.IsProtocolNegotiation(message))
@ -39,7 +37,6 @@ namespace Microsoft.DotNet.ProjectModel.Server
if (!_projects.TryGetValue(message.ContextId, out projectManager))
{
projectManager = new ProjectManager(message.ContextId,
loggerFactory,
workspaceContext,
protocolManager);

View file

@ -4,8 +4,8 @@
using System;
using System.IO;
using System.Threading;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel.Server.Models;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace Microsoft.DotNet.ProjectModel.Server
@ -14,20 +14,18 @@ namespace Microsoft.DotNet.ProjectModel.Server
{
private readonly BinaryReader _reader;
private readonly BinaryWriter _writer;
private readonly ILogger _log;
public ProcessingQueue(Stream stream, ILoggerFactory loggerFactory)
public ProcessingQueue(Stream stream)
{
_reader = new BinaryReader(stream);
_writer = new BinaryWriter(stream);
_log = loggerFactory.CreateLogger<ProcessingQueue>();
}
public event Action<Message> OnReceive;
public void Start()
{
_log.LogInformation("Start");
Reporter.Output.WriteLine("Start");
new Thread(ReceiveMessages).Start();
}
@ -43,11 +41,11 @@ namespace Microsoft.DotNet.ProjectModel.Server
catch (IOException ex)
{
// swallow
_log.LogInformation($"Ignore {nameof(IOException)} during sending message: \"{ex.Message}\".");
Reporter.Output.WriteLine($"Ignore {nameof(IOException)} during sending message: \"{ex.Message}\".");
}
catch (Exception ex)
{
_log.LogWarning($"Unexpected exception {ex.GetType().Name} during sending message: \"{ex.Message}\".");
Reporter.Output.WriteLine($"Unexpected exception {ex.GetType().Name} during sending message: \"{ex.Message}\".");
throw;
}
}
@ -59,7 +57,7 @@ namespace Microsoft.DotNet.ProjectModel.Server
{
return Send(_writer =>
{
_log.LogInformation("OnSend ({0})", message);
Reporter.Output.WriteLine($"OnSend ({message})");
_writer.Write(JsonConvert.SerializeObject(message));
});
}
@ -73,17 +71,17 @@ namespace Microsoft.DotNet.ProjectModel.Server
var content = _reader.ReadString();
var message = JsonConvert.DeserializeObject<Message>(content);
_log.LogInformation("OnReceive ({0})", message);
Reporter.Output.WriteLine($"OnReceive ({message})");
OnReceive(message);
}
}
catch (IOException ex)
{
_log.LogInformation($"Ignore {nameof(IOException)} during receiving messages: \"{ex}\".");
Reporter.Output.WriteLine($"Ignore {nameof(IOException)} during receiving messages: \"{ex}\".");
}
catch (Exception ex)
{
_log.LogError($"Unexpected exception {ex.GetType().Name} during receiving messages: \"{ex}\".");
Reporter.Error.WriteLine($"Unexpected exception {ex.GetType().Name} during receiving messages: \"{ex}\".");
}
}
}

View file

@ -7,7 +7,7 @@ using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.Extensions.Logging;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.ProjectModel.Server
{
@ -16,17 +16,15 @@ namespace Microsoft.DotNet.ProjectModel.Server
private readonly Dictionary<int, ProjectManager> _projects;
private readonly WorkspaceContext _workspaceContext;
private readonly ProtocolManager _protocolManager;
private readonly ILoggerFactory _loggerFactory;
private readonly string _hostName;
private readonly int _port;
private Socket _listenSocket;
public ProjectModelServerCommand(int port, string hostName, ILoggerFactory loggerFactory)
public ProjectModelServerCommand(int port, string hostName)
{
_port = port;
_hostName = hostName;
_loggerFactory = loggerFactory;
_protocolManager = new ProtocolManager(maxVersion: 4, loggerFactory: _loggerFactory);
_protocolManager = new ProtocolManager(maxVersion: 4);
_workspaceContext = WorkspaceContext.Create(designTime: true);
_projects = new Dictionary<int, ProjectManager>();
}
@ -47,19 +45,14 @@ namespace Microsoft.DotNet.ProjectModel.Server
app.OnExecute(() =>
{
var loggerFactory = new LoggerFactory();
loggerFactory.AddConsole(verbose.HasValue() ? LogLevel.Debug : LogLevel.Information);
var logger = loggerFactory.CreateLogger<ProjectModelServerCommand>();
try
{
if (!MonitorHostProcess(hostpid, logger))
if (!MonitorHostProcess(hostpid))
{
return 1;
}
var intPort = CheckPort(port, logger);
var intPort = CheckPort(port);
if (intPort == -1)
{
return 1;
@ -67,16 +60,16 @@ namespace Microsoft.DotNet.ProjectModel.Server
if (!hostname.HasValue())
{
logger.LogError($"Option \"{hostname.LongName}\" is missing.");
Reporter.Error.WriteLine($"Option \"{hostname.LongName}\" is missing.");
return 1;
}
var program = new ProjectModelServerCommand(intPort, hostname.Value(), loggerFactory);
var program = new ProjectModelServerCommand(intPort, hostname.Value());
program.OpenChannel();
}
catch (Exception ex)
{
logger.LogCritical($"Unhandled exception in server main: {ex}");
Reporter.Error.WriteLine($"Unhandled exception in server main: {ex}");
throw;
}
@ -88,26 +81,23 @@ namespace Microsoft.DotNet.ProjectModel.Server
public void OpenChannel()
{
var logger = _loggerFactory.CreateLogger($"OpenChannel");
_listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, _port));
_listenSocket.Listen(10);
logger.LogInformation($"Process ID {Process.GetCurrentProcess().Id}");
logger.LogInformation($"Listening on port {_port}");
Reporter.Output.WriteLine($"Process ID {Process.GetCurrentProcess().Id}");
Reporter.Output.WriteLine($"Listening on port {_port}");
while (true)
{
var acceptSocket = _listenSocket.Accept();
logger.LogInformation($"Client accepted {acceptSocket.LocalEndPoint}");
Reporter.Output.WriteLine($"Client accepted {acceptSocket.LocalEndPoint}");
var connection = new ConnectionContext(acceptSocket,
_hostName,
_protocolManager,
_workspaceContext,
_projects,
_loggerFactory);
_projects);
connection.QueueStart();
}
@ -121,11 +111,11 @@ namespace Microsoft.DotNet.ProjectModel.Server
}
}
private static int CheckPort(CommandOption port, ILogger logger)
private static int CheckPort(CommandOption port)
{
if (!port.HasValue())
{
logger.LogError($"Option \"{port.LongName}\" is missing.");
Reporter.Error.WriteLine($"Option \"{port.LongName}\" is missing.");
}
int result;
@ -135,16 +125,16 @@ namespace Microsoft.DotNet.ProjectModel.Server
}
else
{
logger.LogError($"Option \"{port.LongName}\" is not a valid Int32 value.");
Reporter.Error.WriteLine($"Option \"{port.LongName}\" is not a valid Int32 value.");
return -1;
}
}
private static bool MonitorHostProcess(CommandOption host, ILogger logger)
private static bool MonitorHostProcess(CommandOption host)
{
if (!host.HasValue())
{
logger.LogError($"Option \"{host.LongName}\" is missing.");
Console.Error.WriteLine($"Option \"{host.LongName}\" is missing.");
return false;
}
@ -158,12 +148,12 @@ namespace Microsoft.DotNet.ProjectModel.Server
Process.GetCurrentProcess().Kill();
};
logger.LogDebug($"Server will exit when process {hostPID} exits.");
Reporter.Output.WriteLine($"Server will exit when process {hostPID} exits.");
return true;
}
else
{
logger.LogError($"Option \"{host.LongName}\" is not a valid Int32 value.");
Reporter.Error.WriteLine($"Option \"{host.LongName}\" is not a valid Int32 value.");
return false;
}
}

View file

@ -6,18 +6,16 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel.Server.Helpers;
using Microsoft.DotNet.ProjectModel.Server.Messengers;
using Microsoft.DotNet.ProjectModel.Server.Models;
using Microsoft.Extensions.Logging;
using NuGet.Frameworks;
namespace Microsoft.DotNet.ProjectModel.Server
{
internal class ProjectManager
{
private readonly ILogger _log;
private readonly object _processingLock = new object();
private readonly Queue<Message> _inbox = new Queue<Message>();
private readonly ProtocolManager _protocolManager;
@ -42,13 +40,12 @@ namespace Microsoft.DotNet.ProjectModel.Server
private GlobalErrorMessenger _globalErrorMessenger;
private ProjectInformationMessenger _projectInforamtionMessenger;
public ProjectManager(int contextId,
ILoggerFactory loggerFactory,
WorkspaceContext workspaceContext,
ProtocolManager protocolManager)
public ProjectManager(
int contextId,
WorkspaceContext workspaceContext,
ProtocolManager protocolManager)
{
Id = contextId;
_log = loggerFactory.CreateLogger<ProjectManager>();
_workspaceContext = workspaceContext;
_protocolManager = protocolManager;
@ -122,7 +119,7 @@ namespace Microsoft.DotNet.ProjectModel.Server
}
catch (Exception ex)
{
_log.LogError("A unexpected exception occurred: {0}", ex.ToString());
Reporter.Error.WriteLine($"A unexpected exception occurred: {ex}");
var error = new ErrorMessage
{
@ -169,11 +166,11 @@ namespace Microsoft.DotNet.ProjectModel.Server
private void DrainInbox()
{
_log.LogInformation("Begin draining inbox.");
Reporter.Output.WriteLine("Begin draining inbox.");
while (ProcessMessage()) { }
_log.LogInformation("Finish draining inbox.");
Reporter.Output.WriteLine("Finish draining inbox.");
}
private bool ProcessMessage()
@ -191,7 +188,7 @@ namespace Microsoft.DotNet.ProjectModel.Server
Debug.Assert(message != null);
}
_log.LogInformation($"Received {message.MessageType}");
Reporter.Output.WriteLine($"Received {message.MessageType}");
switch (message.MessageType)
{
@ -218,7 +215,7 @@ namespace Microsoft.DotNet.ProjectModel.Server
{
if (_initializedContext != null)
{
_log.LogWarning($"Received {message.MessageType} message more than once for {_appPath.Value}");
Reporter.Output.WriteLine($"Received {message.MessageType} message more than once for {_appPath.Value}");
return;
}
@ -230,7 +227,7 @@ namespace Microsoft.DotNet.ProjectModel.Server
if (version != 0 && !_protocolManager.EnvironmentOverridden)
{
_contextProtocolVersion = Math.Min(version, _protocolManager.MaxVersion);
_log.LogInformation($"Set context protocol version to {_contextProtocolVersion.Value}");
Reporter.Output.WriteLine($"Set context protocol version to {_contextProtocolVersion.Value}");
}
}

View file

@ -2,9 +2,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel.Server.Models;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
namespace Microsoft.DotNet.ProjectModel.Server
{
@ -15,12 +14,9 @@ namespace Microsoft.DotNet.ProjectModel.Server
/// </summary>
public const string EnvDthProtocol = "DTH_PROTOCOL";
private readonly ILogger _log;
public ProtocolManager(int maxVersion, ILoggerFactory loggerFactory)
public ProtocolManager(int maxVersion)
{
MaxVersion = maxVersion;
_log = loggerFactory.CreateLogger<ProtocolManager>();
// initialized to the highest supported version or environment overridden value
int? protocol = GetProtocolVersionFromEnvironment();
@ -54,18 +50,18 @@ namespace Microsoft.DotNet.ProjectModel.Server
return;
}
_log.LogInformation("Initializing the protocol negotiation.");
Reporter.Output.WriteLine("Initializing the protocol negotiation.");
if (EnvironmentOverridden)
{
_log.LogInformation($"DTH protocol negotiation is override by environment variable {EnvDthProtocol} and set to {CurrentVersion}.");
Reporter.Output.WriteLine($"DTH protocol negotiation is override by environment variable {EnvDthProtocol} and set to {CurrentVersion}.");
return;
}
var tokenValue = message.Payload?["Version"];
if (tokenValue == null)
{
_log.LogInformation("Protocol negotiation failed. Version property is missing in payload.");
Reporter.Output.WriteLine("Protocol negotiation failed. Version property is missing in payload.");
return;
}
@ -73,16 +69,16 @@ namespace Microsoft.DotNet.ProjectModel.Server
if (preferredVersion == 0)
{
// the preferred version can't be zero. either property is missing or the the payload is corrupted.
_log.LogInformation("Protocol negotiation failed. Protocol version 0 is invalid.");
Reporter.Output.WriteLine("Protocol negotiation failed. Protocol version 0 is invalid.");
return;
}
CurrentVersion = Math.Min(preferredVersion, MaxVersion);
_log.LogInformation($"Protocol negotiation successed. Use protocol {CurrentVersion}");
Reporter.Output.WriteLine($"Protocol negotiation successed. Use protocol {CurrentVersion}");
if (message.Sender != null)
{
_log.LogInformation("Respond to protocol negotiation.");
Reporter.Output.WriteLine("Respond to protocol negotiation.");
message.Sender.Transmit(Message.FromPayload(
MessageTypes.ProtocolVersion,
0,
@ -90,7 +86,7 @@ namespace Microsoft.DotNet.ProjectModel.Server
}
else
{
_log.LogInformation($"{nameof(Message.Sender)} is null.");
Reporter.Output.WriteLine($"{nameof(Message.Sender)} is null.");
}
}

View file

@ -28,8 +28,6 @@
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
"Microsoft.DotNet.Compiler.Common": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": "1.0.0-*",
"Microsoft.Extensions.Logging": "1.0.0-rc2-20581",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-20581",
"Microsoft.Extensions.Testing.Abstractions": "1.0.0-*",
"Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-24027",
"Microsoft.NETCore.TestHost": "1.0.0-rc2-24027",

View file

@ -9,7 +9,6 @@ using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Xunit;
@ -21,7 +20,6 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
private readonly BinaryReader _reader;
private readonly BinaryWriter _writer;
private readonly NetworkStream _networkStream;
private readonly ILogger _logger;
private readonly BlockingCollection<DthMessage> _messageQueue;
private readonly CancellationTokenSource _readCancellationToken;
@ -32,13 +30,11 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
private int _nextContextId;
private readonly Socket _socket;
public DthTestClient(DthTestServer server, ILoggerFactory loggerFactory)
public DthTestClient(DthTestServer server)
{
// Avoid Socket exception 10006 on Linux
Thread.Sleep(100);
_logger = loggerFactory.CreateLogger<DthTestClient>();
_socket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
@ -238,7 +234,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
// Swallow this error for now.
// This is a temporary fix for a random failure on CI. The issue happens on Windowx x86
// only.
_logger.LogError($"Exception thrown durning socket shutting down: {ex.SocketErrorCode}.");
Console.Error.WriteLine($"Exception thrown durning socket shutting down: {ex.SocketErrorCode}.");
}
}

View file

@ -5,8 +5,6 @@ using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.DotNet.ProjectModel.Server;
using Microsoft.Extensions.Logging;
namespace Microsoft.DotNet.ProjectModel.Server.Tests
{
@ -15,14 +13,12 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
private readonly ProjectModelServerCommand _program;
private readonly Thread _thread;
public DthTestServer(ILoggerFactory loggerFactory)
public DthTestServer()
{
LoggerFactory = loggerFactory;
Port = FindFreePort();
HostId = Guid.NewGuid().ToString();
_program = new ProjectModelServerCommand(Port, HostId, LoggerFactory);
_program = new ProjectModelServerCommand(Port, HostId);
_thread = new Thread(() => { _program.OpenChannel(); }) { IsBackground = true };
_thread.Start();
@ -32,8 +28,6 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
public int Port { get; }
public ILoggerFactory LoggerFactory { get; }
public void Dispose()
{
try

View file

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
@ -11,7 +10,6 @@ using System.Threading.Tasks;
using Microsoft.DotNet.ProjectModel.Graph;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.PlatformAbstractions;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@ -22,30 +20,9 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
public class DthTests : TestBase
{
private readonly TestAssetsManager _testAssetsManager;
private readonly ILoggerFactory _loggerFactory;
public DthTests()
{
_loggerFactory = new LoggerFactory();
var testVerbose = Environment.GetEnvironmentVariable("DOTNET_TEST_VERBOSE");
if (testVerbose == "2")
{
_loggerFactory.AddConsole(LogLevel.Trace);
}
else if (testVerbose == "1")
{
_loggerFactory.AddConsole(LogLevel.Information);
}
else if (testVerbose == "0")
{
_loggerFactory.AddConsole(LogLevel.Warning);
}
else
{
_loggerFactory.AddConsole(LogLevel.Error);
}
_testAssetsManager = new TestAssetsManager(
Path.Combine(RepoRoot, "TestAssets", "ProjectModelServer", "DthTestProjects", "src"));
}
@ -56,8 +33,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
var projectPath = Path.Combine(_testAssetsManager.AssetsRoot, "EmptyConsoleApp");
Assert.NotNull(projectPath);
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(projectPath);
@ -86,8 +63,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
var projectPath = Path.Combine(_testAssetsManager.AssetsRoot, "EmptyConsoleApp");
Assert.NotNull(projectPath);
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(projectPath);
var messages = client.DrainAllMessages()
@ -123,8 +100,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
[InlineData(3, 3)]
public void DthStartup_ProtocolNegotiation(int requestVersion, int expectVersion)
{
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.SetProtocolVersion(requestVersion);
@ -138,8 +115,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
[Fact]
public void DthStartup_ProtocolNegotiation_ZeroIsNoAllowed()
{
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.SetProtocolVersion(0);
@ -168,8 +145,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
var projectPath = Path.Combine(_testAssetsManager.AssetsRoot, testProjectName);
Assert.NotNull(projectPath);
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(projectPath);
@ -221,8 +198,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
[Fact]
public void DthNegative_BrokenProjectPathInLockFile()
{
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
// After restore the project is copied to another place so that
// the relative path in project lock file is invalid.
@ -255,8 +232,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
var projectPath = assets.CreateTestInstance("DthUpdateSearchPathSample").WithLockFiles().TestRoot;
Assert.True(Directory.Exists(projectPath));
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
var testProject = Path.Combine(projectPath, "home", "src", "MainProject");
@ -312,8 +289,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
{
var projectPath = _testAssetsManager.CreateTestInstance("EmptyConsoleApp").TestRoot;
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(projectPath);
var messages = client.DrainAllMessages();
@ -338,8 +315,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
var assetsManager = new TestAssetsManager(testAssetsPath);
var testSource = assetsManager.CreateTestInstance("IncorrectProjectJson").TestRoot;
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(Path.Combine(_testAssetsManager.AssetsRoot, "EmptyLibrary"));
client.Initialize(testSource);
@ -371,8 +348,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
var assetsManager = new TestAssetsManager(testAssetsPath);
var testSource = assetsManager.CreateTestInstance("IncorrectGlobalJson");
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(Path.Combine(testSource.TestRoot, "src", "Project1"));
@ -390,8 +367,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
.WithLockFiles()
.TestRoot;
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
var projectFile = Path.Combine(testProject, Project.FileName);
var content = File.ReadAllText(projectFile);
@ -417,8 +394,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
.WithLockFiles()
.TestRoot;
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
var lockFilePath = Path.Combine(testProject, LockFile.FileName);
var lockFileContent = File.ReadAllText(lockFilePath);
@ -469,8 +446,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
File.WriteAllText(projectFilePath, JsonConvert.SerializeObject(projectJson));
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(projectPath);
var messages = client.DrainAllMessages();
@ -495,8 +472,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
"src",
"MainApp");
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(testProject);
var messages = client.DrainAllMessages();
@ -550,8 +527,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
.WithLockFiles()
.TestRoot;
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(projectPath);
@ -596,8 +573,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
var projectPath = tam.CreateTestInstance("ValidCase01").WithLockFiles().TestRoot;
projectPath = Path.Combine(projectPath, "src", "MainApp");
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(projectPath);
@ -638,8 +615,8 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
{
var projectPath = Path.Combine(RepoRoot, "TestAssets", "ProjectModelServer", "MscorlibLibraryDuplication");
using (var server = new DthTestServer(_loggerFactory))
using (var client = new DthTestClient(server, _loggerFactory))
using (var server = new DthTestServer())
using (var client = new DthTestClient(server))
{
client.Initialize(projectPath);