Skip to content

Commit e033f15

Browse files
committed
Add more nullability to Mvc.Core
1 parent 30e468e commit e033f15

File tree

201 files changed

+1930
-2126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+1930
-2126
lines changed

src/Mvc/Mvc.Abstractions/src/Abstractions/ActionDescriptor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public ActionDescriptor()
2121
{
2222
Id = Guid.NewGuid().ToString();
2323
Properties = new Dictionary<object, object>();
24-
RouteValues = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
24+
RouteValues = new Dictionary<string, string?>(StringComparer.OrdinalIgnoreCase);
2525
}
2626

2727
/// <summary>
@@ -33,7 +33,7 @@ public ActionDescriptor()
3333
/// Gets or sets the collection of route values that must be provided by routing
3434
/// for the action to be selected.
3535
/// </summary>
36-
public IDictionary<string, string> RouteValues { get; set; }
36+
public IDictionary<string, string?> RouteValues { get; set; }
3737

3838
/// <summary>
3939
/// Gets or sets the <see cref="Routing.AttributeRouteInfo"/>.

src/Mvc/Mvc.Abstractions/src/Abstractions/ParameterDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ public class ParameterDescriptor
2424
/// <summary>
2525
/// Gets or sets the <see cref="ModelBinding.BindingInfo"/> for the parameter.
2626
/// </summary>
27-
public BindingInfo BindingInfo { get; set; } = default!;
27+
public BindingInfo? BindingInfo { get; set; }
2828
}
2929
}

src/Mvc/Mvc.Abstractions/src/ActionConstraints/ActionConstraintItem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public ActionConstraintItem(IActionConstraintMetadata metadata)
2828
/// <summary>
2929
/// The <see cref="IActionConstraint"/> associated with <see cref="Metadata"/>.
3030
/// </summary>
31-
public IActionConstraint Constraint { get; set; } = default!;
31+
public IActionConstraint? Constraint { get; set; }
3232

3333
/// <summary>
3434
/// The <see cref="IActionConstraintMetadata"/> instance.
@@ -40,4 +40,4 @@ public ActionConstraintItem(IActionConstraintMetadata metadata)
4040
/// </summary>
4141
public bool IsReusable { get; set; }
4242
}
43-
}
43+
}

src/Mvc/Mvc.Abstractions/src/ActionConstraints/ActionSelectorCandidate.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public readonly struct ActionSelectorCandidate
1919
/// <param name="constraints">
2020
/// The list of <see cref="IActionConstraint"/> instances associated with <paramref name="action"/>.
2121
/// </param>
22-
public ActionSelectorCandidate(ActionDescriptor action, IReadOnlyList<IActionConstraint> constraints)
22+
public ActionSelectorCandidate(ActionDescriptor action, IReadOnlyList<IActionConstraint>? constraints)
2323
{
2424
if (action == null)
2525
{
@@ -38,6 +38,6 @@ public ActionSelectorCandidate(ActionDescriptor action, IReadOnlyList<IActionCon
3838
/// <summary>
3939
/// The list of <see cref="IActionConstraint"/> instances associated with <see name="Action"/>.
4040
/// </summary>
41-
public IReadOnlyList<IActionConstraint> Constraints { get; }
41+
public IReadOnlyList<IActionConstraint>? Constraints { get; }
4242
}
43-
}
43+
}

src/Mvc/Mvc.Abstractions/src/Filters/FilterItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public FilterItem(FilterDescriptor descriptor, IFilterMetadata filter)
5353
/// <summary>
5454
/// Gets or sets the executable <see cref="IFilterMetadata"/> associated with <see cref="Descriptor"/>.
5555
/// </summary>
56-
public IFilterMetadata Filter { get; set; } = default!;
56+
public IFilterMetadata? Filter { get; set; }
5757

5858
/// <summary>
5959
/// Gets or sets a value indicating whether or not <see cref="Filter"/> can be reused across requests.

src/Mvc/Mvc.Abstractions/src/Formatters/InputFormatterResult.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ private InputFormatterResult(bool hasError)
2020
HasError = hasError;
2121
}
2222

