Skip to content

Commit

Permalink
Update NuGet packages to latest versions (#374)
Browse files Browse the repository at this point in the history
This repository was flagged for using unsecure Newtonsoft.Json package version through the xunit package dependency. In addition to the xunit packages, upgrade all packages to their latest stable versions.

Dependencies of the shipping product binaries:

Microsoft.ServiceFabric.Services.Remoting
  System.Reflection.Emit and System.Reflection.Emit.ILGeneration from 4.3.0 to 4.7.0
  System.Diagnostics.DiagnosticSource from 4.3.0 to 8.0.1

Dependencies of the test projects:
  FluentAssertions from 5.9.0 to 6.12.0
  Moq from 4.13.0 to 4.20.70
  Microsoft.NET.Test.Sdk from 15.9.0 to 17.10.0
  xunit from 2.4.1 to 2.8.1
  xunit.runner.visualstudio from 2.4.1 to 2.8.1
  Microsoft.Diagnostics.Tracing.TraceEvent from 2.0.45 to 3.1.12
  System.Net.Http.WinHttpHandler from 6.0.0 to 8.0.0
  • Loading branch information
olegsych authored Jun 20, 2024
1 parent a3349d4 commit c732020
Show file tree
Hide file tree
Showing 15 changed files with 181 additions and 185 deletions.
2 changes: 1 addition & 1 deletion properties/service_fabric_common.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<!-- TODO: Versions numbers are changed here manually for now, Integrate this with GitVersion. -->
<MajorVersion>8</MajorVersion>
<MinorVersion>0</MinorVersion>
<BuildVersion>3</BuildVersion>
<BuildVersion>4</BuildVersion>
<Revision>0</Revision>

</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.ServiceFabric" Version="$(NugetPkg_Version_Microsoft_ServiceFabric)" />
<PackageReference Include="Microsoft.ServiceFabric.Diagnostics.Internal" Version="$(NugetPkg_Version_Microsoft_ServiceFabric_Diagnostics_Internal)" />
<PackageReference Include="Microsoft.ServiceFabric.FabricTransport.Internal" Version="$(NugetPkg_Version_Microsoft_ServiceFabric_FabricTransport_Internal)" />
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="6.0.0" />
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.ServiceFabric.Actors\Microsoft.ServiceFabric.Actors.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ServiceFabric.FabricTransport.Internal" Version="$(NugetPkg_Version_Microsoft_ServiceFabric_FabricTransport_Internal)" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.3.0" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="8.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.ServiceFabric.Services\Microsoft.ServiceFabric.Services.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ServiceFabric.FabricTransport.Internal" Version="$(NugetPkg_Version_Microsoft_ServiceFabric_FabricTransport_Internal)" />
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
<PackageReference Include="System.Reflection.Emit.ILGeneration" Version="4.3.0" />
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
<PackageReference Include="System.Reflection.Emit.ILGeneration" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(SourceCodeDir)SR.resx">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
<AssemblyName>Microsoft.ServiceFabric.Actors.StateMigration.Tests</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFramework>net6.0</TargetFramework>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="2.0.45" />
<PackageReference Include="Moq" Version="4.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.12" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public interface IMockActor : IActor
/// Verifies ActorManager close.
/// </summary>
[Fact]
public void VerifyClose()
public async Task VerifyClose()
{
this.ResetActorManager();
this.RegisterReminders();
this.VerifyReminderPresence();
this.actorManager.CloseAsync(CancellationToken.None).GetAwaiter().GetResult();
await this.actorManager.CloseAsync(CancellationToken.None);
this.VerifyNoReminders();
}

Expand All @@ -77,10 +77,10 @@ public void VerifyAbort()
/// Verify FireReminder after close.
/// </summary>
[Fact]
public void VerifyFireReminderNoThrow()
public async Task VerifyFireReminderNoThrow()
{
this.ResetActorManager();
this.actorManager.CloseAsync(CancellationToken.None).GetAwaiter().GetResult();
await this.actorManager.CloseAsync(CancellationToken.None);

var reminder = new ActorReminder(
ActorId.CreateRandom(),
Expand All @@ -90,7 +90,7 @@ public void VerifyFireReminderNoThrow()
TimeSpan.FromMinutes(30),
TimeSpan.FromMinutes(30));

this.actorManager.FireReminderAsync(reminder).GetAwaiter().GetResult();
await this.actorManager.FireReminderAsync(reminder);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public interface IMockActorEvent : IActorEvents
/// Verify mockability for ACtors.
/// </summary>
[Fact]
public void VerifyActorMockability()
public async Task VerifyActorMockability()
{
var mockActorId = ActorId.CreateRandom();

Expand All @@ -70,10 +70,10 @@ public void VerifyActorMockability()
mockActor.ServiceUri.Should().Be(mockActorService.Context.ServiceName, "ServiceUri from Actor should be same as what is coming form ServiceContext");

ConsoleLogHelper.LogInfo("Verifying Actor State Mockability...");
mockActor.VerifyActorStateMockabilityAsync().GetAwaiter().GetResult();
await mockActor.VerifyActorStateMockabilityAsync();

ConsoleLogHelper.LogInfo("Verifying Remider Mockability...");
mockActor.VerifyRemiderMockabilityAsync().GetAwaiter().GetResult();
await mockActor.VerifyRemiderMockabilityAsync();

ConsoleLogHelper.LogInfo("Verifying Timer Mockability...");
mockActor.VerifyTimerMockability();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
<AssemblyName>Microsoft.ServiceFabric.Actors.Tests</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFramework>net6.0</TargetFramework>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="2.0.45" />
<PackageReference Include="Moq" Version="4.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.12" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private interface IDummyActor : IActor
/// Verifies usage of ReentrancyGuard.
/// </summary>
[Fact]
public void VerifyReentrants()
public async Task VerifyReentrants()
{
var a = new DummyActor();
var guard = this.CreateAndInitializeReentrancyGuard(a, ActorReentrancyMode.LogicalCallContext);
Expand All @@ -55,14 +55,14 @@ public void VerifyReentrants()
});
}

Task.WaitAll(tasks);
await Task.WhenAll(tasks);
}

