1 write to Type
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
StaticRouteHandlerModel\EndpointParameter.cs (1)
55
Type
= typeSymbol;
69 references to Type
Microsoft.AspNetCore.Http.RequestDelegateGenerator (69)
StaticRouteHandlerModel\Emitters\EmitterExtensions.cs (3)
20
? $"{endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat)}.BindAsync(HttpContext)"
21
: $"{endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat)}.BindAsync(HttpContext, ParameterInfo)",
45
endpointParameter.
Type
.IsValueType && endpointParameter.GetBindAsyncReturnType().IsNullableOfT()
StaticRouteHandlerModel\Emitters\EndpointEmitter.cs (2)
120
var shortParameterTypeName = parameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat);
121
codeWriter.WriteLine($"ResolveJsonBodyOrService<{parameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)}>(logOrThrowExceptionHelper, {SymbolDisplay.FormatLiteral(shortParameterTypeName, true)}, {SymbolDisplay.FormatLiteral(parameter.SymbolName, true)}, jsonSerializerOptions, serviceProviderIsService);");
StaticRouteHandlerModel\Emitters\EndpointJsonPreparationEmitter.cs (2)
40
var typeName = parameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat);
41
codeWriter.WriteLine($"var {parameter.SymbolName}_JsonTypeInfo = (JsonTypeInfo<{typeName}>)jsonSerializerOptions.GetTypeInfo(typeof({parameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormatWithoutNullability)}));");
StaticRouteHandlerModel\Emitters\EndpointParameterEmitter.cs (30)
47
codeWriter.WriteLine($@"logOrThrowExceptionHelper.RequiredParameterNotProvided({SymbolDisplay.FormatLiteral(endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat), true)}, {SymbolDisplay.FormatLiteral(endpointParameter.SymbolName, true)}, {SymbolDisplay.FormatLiteral(endpointParameter.ToMessageString(), true)});");
64
var shortParameterTypeName = endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat);
83
codeWriter.WriteLine($@"logOrThrowExceptionHelper.RequiredParameterNotProvided({SymbolDisplay.FormatLiteral(endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat), true)}, {SymbolDisplay.FormatLiteral(endpointParameter.SymbolName, true)}, {SymbolDisplay.FormatLiteral(endpointParameter.ToMessageString(), true)});");
98
codeWriter.WriteLine($"{endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)} {endpointParameter.EmitHandlerArgument()} = {createArray};");
128
codeWriter.WriteLine($"{endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {endpointParameter.EmitHandlerArgument()} = {endpointParameter.EmitTempArgument()}!;");
137
if (endpointParameter.IsOptional || endpointParameter.
Type
.NullableAnnotation == NullableAnnotation.Annotated)
141
codeWriter.WriteLine($"""{endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)} {output_argument} = default;""");
167
codeWriter.WriteLine($"{endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {endpointParameter.EmitHandlerArgument()} = {endpointParameter.EmitParsedTempArgument()}!;");
172
codeWriter.WriteLine($"{endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {endpointParameter.EmitHandlerArgument()} = {endpointParameter.EmitTempArgument()}!;");
180
writer.WriteLine($@"logOrThrowExceptionHelper.RequiredParameterNotProvided({SymbolDisplay.FormatLiteral(parameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat), true)}, {SymbolDisplay.FormatLiteral(parameter.SymbolName, true)}, {SymbolDisplay.FormatLiteral(parameter.ToMessageString(), true)});");
184
writer.WriteLine($@"logOrThrowExceptionHelper.ParameterBindingFailed({SymbolDisplay.FormatLiteral(parameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat), true)}, {SymbolDisplay.FormatLiteral(parameter.SymbolName, true)}, {inputArgument});");
209
codeWriter.WriteLine($@"logOrThrowExceptionHelper.RequiredParameterNotProvided({SymbolDisplay.FormatLiteral(endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat), true)}, {SymbolDisplay.FormatLiteral(endpointParameter.SymbolName, true)}, {SymbolDisplay.FormatLiteral(endpointParameter.ToMessageString(), true)});");
232
var fallback = endpointParameter.
Type
.SpecialType == SpecialType.System_String ? endpointParameter.DefaultValue : "null";
240
codeWriter.WriteLine($@"logOrThrowExceptionHelper.RequiredParameterNotProvided({SymbolDisplay.FormatLiteral(endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat), true)}, {SymbolDisplay.FormatLiteral(endpointParameter.SymbolName, true)}, {SymbolDisplay.FormatLiteral(endpointParameter.ToMessageString(), true)});");
255
var shortParameterTypeName = endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat);
256
var assigningCode = $"await GeneratedRouteBuilderExtensionsCore.TryResolveBodyAsync<{endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)}>(httpContext, logOrThrowExceptionHelper, {(endpointParameter.IsOptional ? "true" : "false")}, {SymbolDisplay.FormatLiteral(shortParameterTypeName, true)}, {SymbolDisplay.FormatLiteral(endpointParameter.SymbolName, true)}, {endpointParameter.SymbolName}_JsonTypeInfo)";
304
codeWriter.WriteLine($"{endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)} {endpointParameter.EmitHandlerArgument()} = null!;");
316
var shortParameterTypeName = endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat);
317
var assigningCode = $"await GeneratedRouteBuilderExtensionsCore.TryResolveBodyAsync<{endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)}>(httpContext, logOrThrowExceptionHelper, {(endpointParameter.IsOptional ? "true" : "false")}, {SymbolDisplay.FormatLiteral(shortParameterTypeName, true)}, {SymbolDisplay.FormatLiteral(endpointParameter.SymbolName, true)}, {endpointParameter.SymbolName}_JsonTypeInfo)";
319
codeWriter.WriteLine($"var {endpointParameter.SymbolName}_JsonTypeInfo = (JsonTypeInfo<{endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)}>)jsonOptions.SerializerOptions.GetTypeInfo(typeof({endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormatWithoutNullability)}));");
339
: endpointParameter.
Type
;
368
if (endpointParameter.
Type
.IsValueType && !endpointParameter.GetBindAsyncReturnType().IsNullableOfT())
372
codeWriter.WriteLine(endpointParameter.
Type
.IsValueType && endpointParameter.GetBindAsyncReturnType().IsNullableOfT()
376
codeWriter.WriteLine($@"logOrThrowExceptionHelper.RequiredParameterNotProvided({SymbolDisplay.FormatLiteral(endpointParameter.
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat), true)}, {SymbolDisplay.FormatLiteral(endpointParameter.SymbolName, true)}, {SymbolDisplay.FormatLiteral(endpointParameter.ToMessageString(), true)});");
392
$"httpContext.RequestServices.GetService<{endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)}>();" :
393
$"httpContext.RequestServices.GetRequiredService<{endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)}>()";
407
$"httpContext.RequestServices.GetKeyedService<{endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)}>({endpointParameter.KeyedServiceKey});" :
408
$"httpContext.RequestServices.GetRequiredKeyedService<{endpointParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormat)}>({endpointParameter.KeyedServiceKey})";
419
private static string EmitParameterDiagnosticComment(this EndpointParameter endpointParameter) => $"// Endpoint Parameter: {endpointParameter.SymbolName} (Type = {endpointParameter.
Type
}, IsOptional = {endpointParameter.IsOptional}, IsParsable = {endpointParameter.IsParsable}, IsArray = {endpointParameter.IsArray}, Source = {endpointParameter.Source})";
StaticRouteHandlerModel\Endpoint.cs (1)
144
hashCode.Add(parameter.
Type
, SymbolEqualityComparer.Default);
StaticRouteHandlerModel\EndpointParameter.cs (27)
73
IsParsable = TryGetParsability(
Type
, wellKnownTypes, out var preferredTryParseInvocation);
80
IsParsable = TryGetParsability(
Type
, wellKnownTypes, out var preferredTryParseInvocation);
87
IsParsable = TryGetParsability(
Type
, wellKnownTypes, out var preferredTryParseInvocation);
95
if (SymbolEqualityComparer.Default.Equals(
Type
, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_IFormFileCollection)))
100
else if (SymbolEqualityComparer.Default.Equals(
Type
, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_IFormFile)))
105
else if (SymbolEqualityComparer.Default.Equals(
Type
, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_IFormCollection)))
123
IsParsable = TryGetParsability(
Type
, wellKnownTypes, out var preferredTryParseInvocation);
129
if (SymbolEqualityComparer.Default.Equals(
Type
, wellKnownTypes.Get(WellKnownType.System_IO_Stream)))
134
else if (SymbolEqualityComparer.Default.Equals(
Type
, wellKnownTypes.Get(WellKnownType.System_IO_Pipelines_PipeReader)))
167
endpoint.Diagnostics.Add(Diagnostic.Create(DiagnosticDescriptors.InvalidAsParametersNullable, location,
Type
.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat)));
170
Type
is not INamedTypeSymbol namedTypeSymbol ||
191
else if (TryGetSpecialTypeAssigningCode(
Type
, wellKnownTypes, out var specialTypeAssigningCode))
196
else if (SymbolEqualityComparer.Default.Equals(
Type
, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_IFormFileCollection)))
203
else if (SymbolEqualityComparer.Default.Equals(
Type
, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_IFormFile)))
210
else if (SymbolEqualityComparer.Default.Equals(
Type
, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_IFormCollection)))
217
else if (HasBindAsync(
Type
, wellKnownTypes, out var bindMethod, out var bindMethodSymbol))
225
else if (
Type
.SpecialType == SpecialType.System_String)
234
else if (SymbolEqualityComparer.Default.Equals(
Type
, wellKnownTypes.Get(WellKnownType.Microsoft_Extensions_Primitives_StringValues)))
239
else if (TryGetParsability(
Type
, wellKnownTypes, out var preferredTryParseInvocation))
260
=> SymbolEqualityComparer.Default.Equals(
Type
, wellKnownTypes.Get(WellKnownType.Microsoft_Extensions_Primitives_StringValues))
261
||
Type
.SpecialType == SpecialType.System_String
263
|| TryGetParsability(
Type
, wellKnownTypes, out var _)
594
SymbolEqualityComparer.IncludeNullability.Equals(other.
Type
,
Type
) &&
599
SymbolEqualityComparer.IncludeNullability.Equals(other.
Type
,
Type
) &&
610
hashCode.Add(
Type
, SymbolEqualityComparer.IncludeNullability);
StaticRouteHandlerModel\Model\EndpointParameterExtensions.cs (1)
12
var handlerParameterType = parameter.
Type
;
StaticRouteHandlerModel\StaticRouteHandlerModel.Emitter.cs (3)
264
if (parameter.
Type
is not { } parameterType)
320
codeWriter.WriteLine($$"""options.EndpointBuilder.Metadata.Add(new AcceptsMetadata(type: typeof({{explicitBodyParameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormatWithoutNullability)}}), isOptional: {{(explicitBodyParameter.IsOptional ? "true" : "false")}}, contentTypes: GeneratedMetadataConstants.JsonContentType));""");
332
codeWriter.WriteLine($$"""({{(parameter.IsOptional ? "true" : "false")}}, typeof({{parameter.
Type
.ToDisplayString(EmitterConstants.DisplayFormatWithoutNullability)}})),""");