Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing invocation-regression #100

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 4 additions & 9 deletions AspNetWebStack/src/Microsoft.Web.Mvc/Resources/FormatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,8 @@ out object model
{
if (this.RequestFormatHandlers[i].CanDeserialize(requestFormat))
{
model = this.RequestFormatHandlers[i].Deserialize(
controllerContext,
bindingContext,
requestFormat
);
model = this.RequestFormatHandlers[i]
.Deserialize(controllerContext, bindingContext, requestFormat);
return true;
}
}
Expand Down Expand Up @@ -144,10 +141,8 @@ public bool TryMapFormatFriendlyName(string formatName, out ContentType contentT
for (int i = 0; i < this.ResponseFormatHandlers.Count; ++i)
{
if (
this.ResponseFormatHandlers[i].TryMapFormatFriendlyName(
formatName,
out contentType
)
this.ResponseFormatHandlers[i]
.TryMapFormatFriendlyName(formatName, out contentType)
)
{
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ public static RouteData CreateDirectRouteMatch(RouteBase route, List<RouteData>
//
// Inside the DefaultControllerFactory we'll double check the route data and throw if we have
// multiple controller matches, but for now let's just use the controller of the first match.
ControllerDescriptor controllerDescriptor = matches[
0
].GetTargetControllerDescriptor();
ControllerDescriptor controllerDescriptor = matches[0]
.GetTargetControllerDescriptor();
if (controllerDescriptor != null)
{
routeData.Values[RouteDataTokenKeys.Controller] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ params RegexReplacement[] regexReplacements
{
for (int i = 0; i < regexReplacements.Length; i++)
{
actual = regexReplacements[i].Regex.Replace(
actual,
regexReplacements[i].Replacement
);
actual = regexReplacements[i]
.Regex.Replace(actual, regexReplacements[i].Replacement);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public void BindModel()
.Returns(
delegate(ControllerContext cc, ExtensibleModelBindingContext mbc)
{
mbc.Model = mbc.ValueProvider.GetValue(mbc.ModelName)
mbc.Model = mbc
.ValueProvider.GetValue(mbc.ModelName)
.ConvertTo(mbc.ModelType);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ public void Should_only_replace_outer_parameters()
{
var db = new DB();

var user = db.Users.ProjectTo<UserViewModel>(Configuration, new { db })
var user = db
.Users.ProjectTo<UserViewModel>(Configuration, new { db })
.FirstOrDefault(a => a.Id == 2);

user.position.ShouldBe(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ from ctor in type.GetConstructors()
let parms = ctor.GetParameters()
where
parms.Length == 1
&& parms[0].ParameterType.IsAssignableFrom(
dictionaryAdapter.Meta.Type
)
&& parms[0]
.ParameterType.IsAssignableFrom(
dictionaryAdapter.Meta.Type
)
select ctor
).FirstOrDefault();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,8 @@ ApplyGenArgs genericParameterGenerator
{
// Doesn't matter

newGenericParameters[i].SetGenericParameterAttributes(
GenericParameterAttributes.None
);
newGenericParameters[i]
.SetGenericParameterAttributes(GenericParameterAttributes.None);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,12 @@ ParameterInfo[] baseMethodParameters
parametersOptionalCustomModifiers = new Type[parameterCount][];
for (int i = 0; i < parameterCount; ++i)
{
parametersRequiredCustomModifiers[i] = baseMethodParameters[
i
].GetRequiredCustomModifiers();
parametersRequiredCustomModifiers[i] = baseMethodParameters[i]
.GetRequiredCustomModifiers();
Array.Reverse(parametersRequiredCustomModifiers[i]);

parametersOptionalCustomModifiers[i] = baseMethodParameters[
i
].GetOptionalCustomModifiers();
parametersOptionalCustomModifiers[i] = baseMethodParameters[i]
.GetOptionalCustomModifiers();
Array.Reverse(parametersOptionalCustomModifiers[i]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ public void Example()
Console.WriteLine(string.Join(", ", firstProductNames));
// Headlight Fluid

decimal totalPrice = o["Manufacturers"].Sum(m =>
(decimal)m.SelectToken("Products[0].Price")
);
decimal totalPrice = o["Manufacturers"]
.Sum(m => (decimal)m.SelectToken("Products[0].Price"));

Console.WriteLine(totalPrice);
// 149.95
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7432,22 +7432,21 @@ public void ObjectRequiredDeserializeMissing()
Assert.IsNotNull(o);
Assert.AreEqual(4, errors.Count);
Assert.IsTrue(
errors[0].StartsWith(
"Required property 'NonAttributeProperty' not found in JSON. Path ''"
)
errors[0]
.StartsWith(
"Required property 'NonAttributeProperty' not found in JSON. Path ''"
)
);
Assert.IsTrue(
errors[1].StartsWith("Required property 'UnsetProperty' not found in JSON. Path ''")
);
Assert.IsTrue(
errors[2].StartsWith(
"Required property 'AllowNullProperty' not found in JSON. Path ''"
)
errors[2]
.StartsWith("Required property 'AllowNullProperty' not found in JSON. Path ''")
);
Assert.IsTrue(
errors[3].StartsWith(
"Required property 'AlwaysProperty' not found in JSON. Path ''"
)
errors[3]
.StartsWith("Required property 'AlwaysProperty' not found in JSON. Path ''")
);
}

Expand All @@ -7472,19 +7471,22 @@ public void ObjectRequiredDeserializeNull()
Assert.IsNotNull(o);
Assert.AreEqual(3, errors.Count);
Assert.IsTrue(
errors[0].StartsWith(
"Required property 'NonAttributeProperty' expects a value but got null. Path ''"
)
errors[0]
.StartsWith(
"Required property 'NonAttributeProperty' expects a value but got null. Path ''"
)
);
Assert.IsTrue(
errors[1].StartsWith(
"Required property 'UnsetProperty' expects a value but got null. Path ''"
)
errors[1]
.StartsWith(
"Required property 'UnsetProperty' expects a value but got null. Path ''"
)
);
Assert.IsTrue(
errors[2].StartsWith(
"Required property 'AlwaysProperty' expects a value but got null. Path ''"
)
errors[2]
.StartsWith(
"Required property 'AlwaysProperty' expects a value but got null. Path ''"
)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,14 +594,16 @@ public void MultipleRequiredPropertyErrors()

Assert.AreEqual(2, errors.Count);
Assert.IsTrue(
errors[0].StartsWith(
" - Required1 - Required property 'Required1' not found in JSON. Path '', line 1, position 2."
)
errors[0]
.StartsWith(
" - Required1 - Required property 'Required1' not found in JSON. Path '', line 1, position 2."
)
);
Assert.IsTrue(
errors[1].StartsWith(
" - Required2 - Required property 'Required2' not found in JSON. Path '', line 1, position 2."
)
errors[1]
.StartsWith(
" - Required2 - Required property 'Required2' not found in JSON. Path '', line 1, position 2."
)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ await context.Response.WriteAsync(
await context.Response.WriteAsync("Environment Variables:" + Environment.NewLine);
var vars = Environment.GetEnvironmentVariables();
foreach (
var key in vars.Keys.Cast<string>()
var key in vars
.Keys.Cast<string>()
.OrderBy(key => key, StringComparer.OrdinalIgnoreCase)
)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,8 @@ params Diagnostic[] diagnostics
$"Test base does not currently handle diagnostics in metadata locations. Diagnostic in metadata: {diagnostics[i]}\r\n"
);

string resultMethodName = diagnostics[
i
].Location.SourceTree.FilePath.EndsWith(".cs", StringComparison.Ordinal)
string resultMethodName = diagnostics[i]
.Location.SourceTree.FilePath.EndsWith(".cs", StringComparison.Ordinal)
? "GetCSharpResultAt"
: "GetBasicResultAt";
var linePosition = diagnostics[i].Location.GetLineSpan().StartLinePosition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public async ValueTask<IHtmlContent> PrerenderPersistedStateAsync(HttpContext ht

var renderModesMetadata = httpContext
.GetEndpoint()
?.Metadata
.GetMetadata<ConfiguredRenderModesMetadata>();
?.Metadata.GetMetadata<ConfiguredRenderModesMetadata>();

IPersistentComponentStateStore? store = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ IComponentRenderMode renderMode
{
var configuredRenderModesMetadata = httpContext
.GetEndpoint()
?.Metadata
.GetMetadata<ConfiguredRenderModesMetadata>();
?.Metadata.GetMetadata<ConfiguredRenderModesMetadata>();
if (configuredRenderModesMetadata is null)
{
// This is not a Razor Components endpoint. It might be that the app is using RazorComponentResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,8 @@ public bool TryDeserializeRootComponentOperations(
{
var operation = operations[i];
if (
seenSsrComponentIds[0..currentSsrComponentIdIndex].Contains(
operation.SsrComponentId
)
seenSsrComponentIds[0..currentSsrComponentIdIndex]
.Contains(operation.SsrComponentId)
)
{
Log.InvalidRootComponentOperation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ private void InitializeRegisteredRootComponents(IInternalJSImportMethods jsMetho
false,
null
);
registeredComponents[i].WriteWebAssemblyData(
assembly,
typeName,
serializedParameterDefinitions,
serializedParameterValues
);
registeredComponents[i]
.WriteWebAssemblyData(
assembly,
typeName,
serializedParameterDefinitions,
serializedParameterValues
);
registeredComponents[i].PrerenderId = i.ToString(CultureInfo.InvariantCulture);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ protected override string StartAndGetRootUri()
{
Host = CreateWebHost();
RunInBackgroundThread(Host.Start);
return Host.Services.GetRequiredService<IServer>()
return Host
.Services.GetRequiredService<IServer>()
.Features.Get<IServerAddressesFeature>()
.Addresses.Single();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public ClientSideAuthenticationStateData Get()
{
IsAuthenticated = User.Identity.IsAuthenticated,
UserName = User.Identity.Name,
ExposedClaims = User.Claims.Where(c => c.Type == "test-claim" || IsExposedRole(c))
ExposedClaims = User
.Claims.Where(c => c.Type == "test-claim" || IsExposedRole(c))
.Select(c => new ExposedClaim { Type = c.Type, Value = c.Value })
.ToList()
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,8 @@ CreateBuilderFunc createBuilder

var env0 = app.Services.GetRequiredService<IHostEnvironment>();

var env1 = app.Services.GetRequiredService<IServiceCollection>()
var env1 = app
.Services.GetRequiredService<IServiceCollection>()
.BuildServiceProvider()
.GetRequiredService<IHostEnvironment>();

Expand Down Expand Up @@ -1790,7 +1791,8 @@ CreateBuilderFunc createBuilder

var service0 = app.Services.GetRequiredService<IService>();

var service1 = app.Services.GetRequiredService<IServiceCollection>()
var service1 = app
.Services.GetRequiredService<IServiceCollection>()
.BuildServiceProvider()
.GetRequiredService<IService>();

Expand Down Expand Up @@ -1844,7 +1846,8 @@ CreateBuilderFunc createBuilder
var app = builder.Build();

var hostLifetime0 = app.Services.GetRequiredService<IHostLifetime>();
var childServiceProvider = app.Services.GetRequiredService<IServiceCollection>()
var childServiceProvider = app
.Services.GetRequiredService<IServiceCollection>()
.BuildServiceProvider();
var hostLifetime1 = childServiceProvider.GetRequiredService<IHostLifetime>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ public void AddMethod_OptionAdditionalBindings_ResolveMethods()
"/v1/additional_bindings/{name}",
additionalMethodModel
.Metadata.GetMetadata<GrpcJsonTranscodingMetadata>()
?.HttpRule
.Delete
?.HttpRule.Delete
);
Assert.Equal("/v1/additional_bindings/{name}", additionalMethodModel.RoutePattern.RawText);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ HostingApplication.Context context
{
var route = httpContext
.GetEndpoint()
?.Metadata
.GetMetadata<IRouteDiagnosticsMetadata>()
?.Metadata.GetMetadata<IRouteDiagnosticsMetadata>()
?.Route;
var customTags = context.MetricsTagsFeature?.TagsList;

Expand Down
3 changes: 1 addition & 2 deletions aspnetcore/src/Http/Routing/src/EndpointRoutingMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ private void SetMaxRequestBodySize(HttpContext context)
{
var sizeLimitMetadata = context
.GetEndpoint()
?.Metadata
?.GetMetadata<IRequestSizeLimitMetadata>();
?.Metadata?.GetMetadata<IRequestSizeLimitMetadata>();
if (sizeLimitMetadata == null)
{
Log.RequestSizeLimitMetadataNotFound(_logger);
Expand Down
Loading