diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DefaultAnalyzerAssemblyLoader.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DefaultAnalyzerAssemblyLoader.cs index 7e3a95ce87050..b14db7e2e45b7 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DefaultAnalyzerAssemblyLoader.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DefaultAnalyzerAssemblyLoader.cs @@ -16,23 +16,17 @@ namespace Microsoft.CodeAnalysis { internal sealed class DefaultAnalyzerAssemblyLoader : AnalyzerAssemblyLoader { -#if NETCOREAPP - internal DefaultAnalyzerAssemblyLoader() { } +#if NETCOREAPP + internal DefaultAnalyzerAssemblyLoader(System.Runtime.Loader.AssemblyLoadContext? compilerLoadContext = null, AnalyzerLoadOption loadOption = AnalyzerLoadOption.LoadFromDisk) : base(compilerLoadContext, loadOption) { } -#else - - internal DefaultAnalyzerAssemblyLoader() - { - } - #endif /// @@ -51,32 +45,21 @@ internal DefaultAnalyzerAssemblyLoader() internal static IAnalyzerAssemblyLoader CreateNonLockingLoader(string windowsShadowPath) { #if NETCOREAPP - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - // The cost of doing stream based loading on Windows is too expensive and we must continue to - // use the shadow copy loader. - return createShadowLoaderWindows(); - } - else + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return new DefaultAnalyzerAssemblyLoader(loadOption: AnalyzerLoadOption.LoadFromStream); } -#else - return createShadowLoaderWindows(); #endif - ShadowCopyAnalyzerAssemblyLoader createShadowLoaderWindows() + // The shadow copy analyzer should only be created on Windows. To create on Linux we cannot use + // GetTempPath as it's not per-user. Generally there is no need as LoadFromStream achieves the same + // effect + if (!Path.IsPathRooted(windowsShadowPath)) { - // The shadow copy analyzer should only be created on Windows. To create on Linux we cannot use - // GetTempPath as it's not per-user. Generally there is no need as LoadFromStream achieves the same - // effect - if (!Path.IsPathRooted(windowsShadowPath)) - { - throw new ArgumentException("Must be a full path.", nameof(windowsShadowPath)); - } - - return new ShadowCopyAnalyzerAssemblyLoader(windowsShadowPath); + throw new ArgumentException("Must be a full path.", nameof(windowsShadowPath)); } + + return new ShadowCopyAnalyzerAssemblyLoader(windowsShadowPath); } } } diff --git a/src/Workspaces/Remote/ServiceHub/Host/RemoteAnalyzerAssemblyLoader.cs b/src/Workspaces/Remote/ServiceHub/Host/RemoteAnalyzerAssemblyLoader.cs index 3046e9f3fa886..1fc17bbbefd05 100644 --- a/src/Workspaces/Remote/ServiceHub/Host/RemoteAnalyzerAssemblyLoader.cs +++ b/src/Workspaces/Remote/ServiceHub/Host/RemoteAnalyzerAssemblyLoader.cs @@ -18,7 +18,6 @@ internal sealed class RemoteAnalyzerAssemblyLoader : AnalyzerAssemblyLoader public RemoteAnalyzerAssemblyLoader(string baseDirectory) { - // jason should we load from stream here on Linux or is this VS only? _baseDirectory = baseDirectory; }