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 array-access-break #89

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
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 3 additions & 1 deletion AspNetWebStack/src/Common/Routing/DirectRouteBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ var contentSegment in parsedRoute.PathSegments.OfType<PathContentSegment>()
if (contentSegment != null && contentSegment.Subsegments != null)
{
foreach (
var parameterSegment in contentSegment.Subsegments.OfType<PathParameterSubsegment>()
var parameterSegment in contentSegment
.Subsegments
.OfType<PathParameterSubsegment>()
)
{
if (parameterSegment != null)
Expand Down
3 changes: 2 additions & 1 deletion AspNetWebStack/src/Common/Routing/RoutePrecedence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ IDictionary<string, object> constraints
{
// Each precedence digit corresponds to one decimal place. For example, 3 segments with precedences 2, 1,
// and 4 results in a combined precedence of 2.14 (decimal).
IList<PathContentSegment> segments = parsedRoute.PathSegments
IList<PathContentSegment> segments = parsedRoute
.PathSegments
.OfType<PathContentSegment>()
.ToArray();

Expand Down
3 changes: 2 additions & 1 deletion AspNetWebStack/src/Common/TraceWriterExceptionMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ private static HttpResponseException ExtractHttpResponseException(Exception exce
{
httpResponseException = aggregateException
.Flatten()
.InnerExceptions.Select(ExtractHttpResponseException)
.InnerExceptions
.Select(ExtractHttpResponseException)
.Where(ex => ex != null && ex.Response != null)
.OrderByDescending(ex => ex.Response.StatusCode)
.FirstOrDefault();
Expand Down
6 changes: 3 additions & 3 deletions AspNetWebStack/src/Common/UriQueryUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public static string UrlEncode(string str)
return WebUtility.UrlEncode(str);
#else
byte[] bytes = Encoding.UTF8.GetBytes(str);
return Encoding.ASCII.GetString(
UrlEncode(bytes, 0, bytes.Length, alwaysCreateNewReturnValue: false)
);
return Encoding
.ASCII
.GetString(UrlEncode(bytes, 0, bytes.Length, alwaysCreateNewReturnValue: false));
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ public virtual void OnAuthorization(AuthorizationContext filterContext)
throw new ArgumentNullException("filterContext");
}

IEnumerable<FacebookAuthorizeAttribute> authorizeAttributes =
filterContext.ActionDescriptor
.GetCustomAttributes(typeof(FacebookAuthorizeAttribute), inherit: true)
.Union(
filterContext.ActionDescriptor.ControllerDescriptor.GetCustomAttributes(
typeof(FacebookAuthorizeAttribute),
inherit: true
)
)
.OfType<FacebookAuthorizeAttribute>();
IEnumerable<FacebookAuthorizeAttribute> authorizeAttributes = filterContext
.ActionDescriptor
.GetCustomAttributes(typeof(FacebookAuthorizeAttribute), inherit: true)
.Union(
filterContext
.ActionDescriptor
.ControllerDescriptor
.GetCustomAttributes(typeof(FacebookAuthorizeAttribute), inherit: true)
)
.OfType<FacebookAuthorizeAttribute>();
if (!authorizeAttributes.Any())
{
return;
Expand Down Expand Up @@ -147,8 +147,9 @@ public virtual void OnAuthorization(AuthorizationContext filterContext)
}
else if (requiredPermissions.Any())
{
PermissionsStatus currentPermissionsStatus =
_config.PermissionService.GetUserPermissionsStatus(userId, accessToken);
PermissionsStatus currentPermissionsStatus = _config
.PermissionService
.GetUserPermissionsStatus(userId, accessToken);
// Instead of performing another request to gather "granted" permissions just parse the status
IEnumerable<string> currentPermissions = PermissionHelper.GetGrantedPermissions(
currentPermissionsStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ private static IList<string> GetFieldNames(Type modelType, HashSet<Type> typesVi
foreach (PropertyInfo property in properties)
{
string propertyName = property.Name;
AttributeCollection attributes = TypeDescriptor.GetProperties(modelType)[
propertyName
].Attributes;
AttributeCollection attributes = TypeDescriptor
.GetProperties(modelType)[propertyName]
.Attributes;

JsonIgnoreAttribute jsonIgnoreAttribute = (JsonIgnoreAttribute)
attributes[typeof(JsonIgnoreAttribute)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ ModelBindingContext bindingContext
}
else
{
bindingContext.ModelState.AddModelError(
bindingContext.ModelName,
Resources.MissingSignedRequest
);
bindingContext
.ModelState
.AddModelError(bindingContext.ModelName, Resources.MissingSignedRequest);
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,31 @@ ModelBindingContext bindingContext
{
if (!originUrl.StartsWith(_config.AppUrl, StringComparison.OrdinalIgnoreCase))
{
bindingContext.ModelState.AddModelError(
bindingContext
.ModelState
.AddModelError(
bindingContext.ModelName,
String.Format(
CultureInfo.CurrentCulture,
Resources.UrlCannotBeExternal,
"originUrl",
_config.AppUrl
)
);
}
}
else
{
bindingContext
.ModelState
.AddModelError(
bindingContext.ModelName,
String.Format(
CultureInfo.CurrentCulture,
Resources.UrlCannotBeExternal,
"originUrl",
_config.AppUrl
Resources.ParameterIsRequired,
"originUrl"
)
);
}
}
else
{
bindingContext.ModelState.AddModelError(
bindingContext.ModelName,
String.Format(
CultureInfo.CurrentCulture,
Resources.ParameterIsRequired,
"originUrl"
)
);
}

string redirectUrl = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ private static IEnumerable<string> GetPermissionsWithStatus(
PermissionStatus status
)
{
return permissionsStatus.Status
return permissionsStatus
.Status
.Where(kvp => kvp.Value == status)
.Select(kvp => kvp.Key);
}
Expand Down
8 changes: 3 additions & 5 deletions AspNetWebStack/src/Microsoft.Web.Mvc/Controls/ActionLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ protected override void Render(HtmlTextWriter writer)
}
else
{
VirtualPathData vpd = RouteTable.Routes.GetVirtualPathForArea(
ViewContext.RequestContext,
RouteName,
routeValues
);
VirtualPathData vpd = RouteTable
.Routes
.GetVirtualPathForArea(ViewContext.RequestContext, RouteName, routeValues);
if (vpd == null)
{
throw new InvalidOperationException(
Expand Down
10 changes: 6 additions & 4 deletions AspNetWebStack/src/Microsoft.Web.Mvc/Controls/DropDownList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ private object GetModelStateValue(string key, Type destinationType)
ModelState modelState;
if (ViewData.ModelState.TryGetValue(key, out modelState))
{
return modelState.Value.ConvertTo(
destinationType,
null /* culture */
);
return modelState
.Value
.ConvertTo(
destinationType,
null /* culture */
);
}
return null;
}
Expand Down
10 changes: 6 additions & 4 deletions AspNetWebStack/src/Microsoft.Web.Mvc/Controls/MvcInputControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ private object GetModelStateValue(Type destinationType)
ModelState modelState = GetModelState();
if (modelState != null)
{
return modelState.Value.ConvertTo(
destinationType,
null /* culture */
);
return modelState
.Value
.ConvertTo(
destinationType,
null /* culture */
);
}
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions AspNetWebStack/src/Microsoft.Web.Mvc/DeserializeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ ModelBindingContext bindingContext
throw new ArgumentNullException("bindingContext");
}

ValueProviderResult valueProviderResult = bindingContext.ValueProvider.GetValue(
bindingContext.ModelName
);
ValueProviderResult valueProviderResult = bindingContext
.ValueProvider
.GetValue(bindingContext.ModelName);
if (valueProviderResult == null)
{
// nothing found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ protected override Expression VisitBinary(BinaryExpression node)
{
return node;
}
_currentChain.Elements.Add(
new BinaryExpressionFingerprint(node.NodeType, node.Type, node.Method)
);
_currentChain
.Elements
.Add(new BinaryExpressionFingerprint(node.NodeType, node.Type, node.Method));
return base.VisitBinary(node);
}

Expand All @@ -91,9 +91,9 @@ protected override Expression VisitConditional(ConditionalExpression node)
{
return node;
}
_currentChain.Elements.Add(
new ConditionalExpressionFingerprint(node.NodeType, node.Type)
);
_currentChain
.Elements
.Add(new ConditionalExpressionFingerprint(node.NodeType, node.Type));
return base.VisitConditional(node);
}

Expand Down Expand Up @@ -150,9 +150,9 @@ protected override Expression VisitIndex(IndexExpression node)
{
return node;
}
_currentChain.Elements.Add(
new IndexExpressionFingerprint(node.NodeType, node.Type, node.Indexer)
);
_currentChain
.Elements
.Add(new IndexExpressionFingerprint(node.NodeType, node.Type, node.Indexer));
return base.VisitIndex(node);
}

Expand Down Expand Up @@ -197,9 +197,9 @@ protected override Expression VisitMember(MemberExpression node)
{
return node;
}
_currentChain.Elements.Add(
new MemberExpressionFingerprint(node.NodeType, node.Type, node.Member)
);
_currentChain
.Elements
.Add(new MemberExpressionFingerprint(node.NodeType, node.Type, node.Member));
return base.VisitMember(node);
}

Expand Down Expand Up @@ -234,9 +234,9 @@ protected override Expression VisitMethodCall(MethodCallExpression node)
{
return node;
}
_currentChain.Elements.Add(
new MethodCallExpressionFingerprint(node.NodeType, node.Type, node.Method)
);
_currentChain
.Elements
.Add(new MethodCallExpressionFingerprint(node.NodeType, node.Type, node.Method));
return base.VisitMethodCall(node);
}

Expand Down Expand Up @@ -265,9 +265,9 @@ protected override Expression VisitParameter(ParameterExpression node)
_seenParameters.Add(node);
}

_currentChain.Elements.Add(
new ParameterExpressionFingerprint(node.NodeType, node.Type, parameterIndex)
);
_currentChain
.Elements
.Add(new ParameterExpressionFingerprint(node.NodeType, node.Type, parameterIndex));
return base.VisitParameter(node);
}

Expand Down Expand Up @@ -297,9 +297,11 @@ protected override Expression VisitTypeBinary(TypeBinaryExpression node)
{
return node;
}
_currentChain.Elements.Add(
new TypeBinaryExpressionFingerprint(node.NodeType, node.Type, node.TypeOperand)
);
_currentChain
.Elements
.Add(
new TypeBinaryExpressionFingerprint(node.NodeType, node.Type, node.TypeOperand)
);
return base.VisitTypeBinary(node);
}

Expand All @@ -309,9 +311,9 @@ protected override Expression VisitUnary(UnaryExpression node)
{
return node;
}
_currentChain.Elements.Add(
new UnaryExpressionFingerprint(node.NodeType, node.Type, node.Method)
);
_currentChain
.Elements
.Add(new UnaryExpressionFingerprint(node.NodeType, node.Type, node.Method));
return base.VisitUnary(node);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ ExtensibleModelBindingContext bindingContext
)
{
ModelBinderUtil.ValidateBindingContext(bindingContext);
ValueProviderResult valueProviderResult = bindingContext.ValueProvider.GetValue(
bindingContext.ModelName
);
ValueProviderResult valueProviderResult = bindingContext
.ValueProvider
.GetValue(bindingContext.ModelName);

// case 1: there was no <input ... /> element containing this data
if (valueProviderResult == null)
Expand Down
Loading