Skip to content

Commit

Permalink
Update WatsonTcp dependency to v6.0.9, close #121.
Browse files Browse the repository at this point in the history
  • Loading branch information
yallie committed Feb 13, 2025
1 parent a4589f1 commit 11638b0
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CoreRemoting.Tests/DicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public async Task Register_multiple_services_thread_safety()
var t = new ConcurrentDictionary<int, int>();

void RegisterCurrentThread() =>
t.TryAdd(Thread.CurrentThread.ManagedThreadId, 0);
t.TryAdd(Environment.CurrentManagedThreadId, 0);

void RegisterService()
{
Expand Down
2 changes: 2 additions & 0 deletions CoreRemoting.Tests/RpcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ public void Missing_method_throws_RemoteInvocationException()
// a localized message similar to "Method 'Missing method' not found"
Assert.NotNull(ex);
Assert.Contains("Missing Method", ex.Message);

Console.WriteLine(_serverFixture.LastServerError);
Assert.Equal(0, _serverFixture.ServerErrorCount);
}

Expand Down
5 changes: 4 additions & 1 deletion CoreRemoting.Tests/ServerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class ServerFixture : IDisposable
{
public int ServerErrorCount;

public Exception LastServerError;

public ServerFixture()
{
TestService = new TestService();
Expand Down Expand Up @@ -98,8 +100,9 @@ public void Start(IServerChannel channel = null)
ServerConfig.Channel = channel;

Server = new RemotingServer(ServerConfig);
Server.Error += (_, _) =>
Server.Error += (s, ex) =>
{
LastServerError = ex;
ServerErrorCount++;
};

Expand Down
1 change: 0 additions & 1 deletion CoreRemoting.Tests/SessionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ public void RemotingSession_should_be_accessible_to_the_component_constructor()
}

[Fact]
[SuppressMessage("Usage", "xUnit1030:Do not call ConfigureAwait in test method", Justification = "<Pending>")]
public async Task CloseSession_method_should_close_session_gracefully_issue55()
{
using var client = new RemotingClient(new ClientConfig()
Expand Down
2 changes: 1 addition & 1 deletion CoreRemoting/CoreRemoting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<PackageReference Include="System.Security.Cryptography.Cng" Version="5.0.0" />
<PackageReference Include="System.Security.Cryptography.OpenSsl" Version="5.0.0" />
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
<PackageReference Include="WatsonTcp" Version="6.0.8" />
<PackageReference Include="WatsonTcp" Version="6.0.9" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions CoreRemoting/RemoteDelegates/EventStub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private Delegate Delegate
set { TypedDelegate = (T)(object)value; }
}

private object syncRoot = new object();
private object syncRoot = new();

public void AddHandler(Delegate handler)
{
Expand Down Expand Up @@ -396,9 +396,8 @@ public static int GetHandlerCount(Delegate handler)
foreach (var d in handler.GetInvocationList())
{
// check if it's a delegate holder
if (d.Target is IDelegateHolder)
if (d.Target is IDelegateHolder holder)
{
var holder = (IDelegateHolder)d.Target;
count += holder.HandlerCount;
continue;
}
Expand Down
3 changes: 1 addition & 2 deletions CoreRemoting/RemotingServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public sealed class RemotingServer : IRemotingServer
private readonly string _uniqueServerInstanceName;

// ReSharper disable once InconsistentNaming
private static readonly ConcurrentDictionary<string, IRemotingServer> _serverInstances =
new ConcurrentDictionary<string, IRemotingServer>();
private static readonly ConcurrentDictionary<string, IRemotingServer> _serverInstances = new();

private static WeakReference<IRemotingServer> _defaultRemotingServerRef;

Expand Down
5 changes: 3 additions & 2 deletions CoreRemoting/ServiceProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,9 @@ private bool MapLinqExpressionArgument(Type argumentType, object argument, out o
argumentType is
{
IsGenericType: true,
BaseType: { IsGenericType: true }
} && argumentType.BaseType.GetGenericTypeDefinition() == typeof(Expression<>);
BaseType.IsGenericType: true
}
&& argumentType.BaseType.GetGenericTypeDefinition() == typeof(Expression<>);

if (!isLinqExpression)
{
Expand Down

0 comments on commit 11638b0

Please sign in to comment.