diff --git a/src/Compilers/Extension/CompilerExtension.csproj b/src/Compilers/Extension/CompilerExtension.csproj index 4537bab2ffe882206dea4cebe55768122b915eb3..8f869e1a9c71821a545447be72841dd94c2d37bf 100644 --- a/src/Compilers/Extension/CompilerExtension.csproj +++ b/src/Compilers/Extension/CompilerExtension.csproj @@ -102,6 +102,7 @@ BuiltProjectOutputGroup DebugSymbolsProjectOutputGroup%3b true + TargetFramework=net46 diff --git a/src/Compilers/Server/VBCSCompiler/CoreClrCompilerServerHost.cs b/src/Compilers/Server/VBCSCompiler/CoreClrCompilerServerHost.cs new file mode 100644 index 0000000000000000000000000000000000000000..af47e77814b5ae546d6ffc6bbb16c533770b97fe --- /dev/null +++ b/src/Compilers/Server/VBCSCompiler/CoreClrCompilerServerHost.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +#if NETCOREAPP2_0 + +using System; +using System.Collections.Immutable; + +namespace Microsoft.CodeAnalysis.CompilerServer +{ + internal sealed class CoreClrCompilerServerHost : CompilerServerHost + { + private static readonly IAnalyzerAssemblyLoader s_analyzerLoader = new CoreClrAnalyzerAssemblyLoader(); + + // Caches are used by C# and VB compilers, and shared here. + public static readonly Func SharedAssemblyReferenceProvider = (path, properties) => new CachingMetadataReference(path, properties); + + public override IAnalyzerAssemblyLoader AnalyzerAssemblyLoader => s_analyzerLoader; + + public override Func AssemblyReferenceProvider => SharedAssemblyReferenceProvider; + + internal CoreClrCompilerServerHost(string clientDirectory, string sdkDirectory) + : base(clientDirectory, sdkDirectory) + { + } + + public override bool CheckAnalyzers(string baseDirectory, ImmutableArray analyzers) + { + return AnalyzerConsistencyChecker.Check(baseDirectory, analyzers, s_analyzerLoader); + } + } +} + +#endif diff --git a/src/Compilers/Server/VBCSCompiler/DesktopBuildServerController.cs b/src/Compilers/Server/VBCSCompiler/DesktopBuildServerController.cs index 0e5c32c19a138eac8add8e798259a7492ed81672..8145a77d7bdc904f2b8ac70126b89c8fc0004bfa 100644 --- a/src/Compilers/Server/VBCSCompiler/DesktopBuildServerController.cs +++ b/src/Compilers/Server/VBCSCompiler/DesktopBuildServerController.cs @@ -40,23 +40,31 @@ protected override IClientConnectionHost CreateClientConnectionHost(string pipeN protected internal override TimeSpan? GetKeepAliveTimeout() { - int keepAliveValue; - string keepAliveStr = _appSettings[KeepAliveSettingName]; - if (int.TryParse(keepAliveStr, NumberStyles.Integer, CultureInfo.InvariantCulture, out keepAliveValue) && - keepAliveValue >= 0) + try { - if (keepAliveValue == 0) + int keepAliveValue; + string keepAliveStr = _appSettings[KeepAliveSettingName]; + if (int.TryParse(keepAliveStr, NumberStyles.Integer, CultureInfo.InvariantCulture, out keepAliveValue) && + keepAliveValue >= 0) { - // This is a one time server entry. - return null; + if (keepAliveValue == 0) + { + // This is a one time server entry. + return null; + } + else + { + return TimeSpan.FromSeconds(keepAliveValue); + } } else { - return TimeSpan.FromSeconds(keepAliveValue); + return ServerDispatcher.DefaultServerKeepAlive; } } - else + catch (Exception e) { + CompilerServerLogger.LogException(e, "Could not read AppSettings"); return ServerDispatcher.DefaultServerKeepAlive; } }