Skip to content

Commit 6446d41

Browse files
committed
CHanged the direct package dependency to disable compile-time assembly reference
This helps us keep the .targts file active and hence able to obtain other assets inside DLL while disabling the references
1 parent aa33a33 commit 6446d41

3 files changed

Lines changed: 11 additions & 16 deletions

File tree

Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@
118118
</ItemGroup>
119119

120120
<ItemGroup Condition=" '$(ProjectRef)' != 'True' ">
121+
<PackageReference Include="Microsoft.Azure.Cosmos.Direct" Version="[$(DirectVersion)]" PrivateAssets="All">
122+
<ExcludeAssets>compile</ExcludeAssets>
123+
</PackageReference>
121124
<PackageReference Include="Microsoft.HybridRow" Version="[$(HybridRowVersion)]" PrivateAssets="All" />
122125
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
123126
</ItemGroup>

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DirectContractTests.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,6 @@ public void TestInteropTest()
4141
Marshal.Release(tryCreateServiceProvider.Result);
4242
}
4343

44-
[TestMethod]
45-
public void PublicDirectTypes()
46-
{
47-
Assembly directAssembly = typeof(IStoreClient).Assembly;
48-
49-
Assert.IsTrue(directAssembly.FullName.StartsWith("Microsoft.Azure.Cosmos.Direct", System.StringComparison.Ordinal), directAssembly.FullName);
50-
51-
Type[] exportedTypes = directAssembly.GetExportedTypes();
52-
Assert.AreEqual(0, exportedTypes.Length, string.Join(",", exportedTypes.Select(e => e.Name).ToArray()));
53-
}
54-
5544
[TestMethod]
5645
public void MappedRegionsTest()
5746
{
@@ -131,6 +120,7 @@ public void ProjectPackageDependenciesTest()
131120
{ "System.Diagnostics.DiagnosticSource", new Version(8, 0, 1) },
132121
{ "System.Net.Http", new Version(4, 3, 4) },
133122
{ "System.Text.RegularExpressions", new Version(4, 3, 1) },
123+
{ "System.Diagnostics.PerformanceCounter", new Version(6, 0, 0) }
134124
};
135125

136126
Assert.AreEqual(projectDependencies.Count, baselineDependencies.Count);

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/OpenTelemetryRecorderTests.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ public async Task CheckResponseCompatibility()
9696
IEnumerable<Type> actualClasses = asm
9797
.GetTypes()
9898
.Where(type =>
99-
(type.Name.EndsWith("Response") || type.Name.EndsWith("Response`1")) && // Ending with Response and Response<T>
100-
!type.Name.Contains("OpenTelemetryResponse") && // Excluding OpenTelemetryResponse because we are testing this class
101-
!type.IsAbstract && // Excluding abstract classes
102-
!type.IsInterface && // Excluding interfaces
103-
!excludedResponses.Contains(type.Name)); // Excluding all the types defined in excludedResponses list
99+
(type.Name.EndsWith("Response") || type.Name.EndsWith("Response`1")) && // Ending with Response and Response<T>
100+
!type.Name.Contains("OpenTelemetryResponse") && // Excluding OpenTelemetryResponse because we are testing this class
101+
!type.IsAbstract && // Excluding abstract classes
102+
!type.IsInterface && // Excluding interfaces
103+
!excludedResponses.Contains(type.Name) && // Excluding all the types defined in excludedResponses list
104+
!(type.Namespace != null && type.Namespace.StartsWith("Microsoft.Azure.Documents")) // Exclude types from direct Microsoft.Azure.Documents
105+
);
104106

105107
foreach (Type className in actualClasses)
106108
{

0 commit comments

Comments
 (0)