/// <summary>
/// VerifyDirtyCallbacks test.
/// </summary>
[Fact]
public void VerifyDirtyCallbacks()
public async Task VerifyDirtyCallbacks()
{
var actor = new DummyActor();
var guard = this.CreateAndInitializeReentrancyGuard(actor, ActorReentrancyMode.LogicalCallContext);
Expand All @@ -71,12 +71,12 @@ public void VerifyDirtyCallbacks()
var result = guard.Acquire(callContext, @base => ReplacementHandler(actor), CancellationToken.None);
try
{
result.Wait();
await result;
actor.IsDirty.Should().BeFalse("ReentrancyGuard IsDirty should be set to false");
}
finally
{
guard.ReleaseContext(callContext).Wait();
await guard.ReleaseContext(callContext);
}

RunTest(guard);
Expand All @@ -86,19 +86,19 @@ public void VerifyDirtyCallbacks()
/// Tests Releasing context with a different call context.
/// </summary>
[Fact]
public void VerifyInvalidContextRelease()
public async Task VerifyInvalidContextRelease()
{
var actor = new DummyActor();
var guard = this.CreateAndInitializeReentrancyGuard(actor, ActorReentrancyMode.LogicalCallContext);
var context = Guid.NewGuid().ToString();
guard.Acquire(context, null, CancellationToken.None).Wait();
await guard.Acquire(context, null, CancellationToken.None);
guard.Test_CurrentContext.Should().Be(context);
guard.Test_CurrentCount.Should().Be(1);

Action action = () => guard.ReleaseContext(Guid.NewGuid().ToString()).Wait();
action.Should().Throw<AggregateException>();

guard.ReleaseContext(context).Wait();
await guard.ReleaseContext(context);
guard.Test_CurrentContext.Should().NotBe(context);
guard.Test_CurrentCount.Should().Be(0);
}
Expand All @@ -107,19 +107,19 @@ public void VerifyInvalidContextRelease()
/// Tests ActorReentrancyMode.Disallowed
/// </summary>
[Fact]
public void ReentrancyDisallowedTest()
public async Task ReentrancyDisallowedTest()
{
var actor = new DummyActor();
var guard = this.CreateAndInitializeReentrancyGuard(actor, ActorReentrancyMode.Disallowed);
var context = Guid.NewGuid().ToString();
guard.Acquire(context, null, CancellationToken.None).Wait();
await guard.Acquire(context, null, CancellationToken.None);
guard.Test_CurrentContext.Should().Be(context);
guard.Test_CurrentCount.Should().Be(1);

Action action = () => guard.Acquire(context, null, CancellationToken.None).Wait();
action.Should().Throw<AggregateException>();

guard.ReleaseContext(context).Wait();
await guard.ReleaseContext(context);
guard.Test_CurrentContext.Should().NotBe(context);
guard.Test_CurrentCount.Should().Be(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void VerifyBasicUsage()
[InlineData(5)]
[InlineData(10)]

public void VerifyUseUnuseCollect(int n)
public async Task VerifyUseUnuseCollect(int n)
{
// 1. Set MaxIdleCount for IdleObjectGcHandle to N.
// 2. Call TryUse Once.
Expand All @@ -65,7 +65,7 @@ public void VerifyUseUnuseCollect(int n)
tasks.Add(Task.Run(() => Assert.False(gchandle.TryCollect())));
}

Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
tasks.Clear();

for (var i = 0; i < n; i++)
Expand All @@ -74,7 +74,7 @@ public void VerifyUseUnuseCollect(int n)
tasks.Add(Task.Run(() => Assert.False(gchandle.TryCollect())));
}

Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
tasks.Clear();

gchandle.Unuse(false);
Expand All @@ -83,7 +83,7 @@ public void VerifyUseUnuseCollect(int n)
tasks.Add(Task.Run(() => Assert.False(gchandle.TryCollect())));
}

Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
gchandle.TryCollect().Should().BeTrue();
}

