From dcb3596cc255778952ce6bd2b269802f334b59b6 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Tue, 25 Nov 2025 22:59:21 -0500 Subject: [PATCH 1/2] Bump GraphQL and ASP.NET Core versions --- Directory.Build.props | 4 ++-- src/GraphQL.AspNetCore3/GraphQL.AspNetCore3.csproj | 13 ++++++++++--- src/GraphQL.AspNetCore3/GraphQLHttpMiddleware.cs | 11 ++++++----- src/Samples/Net48Sample/Net48Sample.csproj | 12 ++++++------ src/Tests/Middleware/AuthorizationTests.cs | 2 ++ src/Tests/Middleware/FileUploadTests.cs | 2 ++ src/Tests/Middleware/MiscTests.cs | 8 ++++++++ src/Tests/Middleware/WebSocketTests.cs | 4 ++++ 8 files changed, 40 insertions(+), 16 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index fba05a0..ddf175e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 7.1.0-preview + 8.0.0-preview 12.0 Shane Krueger Shane Krueger @@ -20,7 +20,7 @@ true enable false - 8.2.1 + 8.8.0 $(NoWarn);IDE0056;IDE0057;NU1902;NU1903 direct diff --git a/src/GraphQL.AspNetCore3/GraphQL.AspNetCore3.csproj b/src/GraphQL.AspNetCore3/GraphQL.AspNetCore3.csproj index 00bc212..194fc81 100644 --- a/src/GraphQL.AspNetCore3/GraphQL.AspNetCore3.csproj +++ b/src/GraphQL.AspNetCore3/GraphQL.AspNetCore3.csproj @@ -1,4 +1,4 @@ - + netstandard2.0;netcoreapp2.1;netcoreapp3.1;net5.0 @@ -17,13 +17,20 @@ - + + + + + + + + - + diff --git a/src/GraphQL.AspNetCore3/GraphQLHttpMiddleware.cs b/src/GraphQL.AspNetCore3/GraphQLHttpMiddleware.cs index 98289b3..0a3541e 100644 --- a/src/GraphQL.AspNetCore3/GraphQLHttpMiddleware.cs +++ b/src/GraphQL.AspNetCore3/GraphQLHttpMiddleware.cs @@ -33,7 +33,9 @@ public GraphQLHttpMiddleware( IDocumentExecuter documentExecuter, IServiceScopeFactory serviceScopeFactory, GraphQLHttpMiddlewareOptions options, +#pragma warning disable CS0618 // Type or member is obsolete IHostApplicationLifetime hostApplicationLifetime) +#pragma warning restore CS0618 // Type or member is obsolete : base(next, serializer, documentExecuter, serviceScopeFactory, options, hostApplicationLifetime) { } @@ -62,7 +64,9 @@ public class GraphQLHttpMiddleware : IUserContextBuilder private readonly IEnumerable _postCachedDocumentValidationRules; private readonly IGraphQLTextSerializer _serializer; private readonly RequestDelegate _next; +#pragma warning disable CS0618 // Type or member is obsolete private readonly IHostApplicationLifetime _hostApplicationLifetime; +#pragma warning restore CS0618 // Type or member is obsolete private readonly GraphQLHttpMiddlewareOptions _options; private const string QUERY_KEY = "query"; @@ -86,7 +90,9 @@ public GraphQLHttpMiddleware( IDocumentExecuter documentExecuter, IServiceScopeFactory serviceScopeFactory, GraphQLHttpMiddlewareOptions options, +#pragma warning disable CS0618 // Type or member is obsolete IHostApplicationLifetime hostApplicationLifetime) +#pragma warning restore CS0618 // Type or member is obsolete { _next = next ?? throw new ArgumentNullException(nameof(next)); _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); @@ -678,11 +684,6 @@ protected virtual Task WriteJsonResponseAsync(HttpContext context, Http return _serializer.WriteAsync(context.Response.Body, result, context.RequestAborted); } - private static readonly IEnumerable _supportedSubProtocols = new List(new[] { - WebSockets.GraphQLWs.SubscriptionServer.SubProtocol, - WebSockets.SubscriptionsTransportWs.SubscriptionServer.SubProtocol, - }).AsReadOnly(); - /// /// Gets a list of WebSocket sub-protocols supported. /// diff --git a/src/Samples/Net48Sample/Net48Sample.csproj b/src/Samples/Net48Sample/Net48Sample.csproj index 1fa74d8..961dead 100644 --- a/src/Samples/Net48Sample/Net48Sample.csproj +++ b/src/Samples/Net48Sample/Net48Sample.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.1 @@ -12,11 +12,11 @@ - - - - - + + + + + diff --git a/src/Tests/Middleware/AuthorizationTests.cs b/src/Tests/Middleware/AuthorizationTests.cs index 0f7f9dd..d48316e 100644 --- a/src/Tests/Middleware/AuthorizationTests.cs +++ b/src/Tests/Middleware/AuthorizationTests.cs @@ -145,7 +145,9 @@ public async Task WebSocket_NotAuthorized() private class MyMiddleware : GraphQLHttpMiddleware { +#pragma warning disable CS0618 // Type or member is obsolete public MyMiddleware(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter documentExecuter, IServiceScopeFactory serviceScopeFactory, IHostApplicationLifetime hostApplicationLifetime) +#pragma warning restore CS0618 // Type or member is obsolete : base(next, serializer, documentExecuter, serviceScopeFactory, new(), hostApplicationLifetime) { } diff --git a/src/Tests/Middleware/FileUploadTests.cs b/src/Tests/Middleware/FileUploadTests.cs index fbc1e96..9d15111 100644 --- a/src/Tests/Middleware/FileUploadTests.cs +++ b/src/Tests/Middleware/FileUploadTests.cs @@ -63,7 +63,9 @@ public class MyMiddleware : GraphQLHttpMiddleware { private readonly IGraphQLTextSerializer _serializer; +#pragma warning disable CS0618 // Type or member is obsolete public MyMiddleware(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter documentExecuter, IServiceScopeFactory serviceScopeFactory, GraphQLHttpMiddlewareOptions options, IHostApplicationLifetime hostApplicationLifetime) +#pragma warning restore CS0618 // Type or member is obsolete : base(next, serializer, documentExecuter, serviceScopeFactory, options, hostApplicationLifetime) { _serializer = serializer; diff --git a/src/Tests/Middleware/MiscTests.cs b/src/Tests/Middleware/MiscTests.cs index 02867cb..2c5ce4c 100644 --- a/src/Tests/Middleware/MiscTests.cs +++ b/src/Tests/Middleware/MiscTests.cs @@ -18,7 +18,9 @@ public void Constructors() var options = new GraphQLHttpMiddlewareOptions(); var executer = Mock.Of>(); var scopeFactory = Mock.Of(); +#pragma warning disable CS0618 // Type or member is obsolete var appLifetime = Mock.Of(); +#pragma warning restore CS0618 // Type or member is obsolete Should.Throw(() => new GraphQLHttpMiddleware(null!, serializer, executer, scopeFactory, options, appLifetime)); Should.Throw(() => new GraphQLHttpMiddleware(next, null!, executer, scopeFactory, options, appLifetime)); Should.Throw(() => new GraphQLHttpMiddleware(next, serializer, null!, scopeFactory, options, appLifetime)); @@ -46,7 +48,9 @@ public async Task SchemaSpecificBuilders() Mock.Of>(MockBehavior.Strict), Mock.Of(MockBehavior.Strict), new GraphQLHttpMiddlewareOptions(), +#pragma warning disable CS0618 // Type or member is obsolete Mock.Of(MockBehavior.Strict)); +#pragma warning restore CS0618 // Type or member is obsolete var builder = new Mock>(MockBehavior.Strict); var d = new Dictionary { { "test", "test" } }; builder.Setup(x => x.BuildUserContextAsync(It.IsAny(), It.IsAny())).ReturnsAsync(d); @@ -60,7 +64,9 @@ public async Task SchemaSpecificBuilders() private class MyMiddleware : GraphQLHttpMiddleware where TSchema : ISchema { +#pragma warning disable CS0618 // Type or member is obsolete public MyMiddleware(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter executer, IServiceScopeFactory scopeFactory, GraphQLHttpMiddlewareOptions options, IHostApplicationLifetime hostApplicationLifetime) +#pragma warning restore CS0618 // Type or member is obsolete : base(next, serializer, executer, scopeFactory, options, hostApplicationLifetime) { } @@ -115,11 +121,13 @@ public void WebSocketSubProtocolNotSupportedError_Message() public class MyMiddleware : GraphQLHttpMiddleware { +#pragma warning disable CS0618 // Type or member is obsolete public MyMiddleware() : this(Mock.Of(MockBehavior.Strict)) { } public MyMiddleware(IHostApplicationLifetime hostApplicationLifetime) : base( +#pragma warning restore CS0618 // Type or member is obsolete _ => throw new NotSupportedException(), Mock.Of(MockBehavior.Strict), Mock.Of>(MockBehavior.Strict), diff --git a/src/Tests/Middleware/WebSocketTests.cs b/src/Tests/Middleware/WebSocketTests.cs index a57b795..15453c3 100644 --- a/src/Tests/Middleware/WebSocketTests.cs +++ b/src/Tests/Middleware/WebSocketTests.cs @@ -110,7 +110,9 @@ private class TestMiddleware : GraphQLHttpMiddleware { private readonly string[] _subprotocols; +#pragma warning disable CS0618 // Type or member is obsolete public TestMiddleware(RequestDelegate next, string[] subprotocols) : base(next, new GraphQLSerializer(), Mock.Of(MockBehavior.Strict), Mock.Of(MockBehavior.Strict), new GraphQLHttpMiddlewareOptions(), Mock.Of(MockBehavior.Strict)) +#pragma warning restore CS0618 // Type or member is obsolete { _subprotocols = subprotocols; } @@ -161,12 +163,14 @@ private class TestMiddleware2 : GraphQLHttpMiddleware { private readonly Tuple> _tuple; +#pragma warning disable CS0618 // Type or member is obsolete public TestMiddleware2(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter documentExecuter, IServiceScopeFactory serviceScopeFactory, GraphQLHttpMiddlewareOptions options, Tuple> tuple) : this(next, serializer, documentExecuter, serviceScopeFactory, options, Mock.Of(MockBehavior.Strict), tuple) { } private TestMiddleware2(RequestDelegate next, IGraphQLTextSerializer serializer, IDocumentExecuter documentExecuter, IServiceScopeFactory serviceScopeFactory, GraphQLHttpMiddlewareOptions options, IHostApplicationLifetime hostApplicationLifetime, Tuple> tuple) +#pragma warning restore CS0618 // Type or member is obsolete : base(next, serializer, documentExecuter, serviceScopeFactory, options, hostApplicationLifetime) { Mock.Get(hostApplicationLifetime).Setup(x => x.ApplicationStopping).Returns(tuple.Item1.Token); From 238ffd41db0d07a4dca6216de0922c7b10917fbc Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Tue, 25 Nov 2025 23:04:45 -0500 Subject: [PATCH 2/2] update --- src/Samples/Net48Sample/Net48Sample.csproj | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Samples/Net48Sample/Net48Sample.csproj b/src/Samples/Net48Sample/Net48Sample.csproj index 961dead..48eb31f 100644 --- a/src/Samples/Net48Sample/Net48Sample.csproj +++ b/src/Samples/Net48Sample/Net48Sample.csproj @@ -12,6 +12,9 @@ + + + @@ -19,6 +22,14 @@ + + + + + + + +