diff --git a/src/Http/Wolverine.Http.FluentValidation/Wolverine.Http.FluentValidation.csproj b/src/Http/Wolverine.Http.FluentValidation/Wolverine.Http.FluentValidation.csproj index 0dfebd515..8dfec2945 100644 --- a/src/Http/Wolverine.Http.FluentValidation/Wolverine.Http.FluentValidation.csproj +++ b/src/Http/Wolverine.Http.FluentValidation/Wolverine.Http.FluentValidation.csproj @@ -10,6 +10,7 @@ false false enable + enable diff --git a/src/Http/Wolverine.Http.Marten/Wolverine.Http.Marten.csproj b/src/Http/Wolverine.Http.Marten/Wolverine.Http.Marten.csproj index 11b5769ef..f3c47aaee 100644 --- a/src/Http/Wolverine.Http.Marten/Wolverine.Http.Marten.csproj +++ b/src/Http/Wolverine.Http.Marten/Wolverine.Http.Marten.csproj @@ -10,6 +10,7 @@ false false enable + enable diff --git a/src/Http/Wolverine.Http/HttpChain.cs b/src/Http/Wolverine.Http/HttpChain.cs index e770cc0ad..7c5e97c8d 100644 --- a/src/Http/Wolverine.Http/HttpChain.cs +++ b/src/Http/Wolverine.Http/HttpChain.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -328,7 +329,7 @@ private void applyMetadata() return variable; } - public bool FindRouteVariable(ParameterInfo parameter, out Variable variable) + public bool FindRouteVariable(ParameterInfo parameter, [NotNullWhen(true)]out Variable? variable) { var existing = _routeVariables.FirstOrDefault(x => x.VariableType == parameter.ParameterType && x.Usage.EqualsIgnoreCase(parameter.Name)); @@ -357,11 +358,11 @@ public bool FindRouteVariable(ParameterInfo parameter, out Variable variable) } } - variable = default!; + variable = default; return false; } - public bool FindRouteVariable(Type variableType, string routeOrParameterName, out Variable variable) + public bool FindRouteVariable(Type variableType, string routeOrParameterName, [NotNullWhen(true)]out Variable? variable) { var matched = _routeVariables.FirstOrDefault(x => x.VariableType == variableType && x.Usage == routeOrParameterName); @@ -389,7 +390,7 @@ public bool FindRouteVariable(Type variableType, string routeOrParameterName, ou } } - variable = default!; + variable = default; return false; } diff --git a/src/Http/Wolverine.Http/HttpGraph.cs b/src/Http/Wolverine.Http/HttpGraph.cs index ba9c09006..2f6c7ad8d 100644 --- a/src/Http/Wolverine.Http/HttpGraph.cs +++ b/src/Http/Wolverine.Http/HttpGraph.cs @@ -1,3 +1,4 @@ +using System.Diagnostics.CodeAnalysis; using JasperFx.CodeGeneration; using JasperFx.CodeGeneration.Frames; using JasperFx.Core; @@ -123,7 +124,7 @@ public override IChangeToken GetChangeToken() return this; } - public HttpChain? ChainFor(string httpMethod, string urlPattern) + public HttpChain? ChainFor(string httpMethod, [StringSyntax("Route")]string urlPattern) { return _chains.FirstOrDefault(x => x.HttpMethods.Contains(httpMethod) && x.RoutePattern!.RawText == urlPattern); } diff --git a/src/Http/Wolverine.Http/IHttpAware.cs b/src/Http/Wolverine.Http/IHttpAware.cs index b96dbc006..99144689b 100644 --- a/src/Http/Wolverine.Http/IHttpAware.cs +++ b/src/Http/Wolverine.Http/IHttpAware.cs @@ -1,4 +1,5 @@ -using System.Reflection; +using System.Diagnostics.CodeAnalysis; +using System.Reflection; using JasperFx.CodeGeneration; using JasperFx.CodeGeneration.Frames; using JasperFx.CodeGeneration.Model; @@ -83,7 +84,7 @@ public static EndpointBuilder RemoveStatusCodeResponse(this EndpointBuilder buil /// Base class for resource types that denote some kind of resource being created /// in the system. Wolverine specific, and more efficient, version of Created from ASP.Net Core /// -public record CreationResponse(string Url) : IHttpAware +public record CreationResponse([StringSyntax("Route")]string Url) : IHttpAware { public static void PopulateMetadata(MethodInfo method, EndpointBuilder builder) { diff --git a/src/Http/Wolverine.Http/ModifyHttpChainAttribute.cs b/src/Http/Wolverine.Http/ModifyHttpChainAttribute.cs index 7ccc33d36..484a91475 100644 --- a/src/Http/Wolverine.Http/ModifyHttpChainAttribute.cs +++ b/src/Http/Wolverine.Http/ModifyHttpChainAttribute.cs @@ -1,3 +1,4 @@ +using System.Diagnostics.CodeAnalysis; using System.Reflection; using JasperFx.CodeGeneration; using JasperFx.CodeGeneration.Model; @@ -112,7 +113,7 @@ public override void Modify(HttpChain chain, GenerationRules rules) /// public class WolverineGetAttribute : WolverineHttpMethodAttribute { - public WolverineGetAttribute(string template) : base("GET", template) + public WolverineGetAttribute([StringSyntax("Route")]string template) : base("GET", template) { } @@ -124,7 +125,7 @@ public WolverineGetAttribute(string template) : base("GET", template) /// public class WolverinePostAttribute : WolverineHttpMethodAttribute { - public WolverinePostAttribute(string template) : base("POST", template) + public WolverinePostAttribute([StringSyntax("Route")]string template) : base("POST", template) { } } @@ -134,7 +135,7 @@ public WolverinePostAttribute(string template) : base("POST", template) /// public class WolverinePutAttribute : WolverineHttpMethodAttribute { - public WolverinePutAttribute(string template) : base("PUT", template) + public WolverinePutAttribute([StringSyntax("Route")]string template) : base("PUT", template) { } } @@ -144,7 +145,7 @@ public WolverinePutAttribute(string template) : base("PUT", template) /// public class WolverineHeadAttribute : WolverineHttpMethodAttribute { - public WolverineHeadAttribute(string template) : base("HEAD", template) + public WolverineHeadAttribute([StringSyntax("Route")]string template) : base("HEAD", template) { } } @@ -154,7 +155,7 @@ public WolverineHeadAttribute(string template) : base("HEAD", template) /// public class WolverineDeleteAttribute : WolverineHttpMethodAttribute { - public WolverineDeleteAttribute(string template) : base("DELETE", template) + public WolverineDeleteAttribute([StringSyntax("Route")]string template) : base("DELETE", template) { } } @@ -164,7 +165,7 @@ public WolverineDeleteAttribute(string template) : base("DELETE", template) /// public class WolverinePatchAttribute : WolverineHttpMethodAttribute { - public WolverinePatchAttribute(string template) : base("PATCH", template) + public WolverinePatchAttribute([StringSyntax("Route")]string template) : base("PATCH", template) { } } @@ -174,7 +175,7 @@ public WolverinePatchAttribute(string template) : base("PATCH", template) /// public class WolverineOptionsAttribute : WolverineHttpMethodAttribute { - public WolverineOptionsAttribute(string template) : base("OPTIONS", template) + public WolverineOptionsAttribute([StringSyntax("Route")]string template) : base("OPTIONS", template) { } } diff --git a/src/Http/Wolverine.Http/WolverineHttpEndpointRouteBuilderExtensions.cs b/src/Http/Wolverine.Http/WolverineHttpEndpointRouteBuilderExtensions.cs index 1c4146b8c..2214fdf18 100644 --- a/src/Http/Wolverine.Http/WolverineHttpEndpointRouteBuilderExtensions.cs +++ b/src/Http/Wolverine.Http/WolverineHttpEndpointRouteBuilderExtensions.cs @@ -1,3 +1,4 @@ +using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Text.Json; using Lamar; @@ -46,7 +47,7 @@ public static void ConfigureSystemTextJsonForWolverineOrMinimalApi(this IService /// /// /// - public static RouteHandlerBuilder MapPostToWolverine(this IEndpointRouteBuilder endpoints, string url) + public static RouteHandlerBuilder MapPostToWolverine(this IEndpointRouteBuilder endpoints, [StringSyntax("Route")]string url) { var runtime = GetWolverineRuntime(endpoints); var invoker = new Lazy(() => runtime.FindInvoker(typeof(T))); @@ -62,7 +63,7 @@ public static RouteHandlerBuilder MapPostToWolverine(this IEndpointRouteBuild /// /// /// - public static RouteHandlerBuilder MapPutToWolverine(this IEndpointRouteBuilder endpoints, string url) + public static RouteHandlerBuilder MapPutToWolverine(this IEndpointRouteBuilder endpoints, [StringSyntax("Route")]string url) { var runtime = GetWolverineRuntime(endpoints); var invoker = new Lazy(() => runtime.FindInvoker(typeof(T))); @@ -78,7 +79,7 @@ public static RouteHandlerBuilder MapPutToWolverine(this IEndpointRouteBuilde /// /// /// - public static RouteHandlerBuilder MapDeleteToWolverine(this IEndpointRouteBuilder endpoints, string url) + public static RouteHandlerBuilder MapDeleteToWolverine(this IEndpointRouteBuilder endpoints, [StringSyntax("Route")]string url) { var runtime = GetWolverineRuntime(endpoints); var invoker = new Lazy(() => runtime.FindInvoker(typeof(T))); @@ -97,7 +98,7 @@ public static RouteHandlerBuilder MapDeleteToWolverine(this IEndpointRouteBui /// /// public static RouteHandlerBuilder MapPostToWolverine(this IEndpointRouteBuilder endpoints, - string url) + [StringSyntax("Route")] string url) { var runtime = GetWolverineRuntime(endpoints); var invoker = new Lazy(() => runtime.FindInvoker(typeof(TRequest))); @@ -116,7 +117,7 @@ public static RouteHandlerBuilder MapPostToWolverine(this I /// /// public static RouteHandlerBuilder MapPutToWolverine(this IEndpointRouteBuilder endpoints, - string url) + [StringSyntax("Route")] string url) { var runtime = GetWolverineRuntime(endpoints); var invoker = new Lazy(() => runtime.FindInvoker(typeof(TRequest))); @@ -135,7 +136,7 @@ public static RouteHandlerBuilder MapPutToWolverine(this IE /// /// public static RouteHandlerBuilder MapDeleteToWolverine(this IEndpointRouteBuilder endpoints, - string url) + [StringSyntax("Route")] string url) { var runtime = GetWolverineRuntime(endpoints); var invoker = new Lazy(() => runtime.FindInvoker(typeof(TRequest))); diff --git a/src/Transports/Azure/Wolverine.AzureServiceBus/Internal/AzureServiceBusEnvelope.cs b/src/Transports/Azure/Wolverine.AzureServiceBus/Internal/AzureServiceBusEnvelope.cs index 22429df8d..81d8eaea4 100644 --- a/src/Transports/Azure/Wolverine.AzureServiceBus/Internal/AzureServiceBusEnvelope.cs +++ b/src/Transports/Azure/Wolverine.AzureServiceBus/Internal/AzureServiceBusEnvelope.cs @@ -46,7 +46,8 @@ public Task DeadLetterAsync(CancellationToken token, string? deadLetterReason = private ServiceBusReceivedMessage AzureMessage { get; } private ServiceBusSessionReceiver? SessionReceiver { get; } private ServiceBusReceiver? ServiceBusReceiver { get; } - public Exception Exception { get; set; } + + public Exception? Exception { get; set; } public bool IsCompleted { get; set; } public ServiceBusReceiver? Receiver { get; set; } } \ No newline at end of file diff --git a/src/Transports/Pulsar/Wolverine.Pulsar/PulsarListener.cs b/src/Transports/Pulsar/Wolverine.Pulsar/PulsarListener.cs index 62ef97d1b..eaf98c4a1 100644 --- a/src/Transports/Pulsar/Wolverine.Pulsar/PulsarListener.cs +++ b/src/Transports/Pulsar/Wolverine.Pulsar/PulsarListener.cs @@ -79,7 +79,7 @@ public async ValueTask DeferAsync(Envelope envelope) public async ValueTask DisposeAsync() { - _localCancellation.Cancel(); + await _localCancellation.CancelAsync(); if (_consumer != null) { diff --git a/src/Transports/RabbitMQ/Wolverine.RabbitMQ/Internal/RabbitMqTransport.Resource.cs b/src/Transports/RabbitMQ/Wolverine.RabbitMQ/Internal/RabbitMqTransport.Resource.cs index 387499a0f..0fc22ec74 100644 --- a/src/Transports/RabbitMQ/Wolverine.RabbitMQ/Internal/RabbitMqTransport.Resource.cs +++ b/src/Transports/RabbitMQ/Wolverine.RabbitMQ/Internal/RabbitMqTransport.Resource.cs @@ -16,7 +16,7 @@ public bool IsEnabled(LogLevel logLevel) return true; } - public IDisposable BeginScope(TState state) + public IDisposable BeginScope(TState state) where TState: notnull { return new Disposable(); }