23-
private InputFormatterResult(object model)
23+
private InputFormatterResult(object? model)
2424
{
2525
Model = model;
2626
IsModelSet = true;
@@ -79,7 +79,7 @@ public static Task<InputFormatterResult> FailureAsync()
7979
/// An <see cref="InputFormatterResult"/> indicating the <see cref="IInputFormatter.ReadAsync"/>
8080
/// operation succeeded i.e. with <see cref="HasError"/> <c>false</c>.
8181
/// </returns>
82-
public static InputFormatterResult Success(object model)
82+
public static InputFormatterResult Success(object? model)
8383
{
8484
return new InputFormatterResult(model);
8585
}
@@ -93,7 +93,7 @@ public static InputFormatterResult Success(object model)
9393
/// A <see cref="Task"/> that on completion provides an <see cref="InputFormatterResult"/> indicating the
9494
/// <see cref="IInputFormatter.ReadAsync"/> operation succeeded i.e. with <see cref="HasError"/> <c>false</c>.
9595
/// </returns>
96-
public static Task<InputFormatterResult> SuccessAsync(object model)
96+
public static Task<InputFormatterResult> SuccessAsync(object? model)
9797
{
9898
return Task.FromResult(Success(model));
9999
}

src/Mvc/Mvc.Abstractions/src/ModelBinding/IBinderTypeProviderMetadata.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public interface IBinderTypeProviderMetadata : IBindingSourceMetadata
1313
/// <summary>
1414
/// A <see cref="Type"/> which implements either <see cref="IModelBinder"/>.
1515
/// </summary>
16-
Type BinderType { get; }
16+
Type? BinderType { get; }
1717
}
1818
}

src/Mvc/Mvc.Abstractions/src/ModelBinding/IModelNameProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ public interface IModelNameProvider
1111
/// <summary>
1212
/// Model name.
1313
/// </summary>
14-
string Name { get; }
14+
string? Name { get; }
1515
}
1616
}

