提交 b0f234d1 编写于 作者: T Tomas Matousek

Remove dependencies on MEF v1

上级 2a89517d
......@@ -397,12 +397,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VS.Tools.Roslyn.Package", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Package", "src\NuGet\Microsoft.CodeAnalysis.Package.csproj", "{B9843F65-262E-4F40-A0BC-2CBEF7563A44}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PortableFacades.Setup", "src\Setup\DevDivVsix\PortableFacades\PortableFacades.Setup.csproj", "{952808C5-799A-4CAA-964C-2AA78458CEC7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Compilers.Setup", "src\Setup\DevDivVsix\CompilersPackage\Microsoft.CodeAnalysis.Compilers.Setup.csproj", "{03607817-6800-40B6-BEAA-D6F437CD62B7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-format", "src\Tools\dotnet-format\dotnet-format.csproj", "{4A9B5423-11BF-4E1D-B231-C9A2FDD78EC4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Workspaces.Desktop.UnitTests", "src\Workspaces\DesktopTest\Microsoft.CodeAnalysis.Workspaces.Desktop.UnitTests.csproj", "{23405307-7EFF-4774-8B11-8F5885439761}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{2523d0e6-df32-4a3e-8ae0-a19bffae2ef6}*SharedItemsImports = 4
......@@ -1056,10 +1056,6 @@ Global
{B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|Any CPU.Build.0 = Release|Any CPU
{952808C5-799A-4CAA-964C-2AA78458CEC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{952808C5-799A-4CAA-964C-2AA78458CEC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{952808C5-799A-4CAA-964C-2AA78458CEC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{952808C5-799A-4CAA-964C-2AA78458CEC7}.Release|Any CPU.Build.0 = Release|Any CPU
{03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03607817-6800-40B6-BEAA-D6F437CD62B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
......@@ -1068,6 +1064,10 @@ Global
{4A9B5423-11BF-4E1D-B231-C9A2FDD78EC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A9B5423-11BF-4E1D-B231-C9A2FDD78EC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A9B5423-11BF-4E1D-B231-C9A2FDD78EC4}.Release|Any CPU.Build.0 = Release|Any CPU
{23405307-7EFF-4774-8B11-8F5885439761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23405307-7EFF-4774-8B11-8F5885439761}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23405307-7EFF-4774-8B11-8F5885439761}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23405307-7EFF-4774-8B11-8F5885439761}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -1254,9 +1254,9 @@ Global
{0EB22BD1-B8B1-417D-8276-F475C2E190FF} = {BE25E872-1667-4649-9D19-96B83E75A44E}
{3636D3E2-E3EF-4815-B020-819F382204CD} = {BE25E872-1667-4649-9D19-96B83E75A44E}
{B9843F65-262E-4F40-A0BC-2CBEF7563A44} = {C52D8057-43AF-40E6-A01B-6CDBB7301985}
{952808C5-799A-4CAA-964C-2AA78458CEC7} = {BE25E872-1667-4649-9D19-96B83E75A44E}
{03607817-6800-40B6-BEAA-D6F437CD62B7} = {BE25E872-1667-4649-9D19-96B83E75A44E}
{4A9B5423-11BF-4E1D-B231-C9A2FDD78EC4} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{23405307-7EFF-4774-8B11-8F5885439761} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {604E6B91-7BC0-4126-AE07-D4D2FEFC3D29}
......
......@@ -10,6 +10,7 @@
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.VisualBasic.Syntax;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServices;
using Roslyn.Test.Utilities;
using Xunit;
......@@ -71,7 +72,7 @@ private static SyntaxNode WrapExpressionInBoilerplate(SyntaxNode expression, Syn
Assert.True(cs != null || csSimple != null || vb != null || vbSimple != null,
$"At least one of {nameof(cs)}, {nameof(csSimple)}, {nameof(vb)}, {nameof(vbSimple)} must be provided");
var hostServices = MefV1HostServices.Create(TestExportProvider.ExportProviderWithCSharpAndVisualBasic.AsExportProvider());
var hostServices = VisualStudioMefHostServices.Create(TestExportProvider.ExportProviderWithCSharpAndVisualBasic);
var workspace = new AdhocWorkspace(hostServices);
if (cs != null || csSimple != null)
......
......@@ -16,6 +16,7 @@
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServices;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
......@@ -184,7 +185,7 @@ public async Task TestOpenFileOnlyAnalyzerDiagnostics()
[Fact]
public async Task TestSynchronizeWithBuild()
{
var workspace = new AdhocWorkspace(MefV1HostServices.Create(TestExportProvider.ExportProviderWithCSharpAndVisualBasic.AsExportProvider()));
var workspace = new AdhocWorkspace(VisualStudioMefHostServices.Create(TestExportProvider.ExportProviderWithCSharpAndVisualBasic));
var language = Workspaces.NoCompilationConstants.LanguageName;
......@@ -249,7 +250,7 @@ public async Task TestSynchronizeWithBuild()
[Fact]
public void TestHostAnalyzerOrdering()
{
var workspace = new AdhocWorkspace(MefV1HostServices.Create(TestExportProvider.ExportProviderWithCSharpAndVisualBasic.AsExportProvider()));
var workspace = new AdhocWorkspace(VisualStudioMefHostServices.Create(TestExportProvider.ExportProviderWithCSharpAndVisualBasic));
var project = workspace.AddProject(
ProjectInfo.Create(
......
......@@ -21,6 +21,7 @@
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServices;
using Microsoft.VisualStudio.Text.Tagging;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
......@@ -132,7 +133,7 @@ public void TestPreviewOpenCloseFile()
[Fact, Trait(Traits.Editor, Traits.Editors.Preview)]
public void TestPreviewServices()
{
using (var previewWorkspace = new PreviewWorkspace(MefV1HostServices.Create(EditorServicesUtil.ExportProvider.AsExportProvider())))
using (var previewWorkspace = new PreviewWorkspace(VisualStudioMefHostServices.Create(EditorServicesUtil.ExportProvider)))
{
var service = previewWorkspace.Services.GetService<ISolutionCrawlerRegistrationService>();
Assert.True(service is PreviewSolutionCrawlerRegistrationServiceFactory.Service);
......@@ -154,7 +155,7 @@ public void TestPreviewDiagnostic()
var taskSource = new TaskCompletionSource<DiagnosticsUpdatedArgs>();
diagnosticService.DiagnosticsUpdated += (s, a) => taskSource.TrySetResult(a);
using (var previewWorkspace = new PreviewWorkspace(MefV1HostServices.Create(EditorServicesUtil.ExportProvider.AsExportProvider())))
using (var previewWorkspace = new PreviewWorkspace(VisualStudioMefHostServices.Create(EditorServicesUtil.ExportProvider)))
{
var solution = previewWorkspace.CurrentSolution
.AddProject("project", "project.dll", LanguageNames.CSharp)
......
......@@ -19,6 +19,7 @@
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServices;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Projection;
using Microsoft.VisualStudio.Threading;
......@@ -49,7 +50,7 @@ public TestWorkspace()
}
public TestWorkspace(ExportProvider exportProvider, string workspaceKind = null, bool disablePartialSolutions = true)
: base(MefV1HostServices.Create(exportProvider.AsExportProvider()), workspaceKind ?? WorkspaceKind.Test)
: base(VisualStudioMefHostServices.Create(exportProvider), workspaceKind ?? WorkspaceKind.Test)
{
this.TestHookPartialSolutionsDisabled = disablePartialSolutions;
this.ExportProvider = exportProvider;
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Composition;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices
{
/// <summary>
/// Provides host services imported via VS MEF.
/// </summary>
internal sealed class VisualStudioMefHostServices : HostServices, IMefHostExportProvider
{
// the export provider for the MEF composition
private readonly ExportProvider _exportProvider;
// accumulated cache for exports
private ImmutableDictionary<ExportKey, IEnumerable> _exportsMap
= ImmutableDictionary<ExportKey, IEnumerable>.Empty;
private VisualStudioMefHostServices(ExportProvider exportProvider)
{
Contract.ThrowIfNull(exportProvider);
_exportProvider = exportProvider;
}
public static VisualStudioMefHostServices Create(ExportProvider exportProvider)
=> new VisualStudioMefHostServices(exportProvider);
/// <summary>
/// Creates a new <see cref="HostWorkspaceServices"/> associated with the specified workspace.
/// </summary>
protected internal override HostWorkspaceServices CreateWorkspaceServices(Workspace workspace)
=> new MefWorkspaceServices(this, workspace);
/// <summary>
/// Gets all the MEF exports of the specified type with the specified metadata.
/// </summary>
public IEnumerable<Lazy<TExtension, TMetadata>> GetExports<TExtension, TMetadata>()
{
var key = new ExportKey(typeof(TExtension).AssemblyQualifiedName, typeof(TMetadata).AssemblyQualifiedName);
if (!_exportsMap.TryGetValue(key, out var exports))
{
exports = ImmutableInterlocked.GetOrAdd(ref _exportsMap, key, _ =>
{
return _exportProvider.GetExports<TExtension, TMetadata>().ToImmutableArray();
});
}
return (IEnumerable<Lazy<TExtension, TMetadata>>)exports;
}
/// <summary>
/// Gets all the MEF exports of the specified type.
/// </summary>
public IEnumerable<Lazy<TExtension>> GetExports<TExtension>()
{
var key = new ExportKey(typeof(TExtension).AssemblyQualifiedName, "");
if (!_exportsMap.TryGetValue(key, out var exports))
{
exports = ImmutableInterlocked.GetOrAdd(ref _exportsMap, key, _ =>
_exportProvider.GetExports<TExtension>().ToImmutableArray());
}
return (IEnumerable<Lazy<TExtension>>)exports;
}
private struct ExportKey : IEquatable<ExportKey>
{
internal readonly string ExtensionTypeName;
internal readonly string MetadataTypeName;
private readonly int _hash;
public ExportKey(string extensionTypeName, string metadataTypeName)
{
ExtensionTypeName = extensionTypeName;
MetadataTypeName = metadataTypeName;
_hash = Hash.Combine(metadataTypeName.GetHashCode(), extensionTypeName.GetHashCode());
}
public bool Equals(ExportKey other)
=> string.Compare(ExtensionTypeName, other.ExtensionTypeName, StringComparison.OrdinalIgnoreCase) == 0 &&
string.Compare(MetadataTypeName, other.MetadataTypeName, StringComparison.OrdinalIgnoreCase) == 0;
public override bool Equals(object obj)
=> obj is ExportKey key && Equals(key);
public override int GetHashCode()
=> Hash.Combine(MetadataTypeName.GetHashCode(), ExtensionTypeName.GetHashCode());
}
}
}
......@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.Composition.Hosting;
using System.IO;
using System.Linq;
using System.Text;
......@@ -18,6 +17,7 @@
using Microsoft.CodeAnalysis.SolutionCrawler;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.Extensions;
using Microsoft.VisualStudio.LanguageServices.Implementation.Venus;
......@@ -75,7 +75,7 @@ internal abstract partial class VisualStudioWorkspaceImpl : VisualStudioWorkspac
internal FileChangeWatcher FileChangeWatcher { get; }
public VisualStudioWorkspaceImpl(ExportProvider exportProvider, IAsyncServiceProvider asyncServiceProvider)
: base(MefV1HostServices.Create(exportProvider))
: base(VisualStudioMefHostServices.Create(exportProvider))
{
_threadingContext = exportProvider.GetExportedValue<IThreadingContext>();
_textBufferCloneService = exportProvider.GetExportedValue<ITextBufferCloneService>();
......
......@@ -178,6 +178,7 @@
<PackageReference Include="Microsoft.VisualStudio.CallHierarchy.Package.Definitions" Version="$(MicrosoftVisualStudioCallHierarchyPackageDefinitionsVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Language.CallHierarchy" Version="$(MicrosoftVisualStudioLanguageCallHierarchyVersion)" />
<PackageReference Include="Microsoft.VisualStudio.ComponentModelHost" Version="$(MicrosoftVisualStudioComponentModelHostVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="$(MicrosoftVisualStudioCompositionVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Diagnostics.PerformanceProvider" Version="$(MicrosoftVisualStudioDiagnosticsPerformanceProviderVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Design" Version="$(MicrosoftVisualStudioShellDesignVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Language.NavigateTo.Interfaces" Version="$(MicrosoftVisualStudioLanguageNavigateToInterfacesVersion)" />
......
......@@ -18,6 +18,7 @@
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
......@@ -127,9 +128,9 @@ private set
public void UpdatePreview(string text)
{
var service = MefV1HostServices.Create(_componentModel.DefaultExportProvider);
var service = VisualStudioMefHostServices.Create(_componentModel.GetService<ExportProvider>());
var workspace = new PreviewWorkspace(service);
var fileName = string.Format("project.{0}", Language == "C#" ? "csproj" : "vbproj");
var fileName = "project." + (Language == "C#" ? "csproj" : "vbproj");
var project = workspace.CurrentSolution.AddProject(fileName, "assembly.dll", Language);
// use the mscorlib, system, and system.core that are loaded in the current process.
......
......@@ -35,7 +35,7 @@ internal class RoslynVisualStudioWorkspace : VisualStudioWorkspaceImpl
ExportProvider exportProvider,
[ImportMany] IEnumerable<Lazy<IStreamingFindUsagesPresenter>> streamingPresenters,
[ImportMany] IEnumerable<IDocumentOptionsProviderFactory> documentOptionsProviderFactories)
: base(exportProvider.AsExportProvider(), AsyncServiceProvider.GlobalProvider) // TODO: switch to the cleaner MEF import
: base(exportProvider, AsyncServiceProvider.GlobalProvider) // TODO: switch to the cleaner MEF import
{
_streamingPresenters = streamingPresenters;
......
......@@ -2,9 +2,9 @@
using Microsoft.CodeAnalysis.Editor.UnitTests;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServices;
namespace Roslyn.VisualStudio.Next.UnitTests.Mocks
{
......@@ -12,8 +12,7 @@ public static class TestHostServices
{
public static HostServices CreateHostServices(ExportProvider exportProvider = null)
{
exportProvider = exportProvider ?? CreateMinimalExportProvider();
return MefV1HostServices.Create(exportProvider.AsExportProvider());
return VisualStudioMefHostServices.Create(exportProvider ?? CreateMinimalExportProvider());
}
public static ExportProvider CreateMinimalExportProvider()
......
......@@ -23,9 +23,6 @@
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\Workspaces\Core\Desktop\Microsoft.CodeAnalysis.Workspaces.Desktop.csproj">
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
</ProjectReference>
<ProjectReference Include="..\..\Workspaces\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj">
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
</ProjectReference>
......
......@@ -17,7 +17,6 @@
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.MefComponent" Path="Microsoft.CodeAnalysis.Workspaces.dll" />
<Asset Type="Microsoft.VisualStudio.MefComponent" Path="Microsoft.CodeAnalysis.Workspaces.Desktop.dll" />
<Asset Type="Microsoft.VisualStudio.MefComponent" Path="Microsoft.CodeAnalysis.EditorFeatures.dll" />
<Asset Type="Microsoft.VisualStudio.MefComponent" Path="Microsoft.CodeAnalysis.Features.dll" />
<Asset Type="Microsoft.VisualStudio.MefComponent" Path="Microsoft.CodeAnalysis.CSharp.Features.dll" />
......
......@@ -95,6 +95,7 @@
<InternalsVisibleTo Include="Roslyn.Services.Test.Utilities" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Workspaces.UnitTests" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Workspaces.Desktop.UnitTests" />
<InternalsVisibleTo Include="Roslyn.Services.UnitTests.Utilities" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.UnitTests" />
......
......@@ -26,28 +26,6 @@ internal static void ResetHostServicesTestOnly()
s_defaultServices = null;
}
private static ImmutableArray<Assembly> s_defaultAssemblies;
public static ImmutableArray<Assembly> DefaultAssemblies
{
get
{
if (s_defaultAssemblies == null)
{
ImmutableInterlocked.InterlockedCompareExchange(ref s_defaultAssemblies, CreateDefaultAssemblies(), default);
}
return s_defaultAssemblies;
}
}
private static ImmutableArray<Assembly> CreateDefaultAssemblies()
{
var assemblyNames = new string[]
{
"Microsoft.CodeAnalysis.Workspaces.Desktop",
};
return MefHostServices.DefaultAssemblies.Concat(MefHostServices.LoadNearbyAssemblies(assemblyNames));
}
public static ImmutableArray<Assembly> DefaultAssemblies => MefHostServices.DefaultAssemblies;
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.CodeAnalysis {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class WorkspaceDesktopResources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal WorkspaceDesktopResources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.WorkspaceDesktopResources", typeof(WorkspaceDesktopResources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Invalid assembly name.
/// </summary>
internal static string Invalid_assembly_name {
get {
return ResourceManager.GetString("Invalid_assembly_name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid characters in assembly name.
/// </summary>
internal static string Invalid_characters_in_assembly_name {
get {
return ResourceManager.GetString("Invalid_characters_in_assembly_name", resourceCulture);
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Invalid_assembly_name" xml:space="preserve">
<value>Invalid assembly name</value>
</data>
<data name="Invalid_characters_in_assembly_name" xml:space="preserve">
<value>Invalid characters in assembly name</value>
</data>
</root>
\ No newline at end of file
......@@ -23,9 +23,6 @@
<Compile Include="..\..\..\Compilers\Shared\CoreClrAnalyzerAssemblyLoader.cs">
<Link>InternalUtilities\CoreClrAnalyzerAssemblyLoader.cs</Link>
</Compile>
<Compile Include="..\..\..\Compilers\Shared\DesktopAnalyzerAssemblyLoader.cs">
<Link>InternalUtilities\DesktopAnalyzerAssemblyLoader.cs</Link>
</Compile>
<Compile Include="..\..\..\Compilers\Shared\GlobalAssemblyCacheHelpers\GlobalAssemblyCacheLocation.cs">
<Link>InternalUtilities\GlobalAssemblyCache.cs</Link>
</Compile>
......
......@@ -1152,42 +1152,6 @@ private ObjectReference<Compilation> GetObservedCompilation(Solution solution, P
return new ObjectReference<Compilation>(observed);
}
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestLoadProjectFromCommandLine()
{
string commandLine = @"goo.cs subdir\bar.cs /out:goo.dll /target:library";
var info = CommandLineProject.CreateProjectInfo("TestProject", LanguageNames.CSharp, commandLine, @"C:\ProjectDirectory");
var ws = new AdhocWorkspace();
ws.AddProject(info);
var project = ws.CurrentSolution.GetProject(info.Id);
Assert.Equal("TestProject", project.Name);
Assert.Equal("goo", project.AssemblyName);
Assert.Equal(OutputKind.DynamicallyLinkedLibrary, project.CompilationOptions.OutputKind);
Assert.Equal(2, project.Documents.Count());
var gooDoc = project.Documents.First(d => d.Name == "goo.cs");
Assert.Equal(0, gooDoc.Folders.Count);
Assert.Equal(@"C:\ProjectDirectory\goo.cs", gooDoc.FilePath);
var barDoc = project.Documents.First(d => d.Name == "bar.cs");
Assert.Equal(1, barDoc.Folders.Count);
Assert.Equal("subdir", barDoc.Folders[0]);
Assert.Equal(@"C:\ProjectDirectory\subdir\bar.cs", barDoc.FilePath);
}
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestCommandLineProjectWithRelativePathOutsideProjectCone()
{
string commandLine = @"..\goo.cs";
var info = CommandLineProject.CreateProjectInfo("TestProject", LanguageNames.CSharp, commandLine, @"C:\ProjectDirectory");
var docInfo = info.Documents.First();
Assert.Equal(0, docInfo.Folders.Count);
Assert.Equal("goo.cs", docInfo.Name);
}
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestWorkspaceLanguageServiceOverride()
{
......
......@@ -152,41 +152,6 @@ public void TestAddProjects()
}
}
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public async Task TestAddProject_CommandLineProjectAsync()
{
CreateFiles(GetSimpleCSharpSolutionFiles());
string commandLine = @"CSharpClass.cs /out:goo.dll /target:library";
var baseDirectory = Path.Combine(this.SolutionDirectory.Path, "CSharpProject");
using (var ws = new AdhocWorkspace(DesktopMefHostServices.DefaultServices))
{
var info = CommandLineProject.CreateProjectInfo("TestProject", LanguageNames.CSharp, commandLine, baseDirectory, ws);
ws.AddProject(info);
var project = ws.CurrentSolution.GetProject(info.Id);
Assert.Equal("TestProject", project.Name);
Assert.Equal("goo", project.AssemblyName);
Assert.Equal(OutputKind.DynamicallyLinkedLibrary, project.CompilationOptions.OutputKind);
Assert.Equal(1, project.Documents.Count());
var gooDoc = project.Documents.First(d => d.Name == "CSharpClass.cs");
Assert.Equal(0, gooDoc.Folders.Count);
var expectedPath = Path.Combine(baseDirectory, "CSharpClass.cs");
Assert.Equal(expectedPath, gooDoc.FilePath);
var text = (await gooDoc.GetTextAsync()).ToString();
Assert.NotEqual("", text);
var tree = await gooDoc.GetSyntaxRootAsync();
Assert.Equal(false, tree.ContainsDiagnostics);
var compilation = await project.GetCompilationAsync();
}
}
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestAddProject_TryApplyChanges()
{
......
......@@ -25,13 +25,6 @@ public static class ExportProviderCache
private static readonly IExportProviderFactory s_defaultHostExportProviderFactory =
CreateExportProviderFactory(s_defaultHostCatalog);
// Cache the catalog and export provider factory for DesktopMefHostServices.DefaultAssemblies
private static readonly ComposableCatalog s_desktopHostCatalog =
CreateAssemblyCatalog(DesktopMefHostServices.DefaultAssemblies);
private static readonly IExportProviderFactory s_desktopHostExportProviderFactory =
CreateExportProviderFactory(s_desktopHostCatalog);
// Cache the catalog and export provider factory for RoslynServices.RemoteHostAssemblies
private static readonly ComposableCatalog s_remoteHostCatalog =
CreateAssemblyCatalog(RoslynServices.RemoteHostAssemblies);
......@@ -73,10 +66,6 @@ public static ComposableCatalog GetOrCreateAssemblyCatalog(IEnumerable<Assembly>
{
return s_defaultHostCatalog;
}
else if (assembliesArray == DesktopMefHostServices.DefaultAssemblies)
{
return s_desktopHostCatalog;
}
else if (assembliesArray == RoslynServices.RemoteHostAssemblies)
{
return s_remoteHostCatalog;
......@@ -169,10 +158,6 @@ public static IExportProviderFactory GetOrCreateExportProviderFactory(Composable
{
return s_defaultHostExportProviderFactory;
}
else if (catalog == s_desktopHostCatalog)
{
return s_desktopHostExportProviderFactory;
}
else if (catalog == s_remoteHostCatalog)
{
return s_remoteHostExportProviderFactory;
......
......@@ -15,6 +15,7 @@
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.VisualStudio.Composition;
using Microsoft.VisualStudio.LanguageServices;
using Roslyn.Test.Utilities;
using Xunit.Sdk;
......@@ -41,7 +42,7 @@ namespace Microsoft.CodeAnalysis.Test.Utilities
/// </list>
/// </remarks>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class UseExportProviderAttribute : BeforeAfterTestAttribute
public class UseExportProviderAttribute : BeforeAfterTestAttribute
{
/// <summary>
/// Asynchronous operations are expected to be cancelled at the end of the test that started them. Operations
......@@ -66,7 +67,6 @@ public override void Before(MethodInfo methodUnderTest)
{
MefHostServices.HookServiceCreation(CreateMefHostServices);
RoslynServices.HookHostServices(() => _remoteHostServices.Value);
DesktopMefHostServices.ResetHostServicesTestOnly();
// make sure we enable this for all unit tests
AsynchronousOperationListenerProvider.Enable(enable: true, diagnostics: true);
......@@ -144,7 +144,6 @@ public override void After(MethodInfo methodUnderTest)
RoslynServices.HookHostServices(() => throw new InvalidOperationException("Cannot create host services after test tear down."));
// Reset static state variables.
DesktopMefHostServices.ResetHostServicesTestOnly();
_hostServices = null;
ExportProviderCache.SetEnabled_OnlyUseExportProviderAttributeCanCall(false);
}
......@@ -199,27 +198,27 @@ private static MefHostServices CreateRemoteHostServices()
private class ExportProviderMefHostServices : MefHostServices, IMefHostExportProvider
{
private readonly MefV1HostServices _mefV1HostServices;
private readonly VisualStudioMefHostServices _vsHostServices;
public ExportProviderMefHostServices(ExportProvider exportProvider)
: base(new ContainerConfiguration().CreateContainer())
{
_mefV1HostServices = MefV1HostServices.Create(exportProvider.AsExportProvider());
_vsHostServices = VisualStudioMefHostServices.Create(exportProvider);
}
protected internal override HostWorkspaceServices CreateWorkspaceServices(Workspace workspace)
{
return _mefV1HostServices.CreateWorkspaceServices(workspace);
return _vsHostServices.CreateWorkspaceServices(workspace);
}
IEnumerable<Lazy<TExtension, TMetadata>> IMefHostExportProvider.GetExports<TExtension, TMetadata>()
{
return _mefV1HostServices.GetExports<TExtension, TMetadata>();
return _vsHostServices.GetExports<TExtension, TMetadata>();
}
IEnumerable<Lazy<TExtension>> IMefHostExportProvider.GetExports<TExtension>()
{
return _mefV1HostServices.GetExports<TExtension>();
return _vsHostServices.GetExports<TExtension>();
}
}
}
......
......@@ -19,7 +19,6 @@
<ProjectReference Include="..\..\Compilers\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj" />
<ProjectReference Include="..\..\EditorFeatures\Core\Microsoft.CodeAnalysis.EditorFeatures.csproj" />
<ProjectReference Include="..\..\Test\Utilities\Portable\Roslyn.Test.Utilities.csproj" />
<ProjectReference Include="..\Core\Desktop\Microsoft.CodeAnalysis.Workspaces.Desktop.csproj" />
<ProjectReference Include="..\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj" />
<ProjectReference Include="..\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj" />
<ProjectReference Include="..\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj" />
......@@ -55,5 +54,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\Issue29122\" />
<Compile Include="..\..\VisualStudio\Core\Def\Implementation\ProjectSystem\VisualStudioMefHostServices.cs" Link="MEF\VisualStudioMefHostServices.cs" />
</ItemGroup>
</Project>
\ No newline at end of file
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Composition;
using System.Composition.Hosting;
using System.IO;
using System.Linq;
using Microsoft.CodeAnalysis.Host.Mef;
......@@ -11,8 +13,19 @@
namespace Microsoft.CodeAnalysis.UnitTests
{
[UseExportProvider]
public partial class CommandLineProjectTests : TestBase
public class CommandLineProjectTests : TestBase
{
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestCommandLineProjectWithRelativePathOutsideProjectCone()
{
string commandLine = @"..\goo.cs";
var info = CommandLineProject.CreateProjectInfo("TestProject", LanguageNames.CSharp, commandLine, @"C:\ProjectDirectory");
var docInfo = info.Documents.First();
Assert.Equal(0, docInfo.Folders.Count);
Assert.Equal("goo.cs", docInfo.Name);
}
[Fact]
public void TestCreateWithoutRequiredServices()
{
......@@ -20,7 +33,7 @@ public void TestCreateWithoutRequiredServices()
Assert.Throws<InvalidOperationException>(delegate
{
var ws = new AdhocWorkspace(); // only includes portable services
var ws = new AdhocWorkspace(new MefHostServices(new ContainerConfiguration().CreateContainer())); // no services
var info = CommandLineProject.CreateProjectInfo("TestProject", LanguageNames.CSharp, commandLine, @"C:\ProjectDirectory", ws);
});
}
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
{
[UseExportProvider]
public class CommandLineProjectWorkspaceTests : WorkspaceTestBase
{
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public async Task TestAddProject_CommandLineProjectAsync()
{
CreateFiles(GetSimpleCSharpSolutionFiles());
string commandLine = @"CSharpClass.cs /out:goo.dll /target:library";
var baseDirectory = Path.Combine(SolutionDirectory.Path, "CSharpProject");
using (var ws = new AdhocWorkspace(DesktopMefHostServices.DefaultServices))
{
var info = CommandLineProject.CreateProjectInfo("TestProject", LanguageNames.CSharp, commandLine, baseDirectory, ws);
ws.AddProject(info);
var project = ws.CurrentSolution.GetProject(info.Id);
Assert.Equal("TestProject", project.Name);
Assert.Equal("goo", project.AssemblyName);
Assert.Equal(OutputKind.DynamicallyLinkedLibrary, project.CompilationOptions.OutputKind);
Assert.Equal(1, project.Documents.Count());
var gooDoc = project.Documents.First(d => d.Name == "CSharpClass.cs");
Assert.Equal(0, gooDoc.Folders.Count);
var expectedPath = Path.Combine(baseDirectory, "CSharpClass.cs");
Assert.Equal(expectedPath, gooDoc.FilePath);
var text = (await gooDoc.GetTextAsync()).ToString();
Assert.NotEqual("", text);
var tree = await gooDoc.GetSyntaxRootAsync();
Assert.Equal(false, tree.ContainsDiagnostics);
var compilation = await project.GetCompilationAsync();
}
}
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestLoadProjectFromCommandLine()
{
string commandLine = @"goo.cs subdir\bar.cs /out:goo.dll /target:library";
var info = CommandLineProject.CreateProjectInfo("TestProject", LanguageNames.CSharp, commandLine, @"C:\ProjectDirectory");
var ws = new AdhocWorkspace();
ws.AddProject(info);
var project = ws.CurrentSolution.GetProject(info.Id);
Assert.Equal("TestProject", project.Name);
Assert.Equal("goo", project.AssemblyName);
Assert.Equal(OutputKind.DynamicallyLinkedLibrary, project.CompilationOptions.OutputKind);
Assert.Equal(2, project.Documents.Count());
var gooDoc = project.Documents.First(d => d.Name == "goo.cs");
Assert.Equal(0, gooDoc.Folders.Count);
Assert.Equal(@"C:\ProjectDirectory\goo.cs", gooDoc.FilePath);
var barDoc = project.Documents.First(d => d.Name == "bar.cs");
Assert.Equal(1, barDoc.Folders.Count);
Assert.Equal("subdir", barDoc.Folders[0]);
Assert.Equal(@"C:\ProjectDirectory\subdir\bar.cs", barDoc.FilePath);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<PlatformTarget>AnyCPU</PlatformTarget>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.UnitTests</RootNamespace>
<TargetFramework>net472</TargetFramework>
<RuntimeIdentifier>$(RoslynDesktopRuntimeIdentifier)</RuntimeIdentifier>
<RoslynProjectType>UnitTest</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
<ProjectReference Include="..\..\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj" />
<ProjectReference Include="..\..\Compilers\Test\Resources\Core\Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj" />
<ProjectReference Include="..\..\Compilers\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj" />
<ProjectReference Include="..\..\EditorFeatures\Core\Microsoft.CodeAnalysis.EditorFeatures.csproj" />
<ProjectReference Include="..\..\EditorFeatures\TestUtilities\Roslyn.Services.Test.Utilities.csproj" />
<ProjectReference Include="..\..\EditorFeatures\Text\Microsoft.CodeAnalysis.EditorFeatures.Text.csproj" />
<ProjectReference Include="..\..\Features\Core\Portable\Microsoft.CodeAnalysis.Features.csproj" />
<ProjectReference Include="..\..\Features\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Features.csproj" />
<ProjectReference Include="..\..\Features\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Features.vbproj" />
<ProjectReference Include="..\..\Test\Utilities\Portable\Roslyn.Test.Utilities.csproj" />
<ProjectReference Include="..\CoreTestUtilities\Roslyn.Services.UnitTests.Utilities.csproj" />
<ProjectReference Include="..\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj" />
<ProjectReference Include="..\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj" />
<ProjectReference Include="..\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj" />
<ProjectReference Include="..\Core\Desktop\Microsoft.CodeAnalysis.Workspaces.Desktop.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Xaml" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
</Project>
\ No newline at end of file
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Reflection;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Test.Utilities;
namespace Microsoft.CodeAnalysis.UnitTests
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
internal class UseMefV1ExportProviderAttribute : UseExportProviderAttribute
{
public override void Before(MethodInfo methodUnderTest)
{
DesktopMefHostServices.ResetHostServicesTestOnly();
base.Before(methodUnderTest);
}
public override void After(MethodInfo methodUnderTest)
{
base.After(methodUnderTest);
DesktopMefHostServices.ResetHostServicesTestOnly();
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册