Expand All @@ -96,7 +96,7 @@ public void VerifyUseUnuseCollect(int n)
[InlineData(2)]
[InlineData(5)]
[InlineData(10)]
public void VerifyUseUnuseCollectWithTimerCalls(int n)
public async Task VerifyUseUnuseCollectWithTimerCalls(int n)
{
// 1. Set MaxIdleCount for IdleObjectGcHandle to N.
// 2. Call TryUse Once.
Expand All @@ -120,7 +120,7 @@ public void VerifyUseUnuseCollectWithTimerCalls(int n)
tasks.Add(Task.Run(() => Assert.False(gchandle.TryCollect())));
}

Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
tasks.Clear();

for (var i = 0; i < n; i++)
Expand All @@ -130,7 +130,7 @@ public void VerifyUseUnuseCollectWithTimerCalls(int n)
tasks.Add(Task.Run(() => Assert.False(gchandle.TryCollect())));
}

Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
tasks.Clear();

gchandle.Unuse(false);
Expand All @@ -140,7 +140,7 @@ public void VerifyUseUnuseCollectWithTimerCalls(int n)
tasks.Add(Task.Run(() => Assert.False(gchandle.TryCollect())));
}

Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
tasks.Clear();
gchandle.TryUse(true).Should().BeTrue();

Expand All @@ -149,12 +149,12 @@ public void VerifyUseUnuseCollectWithTimerCalls(int n)
tasks.Add(Task.Run(() => Assert.False(gchandle.TryCollect())));
}

Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
tasks.Clear();
gchandle.Unuse(true);
gchandle.TryCollect().Should().BeFalse();

Task.WaitAll(tasks.ToArray());
await Task.WhenAll(tasks.ToArray());
tasks.Clear();

gchandle.TryCollect().Should().BeTrue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
<AssemblyName>Microsoft.ServiceFabric.Services.Remoting.Tests</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFramework>net6.0</TargetFramework>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="Moq" Version="4.13.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public static async Task KnownSystemExceptionSerializationTest()
}
else if (exception is ReflectionTypeLoadException typeLoad)
{
if (!typeLoad.Types.IsNullOrEmpty())
if (typeLoad.Types?.Any() == true)
{
Assert.True(((ReflectionTypeLoadException)resultEx).Types.SequenceEqual(typeLoad.Types));
}
Expand Down Expand Up @@ -229,7 +229,7 @@ public static async Task ExceptionDepthTest()
Assert.True(((AggregateException)((AggregateException)resultEx).InnerExceptions[0]).InnerExceptions.Count == 3);
Assert.True(((AggregateException)((AggregateException)((AggregateException)resultEx).InnerExceptions[0]).InnerExceptions[0]).InnerExceptions.Count == 0);
Assert.True(((ReflectionTypeLoadException)((AggregateException)resultEx).InnerExceptions[1]).LoaderExceptions.Length == 3);
Assert.True(((ReflectionTypeLoadException)((ReflectionTypeLoadException)((AggregateException)resultEx).InnerExceptions[1]).LoaderExceptions[0]).LoaderExceptions.IsNullOrEmpty());
Assert.False(((ReflectionTypeLoadException)((ReflectionTypeLoadException)((AggregateException)resultEx).InnerExceptions[1]).LoaderExceptions[0]).LoaderExceptions?.Any());
}

private static AggregateException NestedAggregateEx(int depth, int breadth)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
<AssemblyName>Microsoft.ServiceFabric.Services.Tests</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFramework>net6.0</TargetFramework>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="Moq" Version="4.13.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading

0 comments on commit c732020

Please sign in to comment.