From 582d4e4d563279a6a8142f36aaf5ba94bdb06066 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Thu, 23 Feb 2023 10:30:45 -0800 Subject: [PATCH 1/2] Add support for indented text writer to RDG --- ...icrosoft.AspNetCore.Http.Generators.csproj | 1 + .../gen/RequestDelegateGenerator.cs | 51 ++-- .../gen/RequestDelegateGeneratorSources.cs | 2 +- .../Emitters/EndpointEmitter.cs | 62 ++--- .../Emitters/EndpointParameterEmitter.cs | 262 +++++++----------- .../StaticRouteHandlerModel.Emitter.cs | 95 ++++--- ...Param_ComplexReturn_Snapshot.generated.txt | 78 +++--- ...eParam_SimpleReturn_Snapshot.generated.txt | 95 +++---- ...Source_SimpleReturn_Snapshot.generated.txt | 106 ++++--- ...pecialTypeParam_StringReturn.generated.txt | 45 +-- ...ipleStringParam_StringReturn.generated.txt | 61 ++-- ...aram_StringReturn_WithFilter.generated.txt | 45 ++- ...omplexTypeParam_StringReturn.generated.txt | 63 ++--- ...SingleEnumParam_StringReturn.generated.txt | 63 ++--- ...ngValueProvided_StringReturn.generated.txt | 51 ++-- ...ngValueProvided_StringReturn.generated.txt | 13 +- ...ngValueProvided_StringReturn.generated.txt | 13 +- ...ngleStringParam_StringReturn.generated.txt | 13 +- ...leTimeOnlyParam_StringReturn.generated.txt | 59 ++-- ...pAction_NoParam_StringReturn.generated.txt | 90 +++--- ...tion_WithParams_StringReturn.generated.txt | 83 +++--- .../RequestDelegateGeneratorTestBase.cs | 1 - src/Shared/RoslynUtils/CodeWriter.cs | 26 ++ 23 files changed, 695 insertions(+), 683 deletions(-) create mode 100644 src/Shared/RoslynUtils/CodeWriter.cs diff --git a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.Generators.csproj b/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.Generators.csproj index 65cab72b0842..8b051b325eb1 100644 --- a/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.Generators.csproj +++ b/src/Http/Http.Extensions/gen/Microsoft.AspNetCore.Http.Generators.csproj @@ -28,6 +28,7 @@ + diff --git a/src/Http/Http.Extensions/gen/RequestDelegateGenerator.cs b/src/Http/Http.Extensions/gen/RequestDelegateGenerator.cs index 99b337a3df8e..69c792c9437f 100644 --- a/src/Http/Http.Extensions/gen/RequestDelegateGenerator.cs +++ b/src/Http/Http.Extensions/gen/RequestDelegateGenerator.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Globalization; +using System.IO; using System.Linq; using System.Text; using Microsoft.AspNetCore.App.Analyzers.Infrastructure; @@ -86,9 +88,8 @@ public void Initialize(IncrementalGeneratorInitializationContext context) handler.Method); } -{{endpoint.EmitRequestHandler()}} -{{endpoint.EmitFilteredRequestHandler()}} - + {{endpoint.EmitRequestHandler(baseIndent: 5)}} + {{endpoint.EmitFilteredRequestHandler(baseIndent: 5)}} RequestDelegate targetDelegate = filteredInvocation is null ? RequestHandler : RequestHandlerFiltered; var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); @@ -101,28 +102,32 @@ public void Initialize(IncrementalGeneratorInitializationContext context) { var dedupedByDelegate = endpoints.Distinct(EndpointDelegateComparer.Instance); var code = new StringBuilder(); + using var stringWriter = new StringWriter(CultureInfo.InvariantCulture); + using var codeWriter = new CodeWriter(stringWriter, baseIndent: 2); foreach (var endpoint in dedupedByDelegate) { - code.AppendLine($$""" - internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder {{endpoint.HttpMethod}}( - this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, - [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern, - global::{{endpoint.EmitHandlerDelegateType()}} handler, - [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "", - [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) - { - return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - {{endpoint.EmitVerb()}}, - filePath, - lineNumber); - } -"""); - } - - return code.ToString(); + codeWriter.WriteLine($"internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder {endpoint.HttpMethod}("); + codeWriter.Indent++; + codeWriter.WriteLine("this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints,"); + codeWriter.WriteLine(@"[global::System.Diagnostics.CodeAnalysis.StringSyntax(""Route"")] string pattern,"); + codeWriter.WriteLine($"global::{endpoint.EmitHandlerDelegateType()} handler,"); + codeWriter.WriteLine(@"[global::System.Runtime.CompilerServices.CallerFilePath] string filePath = """","); + codeWriter.WriteLine("[global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0)"); + codeWriter.Indent--; + codeWriter.StartBlock(); + codeWriter.WriteLine("return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore("); + codeWriter.Indent++; + codeWriter.WriteLine("endpoints,"); + codeWriter.WriteLine("pattern,"); + codeWriter.WriteLine("handler,"); + codeWriter.WriteLine($"{endpoint.EmitVerb()},"); + codeWriter.WriteLine("filePath,"); + codeWriter.WriteLine("lineNumber);"); + codeWriter.Indent--; + codeWriter.EndBlock(); + } + + return stringWriter.ToString(); }); var thunksAndEndpoints = thunks.Collect().Combine(stronglyTypedEndpointDefinitions); diff --git a/src/Http/Http.Extensions/gen/RequestDelegateGeneratorSources.cs b/src/Http/Http.Extensions/gen/RequestDelegateGeneratorSources.cs index 6d7f46f0699c..51bc57e63dd2 100644 --- a/src/Http/Http.Extensions/gen/RequestDelegateGeneratorSources.cs +++ b/src/Http/Http.Extensions/gen/RequestDelegateGeneratorSources.cs @@ -1570,7 +1570,7 @@ internal static class GenerateRouteBuilderEndpoints private static readonly string[] DeleteVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Delete }; private static readonly string[] PatchVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Patch }; -{{endpoints}} + {{endpoints}} } """ : string.Empty; } diff --git a/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointEmitter.cs b/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointEmitter.cs index 28ba68a9e5dd..a1f75435f60e 100644 --- a/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointEmitter.cs +++ b/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointEmitter.cs @@ -3,54 +3,44 @@ using System; using System.Linq; +using System.Globalization; +using System.IO; using System.Text; namespace Microsoft.AspNetCore.Http.Generators.StaticRouteHandlerModel.Emitters; internal static class EndpointEmitter { - internal static string EmitParameterPreparation(this Endpoint endpoint) + internal static string EmitParameterPreparation(this Endpoint endpoint, int baseIndent = 0) { - var parameterPreparationBuilder = new StringBuilder(); + using var stringWriter = new StringWriter(CultureInfo.InvariantCulture); + using var parameterPreparationBuilder = new CodeWriter(stringWriter, baseIndent); - for (var parameterIndex = 0; parameterIndex < endpoint.Parameters.Length; parameterIndex++) + foreach (var parameter in endpoint.Parameters) { - var parameter = endpoint.Parameters[parameterIndex]; - - var parameterPreparationCode = parameter switch - { - { - Source: EndpointParameterSource.SpecialType - } => parameter.EmitSpecialParameterPreparation(), - { - Source: EndpointParameterSource.Query or EndpointParameterSource.Header, - } => parameter.EmitQueryOrHeaderParameterPreparation(), - { - Source: EndpointParameterSource.Route, - } => parameter.EmitRouteParameterPreparation(), - { - Source: EndpointParameterSource.RouteOrQuery - } => parameter.EmitRouteOrQueryParameterPreparation(), - { - Source: EndpointParameterSource.JsonBody - } => parameter.EmitJsonBodyParameterPreparationString(), - { - Source: EndpointParameterSource.Service - } => parameter.EmitServiceParameterPreparation(), - _ => throw new Exception("Unreachable!") - }; - - // To avoid having two newlines after the block of parameter handling code. - if (parameterIndex < endpoint.Parameters.Length - 1) - { - parameterPreparationBuilder.AppendLine(parameterPreparationCode); - } - else + switch (parameter) { - parameterPreparationBuilder.Append(parameterPreparationCode); + case { Source: EndpointParameterSource.SpecialType }: + parameter.EmitSpecialParameterPreparation(parameterPreparationBuilder); + break; + case { Source: EndpointParameterSource.Query or EndpointParameterSource.Header }: + parameter.EmitQueryOrHeaderParameterPreparation(parameterPreparationBuilder); + break; + case { Source: EndpointParameterSource.Route }: + parameter.EmitRouteParameterPreparation(parameterPreparationBuilder); + break; + case { Source: EndpointParameterSource.RouteOrQuery }: + parameter.EmitRouteOrQueryParameterPreparation(parameterPreparationBuilder); + break; + case { Source: EndpointParameterSource.JsonBody }: + parameter.EmitJsonBodyParameterPreparationString(parameterPreparationBuilder); + break; + case { Source: EndpointParameterSource.Service }: + parameter.EmitServiceParameterPreparation(parameterPreparationBuilder); + break; } } - return parameterPreparationBuilder.ToString(); + return stringWriter.ToString(); } public static string EmitArgumentList(this Endpoint endpoint) => string.Join(", ", endpoint.Parameters.Select(p => p.EmitArgument())); diff --git a/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointParameterEmitter.cs b/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointParameterEmitter.cs index 8de76e326ce9..dbe32c8d1988 100644 --- a/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointParameterEmitter.cs +++ b/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointParameterEmitter.cs @@ -8,26 +8,17 @@ namespace Microsoft.AspNetCore.Http.Generators.StaticRouteHandlerModel.Emitters; internal static class EndpointParameterEmitter { - internal static string EmitSpecialParameterPreparation(this EndpointParameter endpointParameter) - { - return $""" - var {endpointParameter.EmitHandlerArgument()} = {endpointParameter.AssigningCode}; -"""; - } + internal static void EmitSpecialParameterPreparation(this EndpointParameter endpointParameter, CodeWriter codeWriter) + => codeWriter.WriteLine($"var {endpointParameter.EmitHandlerArgument()} = {endpointParameter.AssigningCode};"); - internal static string EmitQueryOrHeaderParameterPreparation(this EndpointParameter endpointParameter) + internal static void EmitQueryOrHeaderParameterPreparation(this EndpointParameter endpointParameter, CodeWriter codeWriter) { - var builder = new StringBuilder(); - builder.AppendLine($""" - {endpointParameter.EmitParameterDiagnosticComment()} -"""); + codeWriter.WriteLine(endpointParameter.EmitParameterDiagnosticComment()); var assigningCode = endpointParameter.Source is EndpointParameterSource.Header ? $"httpContext.Request.Headers[\"{endpointParameter.Name}\"]" : $"httpContext.Request.Query[\"{endpointParameter.Name}\"]"; - builder.AppendLine($$""" - var {{endpointParameter.EmitAssigningCodeResult()}} = {{assigningCode}}; -"""); + codeWriter.WriteLine($"var {endpointParameter.EmitAssigningCodeResult()} = {assigningCode};"); // If we are not optional, then at this point we can just assign the string value to the handler argument, // otherwise we need to detect whether no value is provided and set the handler argument to null to @@ -35,177 +26,124 @@ internal static string EmitQueryOrHeaderParameterPreparation(this EndpointParame // compiler errors around null handling. if (endpointParameter.IsOptional) { - builder.AppendLine($$""" - var {{endpointParameter.Name}}_temp = {{endpointParameter.EmitAssigningCodeResult()}}.Count > 0 ? {{endpointParameter.Name}}_raw.ToString() : null; -"""); + codeWriter.WriteLine($"var {endpointParameter.EmitTempArgument()} = {endpointParameter.EmitAssigningCodeResult()}.Count > 0 ? {endpointParameter.EmitAssigningCodeResult()}.ToString() : null;"); } else { - builder.AppendLine($$""" - if (StringValues.IsNullOrEmpty({{endpointParameter.EmitAssigningCodeResult()}})) - { - wasParamCheckFailure = true; - } - var {{endpointParameter.Name}}_temp = {{endpointParameter.EmitAssigningCodeResult()}}.ToString(); -"""); + codeWriter.WriteLine($"if (StringValues.IsNullOrEmpty({endpointParameter.EmitAssigningCodeResult()}))"); + codeWriter.StartBlock(); + codeWriter.WriteLine("wasParamCheckFailure = true;"); + codeWriter.EndBlock(); + codeWriter.WriteLine($"var {endpointParameter.EmitTempArgument()} = {endpointParameter.EmitAssigningCodeResult()}.ToString();"); } - builder.Append(endpointParameter.EmitParsingBlock()); - - return builder.ToString(); + endpointParameter.EmitParsingBlock(codeWriter); } - internal static string EmitParsingBlock(this EndpointParameter endpointParameter) + internal static void EmitParsingBlock(this EndpointParameter endpointParameter, CodeWriter codeWriter) { - var builder = new StringBuilder(); - if (endpointParameter.IsParsable) { - var parsingBlock = endpointParameter.ParsingBlockEmitter($"{endpointParameter.Name}_temp", $"{endpointParameter.Name}_parsed_temp"); - builder.AppendLine($$""" -{{parsingBlock}} - {{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}} {{endpointParameter.EmitHandlerArgument()}} = {{endpointParameter.Name}}_parsed_temp!; -"""); - + var parsingBlock = endpointParameter.ParsingBlockEmitter(endpointParameter.EmitTempArgument(), endpointParameter.EmitParsedTempArgument()); + codeWriter.WriteLine(parsingBlock); + codeWriter.WriteLine($"{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {endpointParameter.EmitHandlerArgument()} = {endpointParameter.Name}_parsed_temp!;"); } else { - builder.AppendLine($$""" - {{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)}} {{endpointParameter.EmitHandlerArgument()}} = {{endpointParameter.Name}}_temp!; -"""); - + codeWriter.WriteLine($"{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {endpointParameter.EmitHandlerArgument()} = {endpointParameter.Name}_temp!;"); } - - return builder.ToString(); } - internal static string EmitRouteParameterPreparation(this EndpointParameter endpointParameter) - { - var builder = new StringBuilder(); - builder.AppendLine($""" - {endpointParameter.EmitParameterDiagnosticComment()} -"""); - - // Throw an exception of if the route parameter name that was specific in the `FromRoute` - // attribute or in the parameter name does not appear in the actual route. - builder.AppendLine($$""" - if (options?.RouteParameterNames?.Contains("{{endpointParameter.Name}}", StringComparer.OrdinalIgnoreCase) != true) - { - throw new InvalidOperationException($"'{{endpointParameter.Name}}' is not a route parameter."); - } -"""); - - var assigningCode = $"httpContext.Request.RouteValues[\"{endpointParameter.Name}\"]?.ToString()"; - builder.AppendLine($$""" - var {{endpointParameter.EmitAssigningCodeResult()}} = {{assigningCode}}; -"""); - - if (!endpointParameter.IsOptional) - { - builder.AppendLine($$""" - if ({{endpointParameter.EmitAssigningCodeResult()}} == null) - { - wasParamCheckFailure = true; - } -"""); - } - builder.AppendLine($""" - var {endpointParameter.EmitHandlerArgument()} = {endpointParameter.EmitAssigningCodeResult()}; -"""); - - return builder.ToString(); - } + internal static void EmitRouteParameterPreparation(this EndpointParameter endpointParameter, CodeWriter codeWriter) + { + codeWriter.WriteLine(endpointParameter.EmitParameterDiagnosticComment()); - internal static string EmitRouteOrQueryParameterPreparation(this EndpointParameter endpointParameter) - { - var builder = new StringBuilder(); - builder.AppendLine($""" - {endpointParameter.EmitParameterDiagnosticComment()} -"""); - - var parameterName = endpointParameter.Name; - var assigningCode = $@"options?.RouteParameterNames?.Contains(""{parameterName}"", StringComparer.OrdinalIgnoreCase) == true"; - assigningCode += $@"? new StringValues(httpContext.Request.RouteValues[$""{parameterName}""]?.ToString())"; - assigningCode += $@": httpContext.Request.Query[$""{parameterName}""];"; - - builder.AppendLine($$""" - var {{endpointParameter.EmitAssigningCodeResult()}} = {{assigningCode}}; -"""); - - if (!endpointParameter.IsOptional) - { - builder.AppendLine($$""" - if ({{endpointParameter.EmitAssigningCodeResult()}} is StringValues { Count: 0 }) - { - wasParamCheckFailure = true; - } -"""); - } - - builder.AppendLine($""" - var {endpointParameter.EmitHandlerArgument()} = {endpointParameter.EmitAssigningCodeResult()}; -"""); - - return builder.ToString(); - } + // Throw an exception of if the route parameter name that was specific in the `FromRoute` + // attribute or in the parameter name does not appear in the actual route. + codeWriter.WriteLine($"""if (options?.RouteParameterNames?.Contains("{endpointParameter.Name}", StringComparer.OrdinalIgnoreCase) != true)"""); + codeWriter.StartBlock(); + codeWriter.WriteLine($$"""throw new InvalidOperationException($"'{{endpointParameter.Name}}' is not a route parameter.");"""); + codeWriter.EndBlock(); + + var assigningCode = $"httpContext.Request.RouteValues[\"{endpointParameter.Name}\"]?.ToString()"; + codeWriter.WriteLine($"var {endpointParameter.EmitAssigningCodeResult()} = {assigningCode};"); - internal static string EmitJsonBodyParameterPreparationString(this EndpointParameter endpointParameter) + if (!endpointParameter.IsOptional) { - var builder = new StringBuilder(); - builder.AppendLine($""" - {endpointParameter.EmitParameterDiagnosticComment()} -"""); - - var assigningCode = $"await GeneratedRouteBuilderExtensionsCore.TryResolveBody<{endpointParameter.Type.ToDisplayString(EmitterConstants.DisplayFormat)}>(httpContext, {(endpointParameter.IsOptional ? "true" : "false")})"; - builder.AppendLine($$""" - var (isSuccessful, {{endpointParameter.EmitHandlerArgument()}}) = {{assigningCode}}; -"""); - - // If binding from the JSON body fails, we exit early. Don't - // set the status code here because assume it has been set by the - // TryResolveBody method. - builder.AppendLine(""" - if (!isSuccessful) - { - return; - } -"""); - - return builder.ToString(); + codeWriter.WriteLine($"if ({endpointParameter.EmitAssigningCodeResult()} == null)"); + codeWriter.StartBlock(); + codeWriter.WriteLine("wasParamCheckFailure = true;"); + codeWriter.EndBlock(); } - internal static string EmitServiceParameterPreparation(this EndpointParameter endpointParameter) + codeWriter.WriteLine($"var {endpointParameter.EmitHandlerArgument()} = {endpointParameter.EmitAssigningCodeResult()};"); + } + + internal static void EmitRouteOrQueryParameterPreparation(this EndpointParameter endpointParameter, CodeWriter codeWriter) + { + codeWriter.WriteLine(endpointParameter.EmitParameterDiagnosticComment()); + + var parameterName = endpointParameter.Name; + codeWriter.Write($"var {endpointParameter.EmitAssigningCodeResult()} = "); + codeWriter.Write($@"options?.RouteParameterNames?.Contains(""{parameterName}"", StringComparer.OrdinalIgnoreCase) == true"); + codeWriter.WriteLine($@"? new StringValues(httpContext.Request.RouteValues[$""{parameterName}""]?.ToString())"); + codeWriter.WriteLine($@": httpContext.Request.Query[$""{parameterName}""];"); + + if (!endpointParameter.IsOptional) { - var builder = new StringBuilder(); - - // Preamble for diagnostics purposes. - builder.AppendLine($""" - {endpointParameter.EmitParameterDiagnosticComment()} -"""); - - // Requiredness checks for services are handled by the distinction - // between GetRequiredService and GetService in the assigningCode. - // Unlike other scenarios, this will result in an exception being thrown - // at runtime. - var assigningCode = endpointParameter.IsOptional ? - $"httpContext.RequestServices.GetService<{endpointParameter.Type}>();" : - $"httpContext.RequestServices.GetRequiredService<{endpointParameter.Type}>()"; - - builder.AppendLine($$""" - var {{endpointParameter.EmitHandlerArgument()}} = {{assigningCode}}; -"""); - - return builder.ToString(); + codeWriter.WriteLine($"if ({endpointParameter.EmitAssigningCodeResult()} is StringValues {{ Count: 0 }})"); + codeWriter.StartBlock(); + codeWriter.WriteLine("wasParamCheckFailure = true;"); + codeWriter.EndBlock(); } - private static string EmitParameterDiagnosticComment(this EndpointParameter endpointParameter) => $"// Endpoint Parameter: {endpointParameter.Name} (Type = {endpointParameter.Type}, IsOptional = {endpointParameter.IsOptional}, IsParsable = {endpointParameter.IsParsable}, Source = {endpointParameter.Source})"; - private static string EmitHandlerArgument(this EndpointParameter endpointParameter) => $"{endpointParameter.Name}_local"; - private static string EmitAssigningCodeResult(this EndpointParameter endpointParameter) => $"{endpointParameter.Name}_raw"; + codeWriter.WriteLine($"var {endpointParameter.EmitHandlerArgument()} = {endpointParameter.EmitAssigningCodeResult()};"); + } - public static string EmitArgument(this EndpointParameter endpointParameter) => endpointParameter.Source switch - { - EndpointParameterSource.JsonBody or EndpointParameterSource.Route or EndpointParameterSource.RouteOrQuery => endpointParameter.IsOptional ? endpointParameter.EmitHandlerArgument() : $"{endpointParameter.EmitHandlerArgument()}!", - EndpointParameterSource.Unknown => throw new Exception("Unreachable!"), - _ => endpointParameter.EmitHandlerArgument() - }; + internal static void EmitJsonBodyParameterPreparationString(this EndpointParameter endpointParameter, CodeWriter codeWriter) + { + // Preamble for diagnostics purposes. + codeWriter.WriteLine(endpointParameter.EmitParameterDiagnosticComment()); + + // Invoke TryResolveBody method to parse JSON and set + // status codes on exceptions. + var assigningCode = $"await GeneratedRouteBuilderExtensionsCore.TryResolveBody<{endpointParameter.Type.ToDisplayString(EmitterConstants.DisplayFormat)}>(httpContext, {(endpointParameter.IsOptional ? "true" : "false")})"; + codeWriter.WriteLine($"var (isSuccessful, {endpointParameter.EmitHandlerArgument()}) = {assigningCode};"); + + // If binding from the JSON body fails, we exit early. Don't + // set the status code here because assume it has been set by the + // TryResolveBody method. + codeWriter.WriteLine("if (!isSuccessful)"); + codeWriter.StartBlock(); + codeWriter.WriteLine("return;"); + codeWriter.EndBlock(); } + + internal static void EmitServiceParameterPreparation(this EndpointParameter endpointParameter, CodeWriter codeWriter) + { + codeWriter.WriteLine(endpointParameter.EmitParameterDiagnosticComment()); + + // Requiredness checks for services are handled by the distinction + // between GetRequiredService and GetService in the assigningCode. + // Unlike other scenarios, this will result in an exception being thrown + // at runtime. + var assigningCode = endpointParameter.IsOptional ? + $"httpContext.RequestServices.GetService<{endpointParameter.Type}>();" : + $"httpContext.RequestServices.GetRequiredService<{endpointParameter.Type}>()"; + codeWriter.WriteLine($"var {endpointParameter.EmitHandlerArgument()} = {assigningCode};"); + } + + private static string EmitParameterDiagnosticComment(this EndpointParameter endpointParameter) => $"// Endpoint Parameter: {endpointParameter.Name} (Type = {endpointParameter.Type}, IsOptional = {endpointParameter.IsOptional}, IsParsable = {endpointParameter.IsParsable}, Source = {endpointParameter.Source})"; + private static string EmitHandlerArgument(this EndpointParameter endpointParameter) => $"{endpointParameter.Name}_local"; + private static string EmitTempArgument(this EndpointParameter endpointParameter) => $"{endpointParameter.Name}_temp"; + + private static string EmitParsedTempArgument(this EndpointParameter endpointParameter) => $"{endpointParameter.Name}_parsed_temp"; + private static string EmitAssigningCodeResult(this EndpointParameter endpointParameter) => $"{endpointParameter.Name}_raw"; + + public static string EmitArgument(this EndpointParameter endpointParameter) => endpointParameter.Source switch + { + EndpointParameterSource.JsonBody or EndpointParameterSource.Route or EndpointParameterSource.RouteOrQuery => endpointParameter.IsOptional ? endpointParameter.EmitHandlerArgument() : $"{endpointParameter.EmitHandlerArgument()}!", + EndpointParameterSource.Unknown => throw new Exception("Unreachable!"), + _ => endpointParameter.EmitHandlerArgument() + }; +} diff --git a/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/StaticRouteHandlerModel.Emitter.cs b/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/StaticRouteHandlerModel.Emitter.cs index 4a606629b005..a4904fb65fa3 100644 --- a/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/StaticRouteHandlerModel.Emitter.cs +++ b/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/StaticRouteHandlerModel.Emitter.cs @@ -2,6 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.CodeDom.Compiler; +using System.Globalization; +using System.IO; using System.Linq; using System.Text; using Microsoft.AspNetCore.Http.Generators.StaticRouteHandlerModel.Emitters; @@ -78,30 +81,42 @@ public static string EmitVerb(this Endpoint endpoint) * their validity (optionality), invoke the underlying handler with * the arguments bound from HTTP context, and write out the response. */ - public static string EmitRequestHandler(this Endpoint endpoint) + public static string EmitRequestHandler(this Endpoint endpoint, int baseIndent = 0) { - var handlerSignature = endpoint.IsAwaitable ? "async Task RequestHandler(HttpContext httpContext)" : "Task RequestHandler(HttpContext httpContext)"; - var resultAssignment = endpoint.Response.IsVoid ? string.Empty : "var result = "; - var awaitHandler = endpoint.Response.IsAwaitable ? "await " : string.Empty; - var setContentType = endpoint.Response.IsVoid ? string.Empty : $@"httpContext.Response.ContentType ??= ""{endpoint.Response.ContentType}"";"; - - var requestHandlerSource = $$""" - {{handlerSignature}} - { - var wasParamCheckFailure = false; -{{endpoint.EmitParameterPreparation()}} - if (wasParamCheckFailure) - { - httpContext.Response.StatusCode = 400; - {{(endpoint.IsAwaitable ? "return;" : "return Task.CompletedTask;")}} - } - {{setContentType}} - {{resultAssignment}}{{awaitHandler}}handler({{endpoint.EmitArgumentList()}}); - {{(endpoint.Response.IsVoid ? "return Task.CompletedTask;" : endpoint.EmitResponseWritingCall())}} - } -"""; + using var stringWriter = new StringWriter(CultureInfo.InvariantCulture); + using var codeWriter = new CodeWriter(stringWriter, baseIndent); + + codeWriter.WriteLine(endpoint.IsAwaitable ? "async Task RequestHandler(HttpContext httpContext)" : "Task RequestHandler(HttpContext httpContext)"); + codeWriter.StartBlock(); // Start handler method block + codeWriter.WriteLine("var wasParamCheckFailure = false;"); + + if (endpoint.Parameters.Length > 0) + { + codeWriter.WriteLine(endpoint.EmitParameterPreparation(codeWriter.Indent)); + } - return requestHandlerSource; + codeWriter.WriteLine("if (wasParamCheckFailure)"); + codeWriter.StartBlock(); // Start if-statement block + codeWriter.WriteLine("httpContext.Response.StatusCode = 400;"); + codeWriter.WriteLine(endpoint.IsAwaitable ? "return;" : "return Task.CompletedTask;"); + codeWriter.EndBlock(); // End if-statement block + if (!endpoint.Response.IsVoid) + { + codeWriter.WriteLine($@"httpContext.Response.ContentType ??= ""{endpoint.Response.ContentType}"";"); + } + if (!endpoint.Response.IsVoid) + { + codeWriter.Write("var result = "); + } + if (endpoint.Response.IsAwaitable) + { + codeWriter.Write("await "); + } + codeWriter.WriteLine($"handler({endpoint.EmitArgumentList()});"); + codeWriter.WriteLine(endpoint.Response.IsVoid ? "return Task.CompletedTask;" : endpoint.EmitResponseWritingCall()); + codeWriter.EndBlock(); // End handler method block + + return stringWriter.ToString(); } private static string EmitResponseWritingCall(this Endpoint endpoint) @@ -141,25 +156,33 @@ private static string EmitResponseWritingCall(this Endpoint endpoint) * can be used to reduce the boxing that happens at runtime when constructing * the context object. */ - public static string EmitFilteredRequestHandler(this Endpoint endpoint) + public static string EmitFilteredRequestHandler(this Endpoint endpoint, int baseIndent = 0) { var argumentList = endpoint.Parameters.Length == 0 ? string.Empty : $", {endpoint.EmitArgumentList()}"; var invocationConstructor = endpoint.Parameters.Length == 0 ? "DefaultEndpointFilterInvocationContext" : "EndpointFilterInvocationContext"; var invocationGenericArgs = endpoint.Parameters.Length == 0 ? string.Empty : $"<{endpoint.EmitFilterInvocationContextTypeArgs()}>"; - return $$""" - async Task RequestHandlerFiltered(HttpContext httpContext) - { - var wasParamCheckFailure = false; -{{endpoint.EmitParameterPreparation()}} - if (wasParamCheckFailure) - { - httpContext.Response.StatusCode = 400; - } - var result = await filteredInvocation(new {{invocationConstructor}}{{invocationGenericArgs}}(httpContext{{argumentList}})); - await GeneratedRouteBuilderExtensionsCore.ExecuteObjectResult(result, httpContext); - } -"""; + using var stringWriter = new StringWriter(CultureInfo.InvariantCulture); + using var codeWriter = new CodeWriter(stringWriter, baseIndent); + + codeWriter.WriteLine("async Task RequestHandlerFiltered(HttpContext httpContext)"); + codeWriter.StartBlock(); // Start handler method block + codeWriter.WriteLine("var wasParamCheckFailure = false;"); + + if (endpoint.Parameters.Length > 0) + { + codeWriter.WriteLine(endpoint.EmitParameterPreparation(codeWriter.Indent)); + } + + codeWriter.WriteLine("if (wasParamCheckFailure)"); + codeWriter.StartBlock(); // Start if-statement block + codeWriter.WriteLine("httpContext.Response.StatusCode = 400;"); + codeWriter.EndBlock(); // End if-statement block + codeWriter.WriteLine($"var result = await filteredInvocation(new {invocationConstructor}{invocationGenericArgs}(httpContext{argumentList}));"); + codeWriter.WriteLine("await GeneratedRouteBuilderExtensionsCore.ExecuteObjectResult(result, httpContext);"); + codeWriter.EndBlock(); // End handler method block + + return stringWriter.ToString(); } public static string EmitFilteredInvocation(this Endpoint endpoint) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitBodyParam_ComplexReturn_Snapshot.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitBodyParam_ComplexReturn_Snapshot.generated.txt index f4ac18fd7cb1..2771fe401bb0 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitBodyParam_ComplexReturn_Snapshot.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitBodyParam_ComplexReturn_Snapshot.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -40,17 +40,17 @@ namespace Microsoft.AspNetCore.Builder internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapPost( this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern, - global::System.Func> handler, + global::System.Func> handler, [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - PostVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + PostVerb, + filePath, + lineNumber); } } @@ -85,16 +85,16 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 18)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 18)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => { - var handler = (Func>)del; + var handler = (Func>)del; EndpointFilterDelegate? filteredInvocation = null; if (options?.EndpointBuilder?.FilterFactories.Count > 0) @@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Http.Generated { return ValueTask.FromResult(Results.Empty); } - return ValueTask.FromResult(handler(ic.GetArgument(0))); + return ValueTask.FromResult(handler(ic.GetArgument(0))); }, options.EndpointBuilder, handler.Method); @@ -114,8 +114,8 @@ namespace Microsoft.AspNetCore.Http.Generated async Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: todo (Type = global::Microsoft.AspNetCore.Http.Generators.Tests.Todo, IsOptional = False, Source = JsonBody) - var (isSuccessful, todo_local) = await GeneratedRouteBuilderExtensionsCore.TryResolveBody(httpContext, false); + // Endpoint Parameter: todo (Type = Todo, IsOptional = False, IsParsable = False, Source = JsonBody) + var (isSuccessful, todo_local) = await GeneratedRouteBuilderExtensionsCore.TryResolveBody(httpContext, false); if (!isSuccessful) { return; @@ -130,11 +130,12 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(todo_local!); await result.ExecuteAsync(httpContext); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: todo (Type = global::Microsoft.AspNetCore.Http.Generators.Tests.Todo, IsOptional = False, Source = JsonBody) - var (isSuccessful, todo_local) = await GeneratedRouteBuilderExtensionsCore.TryResolveBody(httpContext, false); + // Endpoint Parameter: todo (Type = Todo, IsOptional = False, IsParsable = False, Source = JsonBody) + var (isSuccessful, todo_local) = await GeneratedRouteBuilderExtensionsCore.TryResolveBody(httpContext, false); if (!isSuccessful) { return; @@ -144,7 +145,7 @@ namespace Microsoft.AspNetCore.Http.Generated { httpContext.Response.StatusCode = 400; } - var result = await filteredInvocation(new EndpointFilterInvocationContext(httpContext, todo_local!)); + var result = await filteredInvocation(new EndpointFilterInvocationContext(httpContext, todo_local!)); await GeneratedRouteBuilderExtensionsCore.ExecuteObjectResult(result, httpContext); } @@ -152,16 +153,16 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 20)] = ( + [(@"TestMapActions.cs", 25)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 20)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 25)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => { - var handler = (Func>)del; + var handler = (Func>)del; EndpointFilterDelegate? filteredInvocation = null; if (options?.EndpointBuilder?.FilterFactories.Count > 0) @@ -172,7 +173,7 @@ namespace Microsoft.AspNetCore.Http.Generated { return ValueTask.FromResult(Results.Empty); } - return ValueTask.FromResult(handler(ic.GetArgument(0))); + return ValueTask.FromResult(handler(ic.GetArgument(0))); }, options.EndpointBuilder, handler.Method); @@ -181,8 +182,8 @@ namespace Microsoft.AspNetCore.Http.Generated async Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: todo (Type = global::Microsoft.AspNetCore.Http.Generators.Tests.Todo?, IsOptional = True, Source = JsonBody) - var (isSuccessful, todo_local) = await GeneratedRouteBuilderExtensionsCore.TryResolveBody(httpContext, true); + // Endpoint Parameter: todo (Type = Todo?, IsOptional = True, IsParsable = False, Source = JsonBody) + var (isSuccessful, todo_local) = await GeneratedRouteBuilderExtensionsCore.TryResolveBody(httpContext, true); if (!isSuccessful) { return; @@ -197,11 +198,12 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(todo_local); await result.ExecuteAsync(httpContext); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: todo (Type = global::Microsoft.AspNetCore.Http.Generators.Tests.Todo?, IsOptional = True, Source = JsonBody) - var (isSuccessful, todo_local) = await GeneratedRouteBuilderExtensionsCore.TryResolveBody(httpContext, true); + // Endpoint Parameter: todo (Type = Todo?, IsOptional = True, IsParsable = False, Source = JsonBody) + var (isSuccessful, todo_local) = await GeneratedRouteBuilderExtensionsCore.TryResolveBody(httpContext, true); if (!isSuccessful) { return; @@ -211,7 +213,7 @@ namespace Microsoft.AspNetCore.Http.Generated { httpContext.Response.StatusCode = 400; } - var result = await filteredInvocation(new EndpointFilterInvocationContext(httpContext, todo_local)); + var result = await filteredInvocation(new EndpointFilterInvocationContext(httpContext, todo_local)); await GeneratedRouteBuilderExtensionsCore.ExecuteObjectResult(result, httpContext); } @@ -302,7 +304,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -408,7 +410,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -521,7 +523,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -641,7 +643,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -768,7 +770,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -902,7 +904,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -1043,7 +1045,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1191,7 +1193,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1346,7 +1348,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1508,7 +1510,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1677,4 +1679,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitServiceParam_SimpleReturn_Snapshot.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitServiceParam_SimpleReturn_Snapshot.generated.txt index f935d15fd92a..451dedaf7018 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitServiceParam_SimpleReturn_Snapshot.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitServiceParam_SimpleReturn_Snapshot.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet( this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, @@ -60,12 +60,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet( this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, @@ -75,12 +75,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -115,11 +115,11 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 18)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 18)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -144,7 +144,7 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: svc (Type = global::Microsoft.AspNetCore.Http.Generators.Tests.TestService, IsOptional = False, Source = Service) + // Endpoint Parameter: svc (Type = Microsoft.AspNetCore.Http.Generators.Tests.TestService, IsOptional = False, IsParsable = False, Source = Service) var svc_local = httpContext.RequestServices.GetRequiredService(); if (wasParamCheckFailure) @@ -156,10 +156,11 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(svc_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: svc (Type = global::Microsoft.AspNetCore.Http.Generators.Tests.TestService, IsOptional = False, Source = Service) + // Endpoint Parameter: svc (Type = Microsoft.AspNetCore.Http.Generators.Tests.TestService, IsOptional = False, IsParsable = False, Source = Service) var svc_local = httpContext.RequestServices.GetRequiredService(); if (wasParamCheckFailure) @@ -174,11 +175,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 19)] = ( + [(@"TestMapActions.cs", 24)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 19)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 24)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -203,7 +204,7 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: svc (Type = global::System.Collections.Generic.IEnumerable, IsOptional = False, Source = Service) + // Endpoint Parameter: svc (Type = System.Collections.Generic.IEnumerable, IsOptional = False, IsParsable = False, Source = Service) var svc_local = httpContext.RequestServices.GetRequiredService>(); if (wasParamCheckFailure) @@ -215,10 +216,11 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(svc_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: svc (Type = global::System.Collections.Generic.IEnumerable, IsOptional = False, Source = Service) + // Endpoint Parameter: svc (Type = System.Collections.Generic.IEnumerable, IsOptional = False, IsParsable = False, Source = Service) var svc_local = httpContext.RequestServices.GetRequiredService>(); if (wasParamCheckFailure) @@ -233,11 +235,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 20)] = ( + [(@"TestMapActions.cs", 25)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 20)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 25)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -262,10 +264,9 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: svc (Type = global::Microsoft.AspNetCore.Http.Generators.Tests.TestService?, IsOptional = True, Source = Service) + // Endpoint Parameter: svc (Type = Microsoft.AspNetCore.Http.Generators.Tests.TestService?, IsOptional = True, IsParsable = False, Source = Service) var svc_local = httpContext.RequestServices.GetService();; - - // Endpoint Parameter: svcs (Type = global::System.Collections.Generic.IEnumerable, IsOptional = False, Source = Service) + // Endpoint Parameter: svcs (Type = System.Collections.Generic.IEnumerable, IsOptional = False, IsParsable = False, Source = Service) var svcs_local = httpContext.RequestServices.GetRequiredService>(); if (wasParamCheckFailure) @@ -277,13 +278,13 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(svc_local, svcs_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: svc (Type = global::Microsoft.AspNetCore.Http.Generators.Tests.TestService?, IsOptional = True, Source = Service) + // Endpoint Parameter: svc (Type = Microsoft.AspNetCore.Http.Generators.Tests.TestService?, IsOptional = True, IsParsable = False, Source = Service) var svc_local = httpContext.RequestServices.GetService();; - - // Endpoint Parameter: svcs (Type = global::System.Collections.Generic.IEnumerable, IsOptional = False, Source = Service) + // Endpoint Parameter: svcs (Type = System.Collections.Generic.IEnumerable, IsOptional = False, IsParsable = False, Source = Service) var svcs_local = httpContext.RequestServices.GetRequiredService>(); if (wasParamCheckFailure) @@ -381,7 +382,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -487,7 +488,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -600,7 +601,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -720,7 +721,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -847,7 +848,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -981,7 +982,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -1122,7 +1123,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1270,7 +1271,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1425,7 +1426,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1587,7 +1588,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1756,4 +1757,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitSource_SimpleReturn_Snapshot.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitSource_SimpleReturn_Snapshot.generated.txt index 6ce289c79b34..d72e5aa74fa4 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitSource_SimpleReturn_Snapshot.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitSource_SimpleReturn_Snapshot.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -63,6 +63,7 @@ namespace Microsoft.AspNetCore.Http.Generated using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; + using System.Globalization; using System.Linq; using System.Reflection; using System.Threading.Tasks; @@ -84,11 +85,11 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 18)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 18)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -113,13 +114,14 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: queryValue (Type = global::System.String, IsOptional = False, Source = Query) + // Endpoint Parameter: queryValue (Type = string, IsOptional = False, IsParsable = False, Source = Query) var queryValue_raw = httpContext.Request.Query["queryValue"]; if (StringValues.IsNullOrEmpty(queryValue_raw)) { wasParamCheckFailure = true; } - var queryValue_local = queryValue_raw.ToString(); + var queryValue_temp = queryValue_raw.ToString(); + string queryValue_local = queryValue_temp!; if (wasParamCheckFailure) { @@ -130,16 +132,18 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(queryValue_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: queryValue (Type = global::System.String, IsOptional = False, Source = Query) + // Endpoint Parameter: queryValue (Type = string, IsOptional = False, IsParsable = False, Source = Query) var queryValue_raw = httpContext.Request.Query["queryValue"]; if (StringValues.IsNullOrEmpty(queryValue_raw)) { wasParamCheckFailure = true; } - var queryValue_local = queryValue_raw.ToString(); + var queryValue_temp = queryValue_raw.ToString(); + string queryValue_local = queryValue_temp!; if (wasParamCheckFailure) { @@ -153,11 +157,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 19)] = ( + [(@"TestMapActions.cs", 24)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 19)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 24)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -182,13 +186,14 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: headerValue (Type = global::System.String, IsOptional = False, Source = Header) + // Endpoint Parameter: headerValue (Type = string, IsOptional = False, IsParsable = False, Source = Header) var headerValue_raw = httpContext.Request.Headers["headerValue"]; if (StringValues.IsNullOrEmpty(headerValue_raw)) { wasParamCheckFailure = true; } - var headerValue_local = headerValue_raw.ToString(); + var headerValue_temp = headerValue_raw.ToString(); + string headerValue_local = headerValue_temp!; if (wasParamCheckFailure) { @@ -199,16 +204,18 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(headerValue_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: headerValue (Type = global::System.String, IsOptional = False, Source = Header) + // Endpoint Parameter: headerValue (Type = string, IsOptional = False, IsParsable = False, Source = Header) var headerValue_raw = httpContext.Request.Headers["headerValue"]; if (StringValues.IsNullOrEmpty(headerValue_raw)) { wasParamCheckFailure = true; } - var headerValue_local = headerValue_raw.ToString(); + var headerValue_temp = headerValue_raw.ToString(); + string headerValue_local = headerValue_temp!; if (wasParamCheckFailure) { @@ -222,11 +229,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 20)] = ( + [(@"TestMapActions.cs", 25)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 20)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 25)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -251,7 +258,7 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: routeValue (Type = global::System.String, IsOptional = False, Source = Route) + // Endpoint Parameter: routeValue (Type = string, IsOptional = False, IsParsable = False, Source = Route) if (options?.RouteParameterNames?.Contains("routeValue", StringComparer.OrdinalIgnoreCase) != true) { throw new InvalidOperationException($"'routeValue' is not a route parameter."); @@ -272,10 +279,11 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(routeValue_local!); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: routeValue (Type = global::System.String, IsOptional = False, Source = Route) + // Endpoint Parameter: routeValue (Type = string, IsOptional = False, IsParsable = False, Source = Route) if (options?.RouteParameterNames?.Contains("routeValue", StringComparer.OrdinalIgnoreCase) != true) { throw new InvalidOperationException($"'routeValue' is not a route parameter."); @@ -299,11 +307,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 21)] = ( + [(@"TestMapActions.cs", 26)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 21)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 26)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -328,8 +336,9 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: value (Type = global::System.String, IsOptional = False, Source = RouteOrQuery) - var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()): httpContext.Request.Query[$"value"];; + // Endpoint Parameter: value (Type = string, IsOptional = False, IsParsable = False, Source = RouteOrQuery) + var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) + : httpContext.Request.Query[$"value"]; if (value_raw is StringValues { Count: 0 }) { wasParamCheckFailure = true; @@ -345,11 +354,13 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(value_local!); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: value (Type = global::System.String, IsOptional = False, Source = RouteOrQuery) - var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()): httpContext.Request.Query[$"value"];; + // Endpoint Parameter: value (Type = string, IsOptional = False, IsParsable = False, Source = RouteOrQuery) + var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) + : httpContext.Request.Query[$"value"]; if (value_raw is StringValues { Count: 0 }) { wasParamCheckFailure = true; @@ -368,11 +379,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 22)] = ( + [(@"TestMapActions.cs", 27)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 22)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 27)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -397,8 +408,9 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: value (Type = global::System.String, IsOptional = False, Source = RouteOrQuery) - var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()): httpContext.Request.Query[$"value"];; + // Endpoint Parameter: value (Type = string, IsOptional = False, IsParsable = False, Source = RouteOrQuery) + var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) + : httpContext.Request.Query[$"value"]; if (value_raw is StringValues { Count: 0 }) { wasParamCheckFailure = true; @@ -414,11 +426,13 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(value_local!); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: value (Type = global::System.String, IsOptional = False, Source = RouteOrQuery) - var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()): httpContext.Request.Query[$"value"];; + // Endpoint Parameter: value (Type = string, IsOptional = False, IsParsable = False, Source = RouteOrQuery) + var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) + : httpContext.Request.Query[$"value"]; if (value_raw is StringValues { Count: 0 }) { wasParamCheckFailure = true; @@ -520,7 +534,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -626,7 +640,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -739,7 +753,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -859,7 +873,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -986,7 +1000,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -1120,7 +1134,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -1261,7 +1275,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1409,7 +1423,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1564,7 +1578,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1726,7 +1740,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleSpecialTypeParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleSpecialTypeParam_StringReturn.generated.txt index c4cb5810abc9..9dcd43f28d08 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleSpecialTypeParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleSpecialTypeParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -85,11 +85,11 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 18)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 18)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -116,6 +116,7 @@ namespace Microsoft.AspNetCore.Http.Generated var wasParamCheckFailure = false; var req_local = httpContext.Request; var res_local = httpContext.Response; + if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -125,11 +126,13 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(req_local, res_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; var req_local = httpContext.Request; var res_local = httpContext.Response; + if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -225,7 +228,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -331,7 +334,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -444,7 +447,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -564,7 +567,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -691,7 +694,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -825,7 +828,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -966,7 +969,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1114,7 +1117,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1269,7 +1272,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1431,7 +1434,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1600,4 +1603,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleStringParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleStringParam_StringReturn.generated.txt index 6f5a072ebd52..b2f3d5168eb2 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleStringParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleStringParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -85,11 +85,11 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 18)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 18)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -114,23 +114,22 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: p1 (Type = global::System.String, IsOptional = False, Source = Query) + // Endpoint Parameter: p1 (Type = string, IsOptional = False, IsParsable = False, Source = Query) var p1_raw = httpContext.Request.Query["p1"]; if (StringValues.IsNullOrEmpty(p1_raw)) { wasParamCheckFailure = true; } var p1_temp = p1_raw.ToString(); - var p1_local = p1_temp; - - // Endpoint Parameter: p2 (Type = global::System.String, IsOptional = False, Source = Query) + string p1_local = p1_temp!; + // Endpoint Parameter: p2 (Type = string, IsOptional = False, IsParsable = False, Source = Query) var p2_raw = httpContext.Request.Query["p2"]; if (StringValues.IsNullOrEmpty(p2_raw)) { wasParamCheckFailure = true; } var p2_temp = p2_raw.ToString(); - var p2_local = p2_temp; + string p2_local = p2_temp!; if (wasParamCheckFailure) { @@ -141,26 +140,26 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(p1_local, p2_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: p1 (Type = global::System.String, IsOptional = False, Source = Query) + // Endpoint Parameter: p1 (Type = string, IsOptional = False, IsParsable = False, Source = Query) var p1_raw = httpContext.Request.Query["p1"]; if (StringValues.IsNullOrEmpty(p1_raw)) { wasParamCheckFailure = true; } var p1_temp = p1_raw.ToString(); - var p1_local = p1_temp; - - // Endpoint Parameter: p2 (Type = global::System.String, IsOptional = False, Source = Query) + string p1_local = p1_temp!; + // Endpoint Parameter: p2 (Type = string, IsOptional = False, IsParsable = False, Source = Query) var p2_raw = httpContext.Request.Query["p2"]; if (StringValues.IsNullOrEmpty(p2_raw)) { wasParamCheckFailure = true; } var p2_temp = p2_raw.ToString(); - var p2_local = p2_temp; + string p2_local = p2_temp!; if (wasParamCheckFailure) { @@ -257,7 +256,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -363,7 +362,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -476,7 +475,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -596,7 +595,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -723,7 +722,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -857,7 +856,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -998,7 +997,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1146,7 +1145,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1301,7 +1300,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1463,7 +1462,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1632,4 +1631,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_NoParam_StringReturn_WithFilter.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_NoParam_StringReturn_WithFilter.generated.txt index 342aecfbd68c..57f7e22d04ab 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_NoParam_StringReturn_WithFilter.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_NoParam_StringReturn_WithFilter.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -85,11 +85,11 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 18)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 18)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -114,7 +114,6 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -124,10 +123,10 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -223,7 +222,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -329,7 +328,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -442,7 +441,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -562,7 +561,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -689,7 +688,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -823,7 +822,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -964,7 +963,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1112,7 +1111,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1267,7 +1266,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1429,7 +1428,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1598,4 +1597,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleComplexTypeParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleComplexTypeParam_StringReturn.generated.txt index 961e050a7817..082480443c6d 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleComplexTypeParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleComplexTypeParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -40,17 +40,17 @@ namespace Microsoft.AspNetCore.Builder internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet( this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern, - global::System.Func handler, + global::System.Func handler, [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -85,16 +85,16 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 16)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 16)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => { - var handler = (Func)del; + var handler = (Func)del; EndpointFilterDelegate? filteredInvocation = null; if (options?.EndpointBuilder?.FilterFactories.Count > 0) @@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Http.Generated { return ValueTask.FromResult(Results.Empty); } - return ValueTask.FromResult(handler(ic.GetArgument(0))); + return ValueTask.FromResult(handler(ic.GetArgument(0))); }, options.EndpointBuilder, handler.Method); @@ -114,18 +114,18 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: p (Type = TestMapActions.Todo, IsOptional = False, Source = Query) + // Endpoint Parameter: p (Type = Todo, IsOptional = False, IsParsable = True, Source = Query) var p_raw = httpContext.Request.Query["p"]; if (StringValues.IsNullOrEmpty(p_raw)) { wasParamCheckFailure = true; } var p_temp = p_raw.ToString(); - if (!global::TestMapActions.Todo.TryParse(p_temp, out var p_parsed_temp)) + if (!global::Todo.TryParse(p_temp, out var p_parsed_temp)) { wasParamCheckFailure = true; } - var p_local = p_parsed_temp!; + global::Todo p_local = p_parsed_temp!; if (wasParamCheckFailure) { @@ -136,27 +136,28 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(p_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: p (Type = TestMapActions.Todo, IsOptional = False, Source = Query) + // Endpoint Parameter: p (Type = Todo, IsOptional = False, IsParsable = True, Source = Query) var p_raw = httpContext.Request.Query["p"]; if (StringValues.IsNullOrEmpty(p_raw)) { wasParamCheckFailure = true; } var p_temp = p_raw.ToString(); - if (!global::TestMapActions.Todo.TryParse(p_temp, out var p_parsed_temp)) + if (!global::Todo.TryParse(p_temp, out var p_parsed_temp)) { wasParamCheckFailure = true; } - var p_local = p_parsed_temp!; + global::Todo p_local = p_parsed_temp!; if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; } - var result = await filteredInvocation(new EndpointFilterInvocationContext(httpContext, p_local)); + var result = await filteredInvocation(new EndpointFilterInvocationContext(httpContext, p_local)); await GeneratedRouteBuilderExtensionsCore.ExecuteObjectResult(result, httpContext); } @@ -247,7 +248,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -353,7 +354,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -466,7 +467,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -586,7 +587,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -713,7 +714,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -847,7 +848,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -988,7 +989,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1136,7 +1137,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1291,7 +1292,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1453,7 +1454,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1622,4 +1623,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleEnumParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleEnumParam_StringReturn.generated.txt index 1a7e644a147d..02d0918604bc 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleEnumParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleEnumParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -40,17 +40,17 @@ namespace Microsoft.AspNetCore.Builder internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet( this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, [global::System.Diagnostics.CodeAnalysis.StringSyntax("Route")] string pattern, - global::System.Func handler, + global::System.Func handler, [global::System.Runtime.CompilerServices.CallerFilePath] string filePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -85,16 +85,16 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 16)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 16)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => { - var handler = (Func)del; + var handler = (Func)del; EndpointFilterDelegate? filteredInvocation = null; if (options?.EndpointBuilder?.FilterFactories.Count > 0) @@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Http.Generated { return ValueTask.FromResult(Results.Empty); } - return ValueTask.FromResult(handler(ic.GetArgument(0))); + return ValueTask.FromResult(handler(ic.GetArgument(0))); }, options.EndpointBuilder, handler.Method); @@ -114,18 +114,18 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: p (Type = TestMapActions.TodoStatus, IsOptional = False, Source = Query) + // Endpoint Parameter: p (Type = TodoStatus, IsOptional = False, IsParsable = True, Source = Query) var p_raw = httpContext.Request.Query["p"]; if (StringValues.IsNullOrEmpty(p_raw)) { wasParamCheckFailure = true; } var p_temp = p_raw.ToString(); - if (!Enum.TryParse(p_temp, out var p_parsed_temp)) + if (!Enum.TryParse(p_temp, out var p_parsed_temp)) { wasParamCheckFailure = true; } - var p_local = p_parsed_temp!; + global::TodoStatus p_local = p_parsed_temp!; if (wasParamCheckFailure) { @@ -136,27 +136,28 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(p_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: p (Type = TestMapActions.TodoStatus, IsOptional = False, Source = Query) + // Endpoint Parameter: p (Type = TodoStatus, IsOptional = False, IsParsable = True, Source = Query) var p_raw = httpContext.Request.Query["p"]; if (StringValues.IsNullOrEmpty(p_raw)) { wasParamCheckFailure = true; } var p_temp = p_raw.ToString(); - if (!Enum.TryParse(p_temp, out var p_parsed_temp)) + if (!Enum.TryParse(p_temp, out var p_parsed_temp)) { wasParamCheckFailure = true; } - var p_local = p_parsed_temp!; + global::TodoStatus p_local = p_parsed_temp!; if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; } - var result = await filteredInvocation(new EndpointFilterInvocationContext(httpContext, p_local)); + var result = await filteredInvocation(new EndpointFilterInvocationContext(httpContext, p_local)); await GeneratedRouteBuilderExtensionsCore.ExecuteObjectResult(result, httpContext); } @@ -247,7 +248,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -353,7 +354,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -466,7 +467,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -586,7 +587,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -713,7 +714,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -847,7 +848,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -988,7 +989,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1136,7 +1137,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1291,7 +1292,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1453,7 +1454,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1622,4 +1623,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithEmptyQueryStringValueProvided_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithEmptyQueryStringValueProvided_StringReturn.generated.txt index b755b15ed365..71f957f77adc 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithEmptyQueryStringValueProvided_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithEmptyQueryStringValueProvided_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -85,11 +85,11 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 18)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 18)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -114,10 +114,10 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: p (Type = global::System.String?, IsOptional = True, Source = Query) + // Endpoint Parameter: p (Type = string?, IsOptional = True, IsParsable = False, Source = Query) var p_raw = httpContext.Request.Query["p"]; var p_temp = p_raw.Count > 0 ? p_raw.ToString() : null; - var p_local = p_temp; + string p_local = p_temp!; if (wasParamCheckFailure) { @@ -128,13 +128,14 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(p_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: p (Type = global::System.String?, IsOptional = True, Source = Query) + // Endpoint Parameter: p (Type = string?, IsOptional = True, IsParsable = False, Source = Query) var p_raw = httpContext.Request.Query["p"]; var p_temp = p_raw.Count > 0 ? p_raw.ToString() : null; - var p_local = p_temp; + string p_local = p_temp!; if (wasParamCheckFailure) { @@ -231,7 +232,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -337,7 +338,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -450,7 +451,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -570,7 +571,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -697,7 +698,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -831,7 +832,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -972,7 +973,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1120,7 +1121,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1275,7 +1276,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1437,7 +1438,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1606,4 +1607,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithQueryStringValueProvided_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithQueryStringValueProvided_StringReturn.generated.txt index 6aff493747fc..62a2f093c726 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithQueryStringValueProvided_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithQueryStringValueProvided_StringReturn.generated.txt @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -128,6 +128,7 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(p_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithoutQueryStringValueProvided_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithoutQueryStringValueProvided_StringReturn.generated.txt index 6aff493747fc..62a2f093c726 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithoutQueryStringValueProvided_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithoutQueryStringValueProvided_StringReturn.generated.txt @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -128,6 +128,7 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(p_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleStringParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleStringParam_StringReturn.generated.txt index a67a23337552..c9c412d83e37 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleStringParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleStringParam_StringReturn.generated.txt @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -132,6 +132,7 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(p_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleTimeOnlyParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleTimeOnlyParam_StringReturn.generated.txt index b1b71b101d22..284dcb5bc246 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleTimeOnlyParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleTimeOnlyParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -85,11 +85,11 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 16)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 16)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Http.Generated { return ValueTask.FromResult(Results.Empty); } - return ValueTask.FromResult(handler(ic.GetArgument(0))); + return ValueTask.FromResult(handler(ic.GetArgument(0))); }, options.EndpointBuilder, handler.Method); @@ -114,18 +114,18 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: p (Type = System.TimeOnly, IsOptional = False, Source = Query) + // Endpoint Parameter: p (Type = System.TimeOnly, IsOptional = False, IsParsable = True, Source = Query) var p_raw = httpContext.Request.Query["p"]; if (StringValues.IsNullOrEmpty(p_raw)) { wasParamCheckFailure = true; } var p_temp = p_raw.ToString(); - if (!global::System.TimeOnly.TryParse(p_temp, CultureInfo.InvariantCulture, out var p_parsed_temp)) + if (!global::System.TimeOnly.TryParse(p_temp, CultureInfo.InvariantCulture, out var p_parsed_temp)) { wasParamCheckFailure = true; } - var p_local = p_parsed_temp!; + global::System.TimeOnly p_local = p_parsed_temp!; if (wasParamCheckFailure) { @@ -136,27 +136,28 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(p_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - // Endpoint Parameter: p (Type = System.TimeOnly, IsOptional = False, Source = Query) + // Endpoint Parameter: p (Type = System.TimeOnly, IsOptional = False, IsParsable = True, Source = Query) var p_raw = httpContext.Request.Query["p"]; if (StringValues.IsNullOrEmpty(p_raw)) { wasParamCheckFailure = true; } var p_temp = p_raw.ToString(); - if (!global::System.TimeOnly.TryParse(p_temp, CultureInfo.InvariantCulture, out var p_parsed_temp)) + if (!global::System.TimeOnly.TryParse(p_temp, CultureInfo.InvariantCulture, out var p_parsed_temp)) { wasParamCheckFailure = true; } - var p_local = p_parsed_temp!; + global::System.TimeOnly p_local = p_parsed_temp!; if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; } - var result = await filteredInvocation(new EndpointFilterInvocationContext(httpContext, p_local)); + var result = await filteredInvocation(new EndpointFilterInvocationContext(httpContext, p_local)); await GeneratedRouteBuilderExtensionsCore.ExecuteObjectResult(result, httpContext); } @@ -247,7 +248,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -353,7 +354,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -466,7 +467,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -586,7 +587,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -713,7 +714,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -847,7 +848,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -988,7 +989,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1136,7 +1137,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1291,7 +1292,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1453,7 +1454,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1622,4 +1623,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_NoParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_NoParam_StringReturn.generated.txt index 4a41666f9501..5a26b9e0a47f 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_NoParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_NoParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet( this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, @@ -60,12 +60,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet( this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, @@ -75,12 +75,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -115,11 +115,11 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 18)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 18)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -144,7 +144,6 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -154,10 +153,10 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -170,11 +169,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 19)] = ( + [(@"TestMapActions.cs", 24)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 19)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 24)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -199,7 +198,6 @@ namespace Microsoft.AspNetCore.Http.Generated Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -209,10 +207,10 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -225,11 +223,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 20)] = ( + [(@"TestMapActions.cs", 25)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 20)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 25)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -254,7 +252,6 @@ namespace Microsoft.AspNetCore.Http.Generated async Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -264,10 +261,10 @@ namespace Microsoft.AspNetCore.Http.Generated var result = await handler(); await httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -280,11 +277,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 21)] = ( + [(@"TestMapActions.cs", 26)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 21)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 26)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -309,7 +306,6 @@ namespace Microsoft.AspNetCore.Http.Generated async Task RequestHandler(HttpContext httpContext) { var wasParamCheckFailure = false; - if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -319,10 +315,10 @@ namespace Microsoft.AspNetCore.Http.Generated var result = await handler(); await httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; - if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -418,7 +414,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -524,7 +520,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -637,7 +633,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -757,7 +753,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -884,7 +880,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -1018,7 +1014,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -1159,7 +1155,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1307,7 +1303,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1462,7 +1458,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1624,7 +1620,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1793,4 +1789,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_WithParams_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_WithParams_StringReturn.generated.txt index 3d2033c6d838..f720dfc69d62 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_WithParams_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_WithParams_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -45,12 +45,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet( this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, @@ -60,12 +60,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } internal static global::Microsoft.AspNetCore.Builder.RouteHandlerBuilder MapGet( this global::Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, @@ -75,12 +75,12 @@ namespace Microsoft.AspNetCore.Builder [global::System.Runtime.CompilerServices.CallerLineNumber]int lineNumber = 0) { return global::Microsoft.AspNetCore.Http.Generated.GeneratedRouteBuilderExtensionsCore.MapCore( - endpoints, - pattern, - handler, - GetVerb, - filePath, - lineNumber); + endpoints, + pattern, + handler, + GetVerb, + filePath, + lineNumber); } } @@ -115,11 +115,11 @@ namespace Microsoft.AspNetCore.Http.Generated private static readonly Dictionary<(string, int), (MetadataPopulator, RequestDelegateFactoryFunc)> map = new() { - [(@"TestMapActions.cs", 18)] = ( + [(@"TestMapActions.cs", 23)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 18)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 23)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -145,6 +145,7 @@ namespace Microsoft.AspNetCore.Http.Generated { var wasParamCheckFailure = false; var req_local = httpContext.Request; + if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -154,10 +155,12 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(req_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; var req_local = httpContext.Request; + if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -170,11 +173,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 19)] = ( + [(@"TestMapActions.cs", 24)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 19)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 24)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -200,6 +203,7 @@ namespace Microsoft.AspNetCore.Http.Generated { var wasParamCheckFailure = false; var res_local = httpContext.Response; + if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -209,10 +213,12 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(res_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; var res_local = httpContext.Response; + if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -225,11 +231,11 @@ namespace Microsoft.AspNetCore.Http.Generated var metadata = inferredMetadataResult?.EndpointMetadata ?? ReadOnlyCollection.Empty; return new RequestDelegateResult(targetDelegate, metadata); }), - [(@"TestMapActions.cs", 20)] = ( + [(@"TestMapActions.cs", 25)] = ( (methodInfo, options) => { Debug.Assert(options?.EndpointBuilder != null, "EndpointBuilder not found."); - options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 20)); + options.EndpointBuilder.Metadata.Add(new SourceKey(@"TestMapActions.cs", 25)); return new RequestDelegateMetadataResult { EndpointMetadata = options.EndpointBuilder.Metadata.AsReadOnly() }; }, (del, options, inferredMetadataResult) => @@ -256,6 +262,7 @@ namespace Microsoft.AspNetCore.Http.Generated var wasParamCheckFailure = false; var req_local = httpContext.Request; var res_local = httpContext.Response; + if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -265,11 +272,13 @@ namespace Microsoft.AspNetCore.Http.Generated var result = handler(req_local, res_local); return httpContext.Response.WriteAsync(result); } + async Task RequestHandlerFiltered(HttpContext httpContext) { var wasParamCheckFailure = false; var req_local = httpContext.Request; var res_local = httpContext.Response; + if (wasParamCheckFailure) { httpContext.Response.StatusCode = 400; @@ -365,7 +374,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -471,7 +480,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -584,7 +593,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -704,7 +713,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -831,7 +840,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -965,7 +974,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -1106,7 +1115,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1254,7 +1263,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1409,7 +1418,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1571,7 +1580,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - %GENERATEDCODEATTRIBUTE% + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) @@ -1740,4 +1749,4 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } -} +} \ No newline at end of file diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateGeneratorTestBase.cs b/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateGeneratorTestBase.cs index b0d1e00a9b3d..0672f8bb0ddc 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateGeneratorTestBase.cs +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateGeneratorTestBase.cs @@ -356,7 +356,6 @@ internal async Task VerifyAgainstBaselineUsingFile(Compilation compilation, [Cal var baselineFilePath = Path.Combine("RequestDelegateGenerator", "Baselines", $"{callerName}.generated.txt"); var generatedSyntaxTree = compilation.SyntaxTrees.Last(); var generatedCode = await generatedSyntaxTree.GetTextAsync(); - await File.WriteAllTextAsync(baselineFilePath, generatedCode.ToString()); var baseline = await File.ReadAllTextAsync(baselineFilePath); var expectedLines = baseline .TrimEnd() // Trim newlines added by autoformat diff --git a/src/Shared/RoslynUtils/CodeWriter.cs b/src/Shared/RoslynUtils/CodeWriter.cs new file mode 100644 index 000000000000..a779f9233557 --- /dev/null +++ b/src/Shared/RoslynUtils/CodeWriter.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.CodeDom.Compiler; +using System.Globalization; +using System.IO; + +internal sealed class CodeWriter : IndentedTextWriter +{ + public CodeWriter(StringWriter stringWriter, int baseIndent) : base(stringWriter) + { + Indent = baseIndent; + } + + public void StartBlock() + { + this.WriteLine("{"); + this.Indent++; + } + + public void EndBlock() + { + this.Indent--; + this.WriteLine("}"); + } +} From c3fb6fde94b1271d3cb2c1cc41c09c5a194ee146 Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Mon, 27 Feb 2023 14:55:40 -0800 Subject: [PATCH 2/2] Fix up baselines --- .../Emitters/EndpointParameterEmitter.cs | 8 ++-- ...Param_ComplexReturn_Snapshot.generated.txt | 24 +++++----- ...eParam_SimpleReturn_Snapshot.generated.txt | 24 +++++----- ...Source_SimpleReturn_Snapshot.generated.txt | 44 ++++++++++--------- ...pecialTypeParam_StringReturn.generated.txt | 24 +++++----- ...ipleStringParam_StringReturn.generated.txt | 24 +++++----- ...aram_StringReturn_WithFilter.generated.txt | 24 +++++----- ...omplexTypeParam_StringReturn.generated.txt | 24 +++++----- ...SingleEnumParam_StringReturn.generated.txt | 24 +++++----- ...ngValueProvided_StringReturn.generated.txt | 24 +++++----- ...leTimeOnlyParam_StringReturn.generated.txt | 24 +++++----- ...pAction_NoParam_StringReturn.generated.txt | 24 +++++----- ...tion_WithParams_StringReturn.generated.txt | 24 +++++----- 13 files changed, 161 insertions(+), 155 deletions(-) diff --git a/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointParameterEmitter.cs b/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointParameterEmitter.cs index dbe32c8d1988..4308ea8ebbbf 100644 --- a/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointParameterEmitter.cs +++ b/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointParameterEmitter.cs @@ -46,11 +46,11 @@ internal static void EmitParsingBlock(this EndpointParameter endpointParameter, { var parsingBlock = endpointParameter.ParsingBlockEmitter(endpointParameter.EmitTempArgument(), endpointParameter.EmitParsedTempArgument()); codeWriter.WriteLine(parsingBlock); - codeWriter.WriteLine($"{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {endpointParameter.EmitHandlerArgument()} = {endpointParameter.Name}_parsed_temp!;"); + codeWriter.WriteLine($"{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {endpointParameter.EmitHandlerArgument()} = {endpointParameter.EmitParsedTempArgument()}!;"); } else { - codeWriter.WriteLine($"{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {endpointParameter.EmitHandlerArgument()} = {endpointParameter.Name}_temp!;"); + codeWriter.WriteLine($"{endpointParameter.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {endpointParameter.EmitHandlerArgument()} = {endpointParameter.EmitTempArgument()}!;"); } } @@ -85,9 +85,11 @@ internal static void EmitRouteOrQueryParameterPreparation(this EndpointParameter var parameterName = endpointParameter.Name; codeWriter.Write($"var {endpointParameter.EmitAssigningCodeResult()} = "); - codeWriter.Write($@"options?.RouteParameterNames?.Contains(""{parameterName}"", StringComparer.OrdinalIgnoreCase) == true"); + codeWriter.WriteLine($@"options?.RouteParameterNames?.Contains(""{parameterName}"", StringComparer.OrdinalIgnoreCase) == true"); + codeWriter.Indent++; codeWriter.WriteLine($@"? new StringValues(httpContext.Request.RouteValues[$""{parameterName}""]?.ToString())"); codeWriter.WriteLine($@": httpContext.Request.Query[$""{parameterName}""];"); + codeWriter.Indent--; if (!endpointParameter.IsOptional) { diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitBodyParam_ComplexReturn_Snapshot.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitBodyParam_ComplexReturn_Snapshot.generated.txt index 2771fe401bb0..67c9bd428310 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitBodyParam_ComplexReturn_Snapshot.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitBodyParam_ComplexReturn_Snapshot.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -304,7 +304,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -410,7 +410,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -523,7 +523,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -643,7 +643,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -770,7 +770,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -904,7 +904,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -1045,7 +1045,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1193,7 +1193,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1348,7 +1348,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1510,7 +1510,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitServiceParam_SimpleReturn_Snapshot.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitServiceParam_SimpleReturn_Snapshot.generated.txt index 451dedaf7018..d2e80a8fc4e2 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitServiceParam_SimpleReturn_Snapshot.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitServiceParam_SimpleReturn_Snapshot.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -382,7 +382,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -488,7 +488,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -601,7 +601,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -721,7 +721,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -848,7 +848,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -982,7 +982,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -1123,7 +1123,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1271,7 +1271,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1426,7 +1426,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1588,7 +1588,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitSource_SimpleReturn_Snapshot.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitSource_SimpleReturn_Snapshot.generated.txt index d72e5aa74fa4..e2efbd6621cf 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitSource_SimpleReturn_Snapshot.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ExplicitSource_SimpleReturn_Snapshot.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -337,8 +337,9 @@ namespace Microsoft.AspNetCore.Http.Generated { var wasParamCheckFailure = false; // Endpoint Parameter: value (Type = string, IsOptional = False, IsParsable = False, Source = RouteOrQuery) - var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) - : httpContext.Request.Query[$"value"]; + var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true + ? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) + : httpContext.Request.Query[$"value"]; if (value_raw is StringValues { Count: 0 }) { wasParamCheckFailure = true; @@ -359,8 +360,9 @@ namespace Microsoft.AspNetCore.Http.Generated { var wasParamCheckFailure = false; // Endpoint Parameter: value (Type = string, IsOptional = False, IsParsable = False, Source = RouteOrQuery) - var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) - : httpContext.Request.Query[$"value"]; + var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true + ? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) + : httpContext.Request.Query[$"value"]; if (value_raw is StringValues { Count: 0 }) { wasParamCheckFailure = true; @@ -409,8 +411,9 @@ namespace Microsoft.AspNetCore.Http.Generated { var wasParamCheckFailure = false; // Endpoint Parameter: value (Type = string, IsOptional = False, IsParsable = False, Source = RouteOrQuery) - var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) - : httpContext.Request.Query[$"value"]; + var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true + ? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) + : httpContext.Request.Query[$"value"]; if (value_raw is StringValues { Count: 0 }) { wasParamCheckFailure = true; @@ -431,8 +434,9 @@ namespace Microsoft.AspNetCore.Http.Generated { var wasParamCheckFailure = false; // Endpoint Parameter: value (Type = string, IsOptional = False, IsParsable = False, Source = RouteOrQuery) - var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) - : httpContext.Request.Query[$"value"]; + var value_raw = options?.RouteParameterNames?.Contains("value", StringComparer.OrdinalIgnoreCase) == true + ? new StringValues(httpContext.Request.RouteValues[$"value"]?.ToString()) + : httpContext.Request.Query[$"value"]; if (value_raw is StringValues { Count: 0 }) { wasParamCheckFailure = true; @@ -534,7 +538,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -640,7 +644,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -753,7 +757,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -873,7 +877,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -1000,7 +1004,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -1134,7 +1138,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -1275,7 +1279,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1423,7 +1427,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1578,7 +1582,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1740,7 +1744,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleSpecialTypeParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleSpecialTypeParam_StringReturn.generated.txt index 9dcd43f28d08..1ccd2e3c6e5a 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleSpecialTypeParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleSpecialTypeParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -228,7 +228,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -334,7 +334,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -447,7 +447,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -567,7 +567,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -694,7 +694,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -828,7 +828,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -969,7 +969,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1117,7 +1117,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1272,7 +1272,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1434,7 +1434,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleStringParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleStringParam_StringReturn.generated.txt index b2f3d5168eb2..96c192139818 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleStringParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_MultipleStringParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -256,7 +256,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -362,7 +362,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -475,7 +475,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -595,7 +595,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -722,7 +722,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -856,7 +856,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -997,7 +997,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1145,7 +1145,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1300,7 +1300,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1462,7 +1462,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_NoParam_StringReturn_WithFilter.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_NoParam_StringReturn_WithFilter.generated.txt index 57f7e22d04ab..c9e97ef611ac 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_NoParam_StringReturn_WithFilter.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_NoParam_StringReturn_WithFilter.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -222,7 +222,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -328,7 +328,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -441,7 +441,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -561,7 +561,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -688,7 +688,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -822,7 +822,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -963,7 +963,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1111,7 +1111,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1266,7 +1266,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1428,7 +1428,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleComplexTypeParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleComplexTypeParam_StringReturn.generated.txt index 082480443c6d..ce42f4acd8f9 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleComplexTypeParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleComplexTypeParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -248,7 +248,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -354,7 +354,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -467,7 +467,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -587,7 +587,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -714,7 +714,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -848,7 +848,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -989,7 +989,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1137,7 +1137,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1292,7 +1292,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1454,7 +1454,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleEnumParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleEnumParam_StringReturn.generated.txt index 02d0918604bc..c85275192e52 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleEnumParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleEnumParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -248,7 +248,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -354,7 +354,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -467,7 +467,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -587,7 +587,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -714,7 +714,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -848,7 +848,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -989,7 +989,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1137,7 +1137,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1292,7 +1292,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1454,7 +1454,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithEmptyQueryStringValueProvided_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithEmptyQueryStringValueProvided_StringReturn.generated.txt index 71f957f77adc..8561a1a1e2f1 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithEmptyQueryStringValueProvided_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleNullableStringParam_WithEmptyQueryStringValueProvided_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -232,7 +232,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -338,7 +338,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -451,7 +451,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -571,7 +571,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -698,7 +698,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -832,7 +832,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -973,7 +973,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1121,7 +1121,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1276,7 +1276,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1438,7 +1438,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleTimeOnlyParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleTimeOnlyParam_StringReturn.generated.txt index 284dcb5bc246..e3006ab412be 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleTimeOnlyParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_SingleTimeOnlyParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -248,7 +248,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -354,7 +354,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -467,7 +467,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -587,7 +587,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -714,7 +714,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -848,7 +848,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -989,7 +989,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1137,7 +1137,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1292,7 +1292,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1454,7 +1454,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_NoParam_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_NoParam_StringReturn.generated.txt index 5a26b9e0a47f..c092695fc420 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_NoParam_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_NoParam_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -414,7 +414,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -520,7 +520,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -633,7 +633,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -753,7 +753,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -880,7 +880,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -1014,7 +1014,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -1155,7 +1155,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1303,7 +1303,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1458,7 +1458,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1620,7 +1620,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) diff --git a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_WithParams_StringReturn.generated.txt b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_WithParams_StringReturn.generated.txt index f720dfc69d62..ed0e3d286f4e 100644 --- a/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_WithParams_StringReturn.generated.txt +++ b/src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/Multiple_MapAction_WithParams_StringReturn.generated.txt @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Builder { - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal class SourceKey { public string Path { get; init; } @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Builder // generated by the compiler so that they will be favored by // overload resolution and opt the runtime in to the code generated // implementation produced here. - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% internal static class GenerateRouteBuilderEndpoints { private static readonly string[] GetVerb = new[] { global::Microsoft.AspNetCore.Http.HttpMethods.Get }; @@ -374,7 +374,7 @@ namespace Microsoft.AspNetCore.Http.Generated } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0) @@ -480,7 +480,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1) @@ -593,7 +593,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2) @@ -713,7 +713,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3) @@ -840,7 +840,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) @@ -974,7 +974,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) @@ -1115,7 +1115,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) @@ -1263,7 +1263,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) @@ -1418,7 +1418,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) @@ -1580,7 +1580,7 @@ namespace Microsoft.AspNetCore.Http.Generated return GetEnumerator(); } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.Http.Generators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")] + %GENERATEDCODEATTRIBUTE% file class EndpointFilterInvocationContext : EndpointFilterInvocationContext, IList { internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)