Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eng/config/PublishData.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"Microsoft.CodeAnalysis.Workspaces.Common": "vssdk",
"Microsoft.CodeAnalysis.Workspaces.MSBuild": "arcade",
"Microsoft.CodeAnalysis.Workspaces.Desktop": "arcade",
"Microsoft.CodeAnalysis.Workspaces.Test.Utilities": "vs-impl",
"Microsoft.CodeAnalysis.Compiler.Test.Resources": "vs-impl",
"Microsoft.CodeAnalysis.CSharp": "vssdk",
"Microsoft.CodeAnalysis.CSharp.CodeStyle": "arcade",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>$(NetRoslynAll);net472</TargetFrameworks>
<IsShipping>false</IsShipping>
<IsPackable>true</IsPackable>
<PackageId>Microsoft.CodeAnalysis.Test.Utilities</PackageId>
<PackageDescription>This is an internal package for testing. Not meant for external or production uses. The API can and will break at our discretion.</PackageDescription>
<IsTestUtilityProject>true</IsTestUtilityProject>

<!-- NuGet -->
<IsPackable>true</IsPackable>
<PackageDescription>This is an internal package for testing. Not meant for external or production uses. The API can and will break at our discretion.</PackageDescription>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Compilers\Test\Resources\Core\Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/Tools/SemanticSearch/Extensions/ProjectModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ internal static ResxFile ReadFromFile(string filePath)
public ResxFile AddString(string name, string value)
=> new(FilePath, _changes.SetItem(name, value));

internal string GetContent()
public string GetContent()
{
if (_changes.Count == 0)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
+T:*
-M:Microsoft.CodeAnalysis.SemanticSearch.Extensions.ProjectModel.#ctor*
-M:Microsoft.CodeAnalysis.SemanticSearch.Extensions.ProjectModel.GetChanges*

-M:Microsoft.CodeAnalysis.SemanticSearch.Extensions.ResxFile.GetContent*
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
// See the LICENSE file in the project root for more information.

using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Shared.TestHooks;

namespace Roslyn.Test.Utilities;
namespace Microsoft.CodeAnalysis.Test.Utilities;

public static class AsynchronousOperationListenerExtensions
internal static class AsynchronousOperationListenerExtensions
{
internal static async Task WaitAllDispatcherOperationAndTasksAsync(this IAsynchronousOperationListenerProvider provider, Workspace? workspace, params string[] featureNames)
{
Expand Down
5 changes: 2 additions & 3 deletions src/Workspaces/CoreTestUtilities/MEF/ExportProviderCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.UnitTests.Remote;
using Microsoft.VisualStudio.Composition;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.Test.Utilities;

public static class ExportProviderCache
{
private static readonly PartDiscovery s_partDiscovery = CreatePartDiscovery(Resolver.DefaultInstance);

private static readonly TestComposition s_defaultHostExportProviderComposition = TestComposition.Empty
.AddAssemblies(MefHostServices.DefaultAssemblies)
private static readonly TestComposition s_defaultHostExportProviderComposition = TestComposition.Default
.AddParts(typeof(TestSerializerService.Factory));

private static readonly Scope _localCompositionScope = new("local");
private static readonly Scope _remoteCompositionScope = new("remote");

Expand Down
6 changes: 5 additions & 1 deletion src/Workspaces/CoreTestUtilities/MEF/TestComposition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace Microsoft.CodeAnalysis.Test.Utilities;
public sealed class TestComposition
{
public static readonly TestComposition Empty = new([], [], []);
public static readonly TestComposition Default = Empty.AddAssemblies(MefHostServices.DefaultAssemblies);

private static readonly Dictionary<CacheKey, IExportProviderFactory> s_factoryCache = [];

Expand Down Expand Up @@ -88,7 +89,10 @@ private TestComposition(ImmutableHashSet<Assembly> assemblies, ImmutableHashSet<
/// depending on what layer the composition is for. Editor Features and VS layers use VS MEF composition while anything else uses System.Composition.
/// </summary>
public HostServices GetHostServices()
=> VisualStudioMefHostServices.Create(ExportProviderFactory.CreateExportProvider());
=> GetHostServices(out _);

public HostServices GetHostServices(out ExportProvider exportProvider)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this return a tuple instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we would need to call it GetHostServicesAndExportProvider.

=> VisualStudioMefHostServices.Create(exportProvider = ExportProviderFactory.CreateExportProvider());

/// <summary>
/// VS MEF <see cref="ExportProvider"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private static void DisposeExportProvider(ExportProvider? exportProvider)
var exceptions = testErrorHandler.Exceptions;
if (exceptions.Count > 0)
{
throw new AggregateException("Tests threw unexpected exceptions", exceptions);
throw new AggregateException(exceptions);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
<IsShipping>false</IsShipping>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<IsTestUtilityProject>true</IsTestUtilityProject>

<!-- NuGet -->
<IsPackable>true</IsPackable>
<PackageDescription>This is an internal package for testing. Not meant for external or production uses. The API can and will break at our discretion.</PackageDescription>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Compilers\Test\Core\Microsoft.CodeAnalysis.Test.Utilities.csproj" />
<ProjectReference Include="..\MSBuild\Core\Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj" />
<ProjectReference Include="..\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj" />
<ProjectReference Include="..\Remote\ServiceHub\Microsoft.CodeAnalysis.Remote.ServiceHub.csproj" />
<ProjectReference Include="..\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj" />
Expand All @@ -22,6 +25,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeRefactoring.Testing.XUnit" />
Expand Down