src/Mvc/Mvc.Abstractions/src/PublicAPI.Unshipped.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,27 @@
3939
*REMOVED*virtual Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext.ActionArguments.get -> System.Collections.Generic.IDictionary<string!, object!>!
4040
*REMOVED*virtual Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.BoundConstructorInvoker.get -> System.Func<object![]!, object!>?
4141
*REMOVED*virtual Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.ContainerMetadata.get -> Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata!
42+
*REMOVED*Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor.RouteValues.get -> System.Collections.Generic.IDictionary<string!, string!>!
43+
*REMOVED*Microsoft.AspNetCore.Mvc.Abstractions.ParameterDescriptor.BindingInfo.get -> Microsoft.AspNetCore.Mvc.ModelBinding.BindingInfo!
44+
*REMOVED*Microsoft.AspNetCore.Mvc.ActionConstraints.ActionConstraintItem.Constraint.get -> Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint!
45+
*REMOVED*Microsoft.AspNetCore.Mvc.ActionConstraints.ActionSelectorCandidate.ActionSelectorCandidate(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor! action, System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint!>! constraints) -> void
46+
*REMOVED*Microsoft.AspNetCore.Mvc.ActionConstraints.ActionSelectorCandidate.Constraints.get -> System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint!>!
47+
*REMOVED*Microsoft.AspNetCore.Mvc.Filters.FilterItem.Filter.get -> Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata!
48+
*REMOVED*Microsoft.AspNetCore.Mvc.ModelBinding.IBinderTypeProviderMetadata.BinderType.get -> System.Type!
49+
*REMOVED*Microsoft.AspNetCore.Mvc.ModelBinding.IModelNameProvider.Name.get -> string!
50+
*REMOVED*Microsoft.AspNetCore.Mvc.Routing.AttributeRouteInfo.Name.get -> string!
51+
*REMOVED*static Microsoft.AspNetCore.Mvc.Formatters.InputFormatterResult.Success(object! model) -> Microsoft.AspNetCore.Mvc.Formatters.InputFormatterResult!
52+
*REMOVED*static Microsoft.AspNetCore.Mvc.Formatters.InputFormatterResult.SuccessAsync(object! model) -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.Formatters.InputFormatterResult!>!
53+
Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor.RouteValues.get -> System.Collections.Generic.IDictionary<string!, string?>!
54+
Microsoft.AspNetCore.Mvc.Abstractions.ParameterDescriptor.BindingInfo.get -> Microsoft.AspNetCore.Mvc.ModelBinding.BindingInfo?
55+
Microsoft.AspNetCore.Mvc.ActionConstraints.ActionConstraintItem.Constraint.get -> Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint?
56+
Microsoft.AspNetCore.Mvc.ActionConstraints.ActionSelectorCandidate.ActionSelectorCandidate(Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor! action, System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint!>? constraints) -> void
57+
Microsoft.AspNetCore.Mvc.ActionConstraints.ActionSelectorCandidate.Constraints.get -> System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraint!>?
4258
Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext.ActionExecutingContext(Microsoft.AspNetCore.Mvc.ActionContext! actionContext, System.Collections.Generic.IList<Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata!>! filters, System.Collections.Generic.IDictionary<string!, object?>! actionArguments, object! controller) -> void
59+
Microsoft.AspNetCore.Mvc.Filters.FilterItem.Filter.get -> Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata?
4360
Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterWriteContext.OutputFormatterWriteContext(Microsoft.AspNetCore.Http.HttpContext! httpContext, System.Func<System.IO.Stream!, System.Text.Encoding!, System.IO.TextWriter!>! writerFactory, System.Type? objectType, object? object) -> void
61+
Microsoft.AspNetCore.Mvc.ModelBinding.IBinderTypeProviderMetadata.BinderType.get -> System.Type?
62+
Microsoft.AspNetCore.Mvc.ModelBinding.IModelNameProvider.Name.get -> string?
4463
Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary.SetModelValue(string! key, object? rawValue, string? attemptedValue) -> void
4564
Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary.this[string! key].get -> Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateEntry?
4665
Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ClientValidatorItem.ClientValidatorItem(object? validatorMetadata) -> void
@@ -53,6 +72,7 @@ Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationEntry.ValidationEntry
5372
Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationEntry.ValidationEntry(Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata! metadata, string! key, object? model) -> void
5473
Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidatorItem.Validator.get -> Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IModelValidator?
5574
Microsoft.AspNetCore.Mvc.ModelBinding.ValueProviderResult.ValueProviderResult(Microsoft.Extensions.Primitives.StringValues values, System.Globalization.CultureInfo? culture) -> void
75+
Microsoft.AspNetCore.Mvc.Routing.AttributeRouteInfo.Name.get -> string?
5676
abstract Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext.BinderModelName.get -> string?
5777
abstract Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext.BindingSource.get -> Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource?
5878
abstract Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext.EnterNestedScope(Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata! modelMetadata, string! fieldName, string! modelName, object? model) -> Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext.NestedScope
@@ -75,6 +95,8 @@ abstract Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.PropertyGetter.get
7595
abstract Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.PropertySetter.get -> System.Action<object!, object?>?
7696
abstract Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.SimpleDisplayProperty.get -> string?
7797
abstract Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.TemplateHint.get -> string?
98+
static Microsoft.AspNetCore.Mvc.Formatters.InputFormatterResult.Success(object? model) -> Microsoft.AspNetCore.Mvc.Formatters.InputFormatterResult!
99+
static Microsoft.AspNetCore.Mvc.Formatters.InputFormatterResult.SuccessAsync(object? model) -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.Formatters.InputFormatterResult!>!
78100
virtual Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext.Result.get -> Microsoft.AspNetCore.Mvc.IActionResult?
79101
virtual Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext.ActionArguments.get -> System.Collections.Generic.IDictionary<string!, object?>!
80102
virtual Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata.BoundConstructorInvoker.get -> System.Func<object?[]!, object!>?

src/Mvc/Mvc.Abstractions/src/Routing/AttributeRouteInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class AttributeRouteInfo
2727
/// to generate a link by referring to the route by name instead of attempting to match a
2828
/// route by provided route data.
2929
/// </summary>
30-
public string Name { get; set; } = default!;
30+
public string? Name { get; set; }
3131

3232
/// <summary>
3333
/// Gets or sets a value that determines if the route entry associated with this model participates in link generation.

0 commit comments

Comments
 (0)