diff --git a/src/SignalR/server/Core/src/IHubFilter.cs b/src/SignalR/server/Core/src/IHubFilter.cs
index 398d24a253..baf754bb6c 100644
--- a/src/SignalR/server/Core/src/IHubFilter.cs
+++ b/src/SignalR/server/Core/src/IHubFilter.cs
@@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.SignalR
/// The context for the method invocation that holds all the important information about the invoke.
/// The next filter to run, and for the final one, the Hub invocation.
/// Returns the result of the Hub method invoke.
- ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next);
+ ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next) => next(invocationContext);
///
/// Allows handling of the method.
diff --git a/src/SignalR/server/SignalR/test/HubFilterTests.cs b/src/SignalR/server/SignalR/test/HubFilterTests.cs
index 91bc5d835c..5675029eee 100644
--- a/src/SignalR/server/SignalR/test/HubFilterTests.cs
+++ b/src/SignalR/server/SignalR/test/HubFilterTests.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Internal;
using Microsoft.Extensions.DependencyInjection;
@@ -136,6 +135,40 @@ namespace Microsoft.AspNetCore.SignalR.Tests
}
}
+ [Fact]
+ public async Task HubFilterDoesNotNeedToImplementMethods()
+ {
+ using (StartVerifiableLog())
+ {
+ var tcsService = new TcsService();
+ var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(services =>
+ {
+ services.AddSignalR().AddHubOptions(options =>
+ {
+ options.AddFilter(typeof(EmptyFilter));
+ });
+ }, LoggerFactory);
+
+
+ var connectionHandler = serviceProvider.GetService>();
+
+ using (var client = new TestClient())
+ {
+ var connectionHandlerTask = await client.ConnectAsync(connectionHandler);
+
+ await client.Connected.OrTimeout();
+
+ var completion = await client.InvokeAsync(nameof(DynamicTestHub.Echo), "hello");
+ Assert.Null(completion.Error);
+ Assert.Equal("hello", completion.Result);
+
+ client.Dispose();
+
+ await connectionHandlerTask.OrTimeout();
+ }
+ }
+ }
+
[Fact]
public async Task MutlipleFilters_MethodsAreCalled()
{
diff --git a/src/SignalR/server/SignalR/test/TestFilters.cs b/src/SignalR/server/SignalR/test/TestFilters.cs
index e32c48284a..50f124e5f3 100644
--- a/src/SignalR/server/SignalR/test/TestFilters.cs
+++ b/src/SignalR/server/SignalR/test/TestFilters.cs
@@ -233,4 +233,9 @@ namespace Microsoft.AspNetCore.SignalR.Tests
return next(context);
}
}
+
+ public class EmptyFilter : IHubFilter
+ {
+ // Purposefully not implementing any methods
+ }
}