Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.116",
"version": "9.0.300",
"rollForward": "patch",
"allowPrerelease": false
},
Expand Down
2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</config>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="msft_consumption_public" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption_public/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<!-- Defend against user or machine level disabling of sources that we list in this file. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Microsoft.VisualStudio.Composition.Tests
using Xunit;
using CompositionFailedException = Microsoft.VisualStudio.Composition.CompositionFailedException;
using MefV1 = System.ComponentModel.Composition;
using MefV2 = System.Composition;

[Trait("Static", "")]
public class StaticMemberExportsTests
Expand Down Expand Up @@ -212,12 +213,15 @@ public ClassWithStaticMemberExports()
}

[MefV1.Export("StaticField")]
[MefV2.Export("StaticField")]
public static string StaticField = "StaticFieldValue";

[MefV1.Export("StaticProperty")]
[MefV2.Export("StaticProperty")]
public static string StaticProperty => "StaticPropertyValue";

[MefV1.Export("StaticMethod")]
[MefV2.Export("StaticMethod")]
public static string StaticMethod() => "StaticMethodValue";
}

Expand All @@ -238,13 +242,15 @@ public ClassWithMixedExports()
}

[MefV1.Export("StaticMixed")]
[MefV2.Export("StaticMixed")]
public static string StaticExport = "StaticValue";

[MefV1.Export("InstanceMixed")]
[MefV2.Export("InstanceMixed")]
public string InstanceExport => "InstanceValue";
}

[MefFact(CompositionEngines.V3EmulatingV1, typeof(ClassWithStaticMemberExports))]
[MefFact(CompositionEngines.V1Compat | CompositionEngines.V2Compat | CompositionEngines.V3EmulatingV1 | CompositionEngines.V3EmulatingV2, typeof(ClassWithStaticMemberExports))]
public void StaticFieldExportDoesNotInstantiateClass(IContainer container)
{
ClassWithStaticMemberExports.ConstructorCalled = false;
Expand All @@ -253,7 +259,7 @@ public void StaticFieldExportDoesNotInstantiateClass(IContainer container)
Assert.False(ClassWithStaticMemberExports.ConstructorCalled, "Constructor should not be called for static field export");
}

[MefFact(CompositionEngines.V3EmulatingV1, typeof(ClassWithStaticMemberExports))]
[MefFact(CompositionEngines.V1Compat | CompositionEngines.V2Compat | CompositionEngines.V3EmulatingV1 | CompositionEngines.V3EmulatingV2, typeof(ClassWithStaticMemberExports))]
public void StaticPropertyExportDoesNotInstantiateClass(IContainer container)
{
ClassWithStaticMemberExports.ConstructorCalled = false;
Expand All @@ -262,7 +268,7 @@ public void StaticPropertyExportDoesNotInstantiateClass(IContainer container)
Assert.False(ClassWithStaticMemberExports.ConstructorCalled, "Constructor should not be called for static property export");
}

[MefFact(CompositionEngines.V3EmulatingV1, typeof(ClassWithStaticMemberExports))]
[MefFact(CompositionEngines.V1Compat | CompositionEngines.V2Compat | CompositionEngines.V3EmulatingV1 | CompositionEngines.V3EmulatingV2, typeof(ClassWithStaticMemberExports))]
Copy link
Member

Choose a reason for hiding this comment

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

V1Compat includes V3EmulatingV1, and V2Compat includes V3EmulatingV2.
Please drop the redundant flags.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed redundant flags V3EmulatingV1 and V3EmulatingV2 from test attributes. Tests now use only V1Compat and V2Compat as requested (commit 4648648).

public void StaticMethodExportDoesNotInstantiateClass(IContainer container)
{
ClassWithStaticMemberExports.ConstructorCalled = false;
Expand All @@ -271,7 +277,7 @@ public void StaticMethodExportDoesNotInstantiateClass(IContainer container)
Assert.False(ClassWithStaticMemberExports.ConstructorCalled, "Constructor should not be called for static method export");
}

[MefFact(CompositionEngines.V3EmulatingV1, typeof(ClassWithMixedExports))]
[MefFact(CompositionEngines.V1Compat | CompositionEngines.V2Compat | CompositionEngines.V3EmulatingV1 | CompositionEngines.V3EmulatingV2, typeof(ClassWithMixedExports))]
public void StaticExportInMixedClassDoesNotInstantiateClass(IContainer container)
{
ClassWithMixedExports.ConstructorCalled = false;
Expand All @@ -280,7 +286,7 @@ public void StaticExportInMixedClassDoesNotInstantiateClass(IContainer container
Assert.False(ClassWithMixedExports.ConstructorCalled, "Constructor should not be called when accessing only static export");
}

[MefFact(CompositionEngines.V3EmulatingV1, typeof(ClassWithMixedExports))]
[MefFact(CompositionEngines.V1Compat | CompositionEngines.V2Compat | CompositionEngines.V3EmulatingV1 | CompositionEngines.V3EmulatingV2, typeof(ClassWithMixedExports))]
public void InstanceExportInMixedClassDoesInstantiateClass(IContainer container)
{
ClassWithMixedExports.ConstructorCalled = false;
Expand Down