diff --git a/samples/MvcSample.Web/project.json b/samples/MvcSample.Web/project.json
index 83409b709e..53ac6ff07f 100644
--- a/samples/MvcSample.Web/project.json
+++ b/samples/MvcSample.Web/project.json
@@ -18,15 +18,7 @@
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.Session": "1.0.0-*",
"Microsoft.AspNet.StaticFiles": "1.0.0-*",
- "Microsoft.Framework.Configuration.Json": "1.0.0-*",
- "Microsoft.Framework.PropertyHelper.Sources": {
- "version": "1.0.0-*",
- "type": "build"
- },
- "Microsoft.Framework.NotNullAttribute.Sources": {
- "type": "build",
- "version": "1.0.0-*"
- }
+ "Microsoft.Framework.Configuration.Json": "1.0.0-*"
},
"frameworks": {
"dnx451": { },
diff --git a/samples/TagHelperSample.Web/project.json b/samples/TagHelperSample.Web/project.json
index 8f856d1b6c..76b2437964 100644
--- a/samples/TagHelperSample.Web/project.json
+++ b/samples/TagHelperSample.Web/project.json
@@ -15,9 +15,7 @@
"Microsoft.AspNet.Server.IIS": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.StaticFiles": "1.0.0-*",
- "Microsoft.AspNet.Tooling.Razor": "1.0.0-*",
- "Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" },
- "Microsoft.Framework.PropertyHelper.Sources": { "version": "1.0.0-*", "type": "build" }
+ "Microsoft.AspNet.Tooling.Razor": "1.0.0-*"
},
"frameworks": {
"dnx451": { },
diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs
index cbbfb4eca3..1d75b25bd9 100644
--- a/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs
+++ b/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs
@@ -147,14 +147,15 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
TagBuilder tagBuilder;
if (Route == null)
{
- tagBuilder = Generator.GenerateActionLink(linkText: string.Empty,
- actionName: Action,
- controllerName: Controller,
- protocol: Protocol,
- hostname: Host,
- fragment: Fragment,
- routeValues: routeValues,
- htmlAttributes: null);
+ tagBuilder = Generator.GenerateActionLink(
+ linkText: string.Empty,
+ actionName: Action,
+ controllerName: Controller,
+ protocol: Protocol,
+ hostname: Host,
+ fragment: Fragment,
+ routeValues: routeValues,
+ htmlAttributes: null);
}
else if (Action != null || Controller != null)
{
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Controller.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Controller.cs
index f2b9497f85..dc0510438f 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Controller.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Controller.cs
@@ -104,8 +104,8 @@ namespace Microsoft.AspNet.Mvc
///
///
/// activates this property while activating controllers.
- /// If user code directly instantiates a controller, the getter returns an empty
- /// .
+ /// If user code directly instantiates a controller, the getter returns an empty
+ /// .
///
[ActionContext]
public ActionContext ActionContext
@@ -147,10 +147,13 @@ namespace Microsoft.AspNet.Mvc
return _metadataProvider;
}
-
- [param: NotNull]
set
{
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
_metadataProvider = value;
}
}
@@ -169,10 +172,13 @@ namespace Microsoft.AspNet.Mvc
return _url;
}
-
- [param: NotNull]
set
{
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
_url = value;
}
}
@@ -191,10 +197,13 @@ namespace Microsoft.AspNet.Mvc
return _objectValidator;
}
-
- [param: NotNull]
set
{
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
_objectValidator = value;
}
}
@@ -259,10 +268,13 @@ namespace Microsoft.AspNet.Mvc
return _tempData;
}
-
- [param: NotNull]
set
{
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
_tempData = value;
}
}
@@ -525,8 +537,13 @@ namespace Microsoft.AspNet.Mvc
/// Callers should cache an instance of to avoid
/// recreating cached data with each call.
[NonAction]
- public virtual JsonResult Json(object data, [NotNull] JsonSerializerSettings serializerSettings)
+ public virtual JsonResult Json(object data, JsonSerializerSettings serializerSettings)
{
+ if (serializerSettings == null)
+ {
+ throw new ArgumentNullException(nameof(serializerSettings));
+ }
+
var disposableValue = data as IDisposable;
if (disposableValue != null)
{
@@ -981,8 +998,13 @@ namespace Microsoft.AspNet.Mvc
///
/// The created for the response.
[NonAction]
- public virtual BadRequestObjectResult HttpBadRequest([NotNull] ModelStateDictionary modelState)
+ public virtual BadRequestObjectResult HttpBadRequest(ModelStateDictionary modelState)
{
+ if (modelState == null)
+ {
+ throw new ArgumentNullException(nameof(modelState));
+ }
+
return new BadRequestObjectResult(modelState);
}
@@ -993,8 +1015,13 @@ namespace Microsoft.AspNet.Mvc
/// The content value to format in the entity body.
/// The created for the response.
[NonAction]
- public virtual CreatedResult Created([NotNull] string uri, object value)
+ public virtual CreatedResult Created(string uri, object value)
{
+ if (uri == null)
+ {
+ throw new ArgumentNullException(nameof(uri));
+ }
+
var disposableValue = value as IDisposable;
if (disposableValue != null)
{
@@ -1011,14 +1038,19 @@ namespace Microsoft.AspNet.Mvc
/// The content value to format in the entity body.
/// The created for the response.
[NonAction]
- public virtual CreatedResult Created([NotNull] Uri uri, object value)
+ public virtual CreatedResult Created(Uri uri, object value)
{
+ if (uri == null)
+ {
+ throw new ArgumentNullException(nameof(uri));
+ }
+
var disposableValue = value as IDisposable;
if (disposableValue != null)
{
Response.RegisterForDispose(disposableValue);
}
-
+
return new CreatedResult(uri, value);
}
@@ -1119,8 +1151,12 @@ namespace Microsoft.AspNet.Mvc
///
/// The action executing context.
[NonAction]
- public virtual void OnActionExecuting([NotNull] ActionExecutingContext context)
+ public virtual void OnActionExecuting(ActionExecutingContext context)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
}
///
@@ -1128,8 +1164,12 @@ namespace Microsoft.AspNet.Mvc
///
/// The action executed context.
[NonAction]
- public virtual void OnActionExecuted([NotNull] ActionExecutedContext context)
+ public virtual void OnActionExecuted(ActionExecutedContext context)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
}
///
@@ -1141,9 +1181,19 @@ namespace Microsoft.AspNet.Mvc
/// A instance.
[NonAction]
public virtual async Task OnActionExecutionAsync(
- [NotNull] ActionExecutingContext context,
- [NotNull] ActionExecutionDelegate next)
+ ActionExecutingContext context,
+ ActionExecutionDelegate next)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ if (next == null)
+ {
+ throw new ArgumentNullException(nameof(next));
+ }
+
OnActionExecuting(context);
if (context.Result == null)
{
@@ -1160,9 +1210,14 @@ namespace Microsoft.AspNet.Mvc
/// A that on completion returns true if the update is successful.
[NonAction]
public virtual Task TryUpdateModelAsync(
- [NotNull] TModel model)
+ TModel model)
where TModel : class
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
return TryUpdateModelAsync(model, prefix: string.Empty);
}
@@ -1177,10 +1232,20 @@ namespace Microsoft.AspNet.Mvc
/// A that on completion returns true if the update is successful.
[NonAction]
public virtual Task TryUpdateModelAsync(
- [NotNull] TModel model,
- [NotNull] string prefix)
+ TModel model,
+ string prefix)
where TModel : class
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ if (prefix == null)
+ {
+ throw new ArgumentNullException(nameof(prefix));
+ }
+
if (BindingContext == null)
{
var message = Resources.FormatPropertyOfTypeCannotBeNull(
@@ -1204,11 +1269,26 @@ namespace Microsoft.AspNet.Mvc
/// A that on completion returns true if the update is successful.
[NonAction]
public virtual Task TryUpdateModelAsync(
- [NotNull] TModel model,
- [NotNull] string prefix,
- [NotNull] IValueProvider valueProvider)
+ TModel model,
+ string prefix,
+ IValueProvider valueProvider)
where TModel : class
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ if (prefix == null)
+ {
+ throw new ArgumentNullException(nameof(prefix));
+ }
+
+ if (valueProvider == null)
+ {
+ throw new ArgumentNullException(nameof(valueProvider));
+ }
+
if (BindingContext == null)
{
var message = Resources.FormatPropertyOfTypeCannotBeNull(
@@ -1243,11 +1323,21 @@ namespace Microsoft.AspNet.Mvc
/// A that on completion returns true if the update is successful.
[NonAction]
public Task TryUpdateModelAsync(
- [NotNull] TModel model,
+ TModel model,
string prefix,
- [NotNull] params Expression>[] includeExpressions)
+ params Expression>[] includeExpressions)
where TModel : class
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ if (includeExpressions == null)
+ {
+ throw new ArgumentNullException(nameof(includeExpressions));
+ }
+
if (BindingContext == null)
{
var message = Resources.FormatPropertyOfTypeCannotBeNull(
@@ -1282,11 +1372,21 @@ namespace Microsoft.AspNet.Mvc
/// A that on completion returns true if the update is successful.
[NonAction]
public Task TryUpdateModelAsync(
- [NotNull] TModel model,
+ TModel model,
string prefix,
- [NotNull] Func predicate)
+ Func predicate)
where TModel : class
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ if (predicate == null)
+ {
+ throw new ArgumentNullException(nameof(predicate));
+ }
+
if (BindingContext == null)
{
var message = Resources.FormatPropertyOfTypeCannotBeNull(
@@ -1323,12 +1423,27 @@ namespace Microsoft.AspNet.Mvc
/// A that on completion returns true if the update is successful.
[NonAction]
public Task TryUpdateModelAsync(
- [NotNull] TModel model,
+ TModel model,
string prefix,
- [NotNull] IValueProvider valueProvider,
- [NotNull] params Expression>[] includeExpressions)
+ IValueProvider valueProvider,
+ params Expression>[] includeExpressions)
where TModel : class
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ if (valueProvider == null)
+ {
+ throw new ArgumentNullException(nameof(valueProvider));
+ }
+
+ if (includeExpressions == null)
+ {
+ throw new ArgumentNullException(nameof(includeExpressions));
+ }
+
if (BindingContext == null)
{
var message = Resources.FormatPropertyOfTypeCannotBeNull(
@@ -1364,12 +1479,27 @@ namespace Microsoft.AspNet.Mvc
/// A that on completion returns true if the update is successful.
[NonAction]
public Task TryUpdateModelAsync(
- [NotNull] TModel model,
+ TModel model,
string prefix,
- [NotNull] IValueProvider valueProvider,
- [NotNull] Func predicate)
+ IValueProvider valueProvider,
+ Func predicate)
where TModel : class
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ if (valueProvider == null)
+ {
+ throw new ArgumentNullException(nameof(valueProvider));
+ }
+
+ if (predicate == null)
+ {
+ throw new ArgumentNullException(nameof(predicate));
+ }
+
if (BindingContext == null)
{
var message = Resources.FormatPropertyOfTypeCannotBeNull(
@@ -1403,10 +1533,20 @@ namespace Microsoft.AspNet.Mvc
/// A that on completion returns true if the update is successful.
[NonAction]
public virtual Task TryUpdateModelAsync(
- [NotNull] object model,
- [NotNull] Type modelType,
+ object model,
+ Type modelType,
string prefix)
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ if (modelType == null)
+ {
+ throw new ArgumentNullException(nameof(modelType));
+ }
+
if (BindingContext == null)
{
var message = Resources.FormatPropertyOfTypeCannotBeNull(
@@ -1442,12 +1582,32 @@ namespace Microsoft.AspNet.Mvc
/// A that on completion returns true if the update is successful.
[NonAction]
public Task TryUpdateModelAsync(
- [NotNull] object model,
- [NotNull] Type modelType,
+ object model,
+ Type modelType,
string prefix,
- [NotNull] IValueProvider valueProvider,
- [NotNull] Func predicate)
+ IValueProvider valueProvider,
+ Func predicate)
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ if (modelType == null)
+ {
+ throw new ArgumentNullException(nameof(modelType));
+ }
+
+ if (valueProvider == null)
+ {
+ throw new ArgumentNullException(nameof(valueProvider));
+ }
+
+ if (predicate == null)
+ {
+ throw new ArgumentNullException(nameof(predicate));
+ }
+
if (BindingContext == null)
{
var message = Resources.FormatPropertyOfTypeCannotBeNull(
@@ -1478,8 +1638,13 @@ namespace Microsoft.AspNet.Mvc
/// true if the is valid; false otherwise.
[NonAction]
public virtual bool TryValidateModel(
- [NotNull] object model)
+ object model)
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
return TryValidateModel(model, prefix: null);
}
@@ -1492,9 +1657,14 @@ namespace Microsoft.AspNet.Mvc
/// true if the is valid;false otherwise.
[NonAction]
public virtual bool TryValidateModel(
- [NotNull] object model,
+ object model,
string prefix)
{
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
if (BindingContext == null)
{
var message = Resources.FormatPropertyOfTypeCannotBeNull(
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcBuilderExtensions.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcBuilderExtensions.cs
index b355a16318..919d98182d 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcBuilderExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcBuilderExtensions.cs
@@ -1,9 +1,8 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Mvc;
-using Microsoft.Framework.Internal;
namespace Microsoft.Framework.DependencyInjection
{
@@ -18,9 +17,19 @@ namespace Microsoft.Framework.DependencyInjection
/// The .
/// The which need to be configured.
public static IMvcBuilder AddViewOptions(
- [NotNull] this IMvcBuilder builder,
- [NotNull] Action setupAction)
+ this IMvcBuilder builder,
+ Action setupAction)
{
+ if (builder == null)
+ {
+ throw new ArgumentNullException(nameof(builder));
+ }
+
+ if (setupAction == null)
+ {
+ throw new ArgumentNullException(nameof(setupAction));
+ }
+
builder.Services.Configure(setupAction);
return builder;
}
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs
index 11296ad8b1..1b1a63ee12 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/DependencyInjection/MvcViewFeaturesMvcCoreBuilderExtensions.cs
@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@@ -11,24 +11,38 @@ using Microsoft.AspNet.Mvc.ViewEngines;
using Microsoft.AspNet.Mvc.ViewFeatures;
using Microsoft.AspNet.Mvc.ViewFeatures.Internal;
using Microsoft.Framework.DependencyInjection.Extensions;
-using Microsoft.Framework.Internal;
using Microsoft.Framework.OptionsModel;
namespace Microsoft.Framework.DependencyInjection
{
public static class MvcViewFeaturesMvcCoreBuilderExtensions
{
- public static IMvcCoreBuilder AddViews([NotNull] this IMvcCoreBuilder builder)
+ public static IMvcCoreBuilder AddViews(this IMvcCoreBuilder builder)
{
+ if (builder == null)
+ {
+ throw new ArgumentNullException(nameof(builder));
+ }
+
builder.AddDataAnnotations();
AddViewServices(builder.Services);
return builder;
}
public static IMvcCoreBuilder AddViews(
- [NotNull] this IMvcCoreBuilder builder,
- [NotNull] Action setupAction)
+ this IMvcCoreBuilder builder,
+ Action setupAction)
{
+ if (builder == null)
+ {
+ throw new ArgumentNullException(nameof(builder));
+ }
+
+ if (setupAction == null)
+ {
+ throw new ArgumentNullException(nameof(setupAction));
+ }
+
builder.AddDataAnnotations();
AddViewServices(builder.Services);
@@ -41,9 +55,19 @@ namespace Microsoft.Framework.DependencyInjection
}
public static IMvcCoreBuilder ConfigureViews(
- [NotNull] this IMvcCoreBuilder builder,
- [NotNull] Action setupAction)
+ this IMvcCoreBuilder builder,
+ Action setupAction)
{
+ if (builder == null)
+ {
+ throw new ArgumentNullException(nameof(builder));
+ }
+
+ if (setupAction == null)
+ {
+ throw new ArgumentNullException(nameof(setupAction));
+ }
+
builder.Services.Configure(setupAction);
return builder;
}
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/IViewComponentResult.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/IViewComponentResult.cs
index 375343248f..d0e7b63326 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/IViewComponentResult.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/IViewComponentResult.cs
@@ -3,7 +3,6 @@
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.ViewComponents;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc
{
@@ -16,7 +15,7 @@ namespace Microsoft.AspNet.Mvc
/// Executes the result of a using the specified .
///
/// The for the current component execution.
- void Execute([NotNull] ViewComponentContext context);
+ void Execute(ViewComponentContext context);
///
/// Asynchronously executes the result of a using the specified
@@ -24,6 +23,6 @@ namespace Microsoft.AspNet.Mvc
///
/// The for the current component execution.
/// A that represents the asynchronous execution.
- Task ExecuteAsync([NotNull] ViewComponentContext context);
+ Task ExecuteAsync(ViewComponentContext context);
}
}
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/ICanHasViewContext.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/ICanHasViewContext.cs
index 1194f77248..4efec666fa 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/ICanHasViewContext.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/ICanHasViewContext.cs
@@ -2,12 +2,11 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Mvc.Rendering;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal
{
public interface ICanHasViewContext
{
- void Contextualize([NotNull] ViewContext viewContext);
+ void Contextualize(ViewContext viewContext);
}
}
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/NullView.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/NullView.cs
index c1e17dffd4..5cf7dcfba1 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/NullView.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/NullView.cs
@@ -1,10 +1,10 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.AspNet.Mvc.ViewEngines;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal
{
@@ -14,8 +14,13 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal
public string Path => string.Empty;
- public Task RenderAsync([NotNull] ViewContext context)
+ public Task RenderAsync(ViewContext context)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
return Task.FromResult(0);
}
}
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/ValidationHelpers.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/ValidationHelpers.cs
index 56dcfd4f37..34110c823c 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/ValidationHelpers.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Internal/ValidationHelpers.cs
@@ -5,8 +5,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Mvc.ModelBinding;
-using Microsoft.AspNet.Mvc.ViewFeatures;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal
{
@@ -62,8 +60,13 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures.Internal
{
private Dictionary _ordering = new Dictionary(StringComparer.OrdinalIgnoreCase);
- public ErrorsOrderer([NotNull] ModelMetadata metadata)
+ public ErrorsOrderer(ModelMetadata metadata)
{
+ if (metadata == null)
+ {
+ throw new ArgumentNullException(nameof(metadata));
+ }
+
foreach (var data in metadata.Properties)
{
_ordering[data.PropertyName] = data.Order;
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/MvcViewOptions.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/MvcViewOptions.cs
index 46aad3d935..5373bfa60a 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/MvcViewOptions.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/MvcViewOptions.cs
@@ -1,12 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
using System.Collections.Generic;
using Microsoft.AspNet.Mvc.ModelBinding.Validation;
-using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.AspNet.Mvc.ViewEngines;
using Microsoft.AspNet.Mvc.ViewFeatures;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc
{
@@ -15,10 +14,24 @@ namespace Microsoft.AspNet.Mvc
///
public class MvcViewOptions
{
+ private HtmlHelperOptions _htmlHelperOptions = new HtmlHelperOptions();
+
///
- /// Gets or sets programmatic configuration for the HTML helpers and .
+ /// Gets or sets programmatic configuration for the HTML helpers and .
///
- public HtmlHelperOptions HtmlHelperOptions { get;[param: NotNull] set; } = new HtmlHelperOptions();
+ public HtmlHelperOptions HtmlHelperOptions
+ {
+ get { return _htmlHelperOptions; }
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
+ _htmlHelperOptions = value;
+ }
+ }
///
/// Gets a list s used by this application.
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/PartialViewResult.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/PartialViewResult.cs
index fe69b0070b..d5ba5890a0 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/PartialViewResult.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/PartialViewResult.cs
@@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.Framework.DependencyInjection;
-using Microsoft.Framework.Internal;
using Microsoft.Framework.Logging;
using Microsoft.Net.Http.Headers;
using Microsoft.Framework.OptionsModel;
@@ -54,8 +53,13 @@ namespace Microsoft.AspNet.Mvc
public MediaTypeHeaderValue ContentType { get; set; }
///
- public override async Task ExecuteResultAsync([NotNull] ActionContext context)
+ public override async Task ExecuteResultAsync(ActionContext context)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
var viewEngine = ViewEngine ??
context.HttpContext.RequestServices.GetRequiredService();
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/RemoteAttribute.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/RemoteAttribute.cs
index c60045d121..07659d7a1e 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/RemoteAttribute.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/RemoteAttribute.cs
@@ -11,7 +11,6 @@ using Microsoft.AspNet.Mvc.Internal;
using Microsoft.AspNet.Mvc.ModelBinding.Validation;
using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
-using Microsoft.Framework.Internal;
using Microsoft.AspNet.Mvc.Routing;
namespace Microsoft.AspNet.Mvc
@@ -192,8 +191,13 @@ namespace Microsoft.AspNet.Mvc
///
/// The used to generate the URL.
/// The URL where the client should send a validation request.
- protected virtual string GetUrl([NotNull] ClientModelValidationContext context)
+ protected virtual string GetUrl(ClientModelValidationContext context)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
var urlHelper = context.RequestServices.GetRequiredService();
var url = urlHelper.RouteUrl(new UrlRouteContext()
{
@@ -230,8 +234,13 @@ namespace Microsoft.AspNet.Mvc
/// Thrown if unable to generate a target URL for a validation request.
///
public virtual IEnumerable GetClientValidationRules(
- [NotNull] ClientModelValidationContext context)
+ ClientModelValidationContext context)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
var metadata = context.ModelMetadata;
var rule = new ModelClientValidationRemoteRule(
FormatErrorMessage(metadata.GetDisplayName()),
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperDisplayExtensions.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperDisplayExtensions.cs
index a0ed3c7a14..f2c58b2d4a 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperDisplayExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperDisplayExtensions.cs
@@ -4,7 +4,6 @@
using System;
using System.Linq.Expressions;
using Microsoft.AspNet.Html.Abstractions;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.Rendering
{
@@ -37,8 +36,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// case-sensitive file systems.
///
///
- public static IHtmlContent Display([NotNull] this IHtmlHelper htmlHelper, string expression)
+ public static IHtmlContent Display(this IHtmlHelper htmlHelper, string expression)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(expression, templateName: null, htmlFieldName: null, additionalViewData: null);
}
@@ -73,10 +77,15 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent Display(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string expression,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(
expression,
templateName: null,
@@ -111,10 +120,15 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent Display(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string expression,
string templateName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(expression, templateName, htmlFieldName: null, additionalViewData: null);
}
@@ -150,11 +164,16 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent Display(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string expression,
string templateName,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(
expression,
templateName,
@@ -193,11 +212,16 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent Display(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string expression,
string templateName,
string htmlFieldName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(expression, templateName, htmlFieldName, additionalViewData: null);
}
@@ -221,9 +245,19 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent DisplayFor(
- [NotNull] this IHtmlHelper htmlHelper,
- [NotNull] Expression> expression)
+ this IHtmlHelper htmlHelper,
+ Expression> expression)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.DisplayFor(
expression,
templateName: null,
@@ -257,10 +291,20 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent DisplayFor(
- [NotNull] this IHtmlHelper htmlHelper,
- [NotNull] Expression> expression,
+ this IHtmlHelper htmlHelper,
+ Expression> expression,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.DisplayFor(
expression,
templateName: null,
@@ -290,10 +334,20 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent DisplayFor(
- [NotNull] this IHtmlHelper htmlHelper,
- [NotNull] Expression> expression,
+ this IHtmlHelper htmlHelper,
+ Expression> expression,
string templateName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.DisplayFor(
expression,
templateName,
@@ -328,11 +382,21 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent DisplayFor(
- [NotNull] this IHtmlHelper htmlHelper,
- [NotNull] Expression> expression,
+ this IHtmlHelper htmlHelper,
+ Expression> expression,
string templateName,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.DisplayFor(
expression,
templateName,
@@ -366,11 +430,21 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent DisplayFor(
- [NotNull] this IHtmlHelper htmlHelper,
- [NotNull] Expression> expression,
+ this IHtmlHelper htmlHelper,
+ Expression> expression,
string templateName,
string htmlFieldName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.DisplayFor(
expression,
templateName: templateName,
@@ -394,8 +468,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// case-sensitive file systems.
///
///
- public static IHtmlContent DisplayForModel([NotNull] this IHtmlHelper htmlHelper)
+ public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(
expression: null,
templateName: null,
@@ -424,8 +503,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// case-sensitive file systems.
///
///
- public static IHtmlContent DisplayForModel([NotNull] this IHtmlHelper htmlHelper, object additionalViewData)
+ public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(
expression: null,
templateName: null,
@@ -450,8 +534,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// case-sensitive file systems.
///
///
- public static IHtmlContent DisplayForModel([NotNull] this IHtmlHelper htmlHelper, string templateName)
+ public static IHtmlContent DisplayForModel(this IHtmlHelper htmlHelper, string templateName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(
expression: null,
templateName: templateName,
@@ -483,10 +572,15 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent DisplayForModel(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string templateName,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(
expression: null,
templateName: templateName,
@@ -517,10 +611,15 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent DisplayForModel(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string templateName,
string htmlFieldName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(
expression: null,
templateName: templateName,
@@ -556,11 +655,16 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent DisplayForModel(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string templateName,
string htmlFieldName,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Display(
expression: null,
templateName: templateName,
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperDisplayNameExtensions.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperDisplayNameExtensions.cs
index ae3d46cf19..5f08cddffc 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperDisplayNameExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperDisplayNameExtensions.cs
@@ -4,8 +4,6 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
-using Microsoft.AspNet.Mvc.ViewFeatures;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.Rendering
{
@@ -19,8 +17,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
/// The instance this method extends.
/// A containing the display name.
- public static string DisplayNameForModel([NotNull] this IHtmlHelper htmlHelper)
+ public static string DisplayNameForModel(this IHtmlHelper htmlHelper)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.DisplayName(expression: null);
}
@@ -36,9 +39,19 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// The type of the result.
/// A containing the display name.
public static string DisplayNameFor(
- [NotNull] this IHtmlHelper> htmlHelper,
- [NotNull] Expression> expression)
+ this IHtmlHelper> htmlHelper,
+ Expression> expression)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.DisplayNameForInnerType(expression);
}
}
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperEditorExtensions.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperEditorExtensions.cs
index c07c5d182e..18525d4bdd 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperEditorExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperEditorExtensions.cs
@@ -4,8 +4,6 @@
using System;
using System.Linq.Expressions;
using Microsoft.AspNet.Html.Abstractions;
-using Microsoft.AspNet.Mvc.ViewFeatures;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.Rendering
{
@@ -38,8 +36,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// case-sensitive file systems.
///
///
- public static IHtmlContent Editor([NotNull] this IHtmlHelper htmlHelper, string expression)
+ public static IHtmlContent Editor(this IHtmlHelper htmlHelper, string expression)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(expression, templateName: null, htmlFieldName: null, additionalViewData: null);
}
@@ -55,8 +58,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
/// An anonymous or
- /// that can contain additional view data that will be merged into the
- /// instance created for the template.
+ /// that can contain additional view data that will be merged into the
+ /// instance created for the template.
///
/// A new containing the <input> element(s).
///
@@ -74,10 +77,15 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent Editor(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string expression,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(
expression,
templateName: null,
@@ -111,8 +119,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// case-sensitive file systems.
///
///
- public static IHtmlContent Editor([NotNull] this IHtmlHelper htmlHelper, string expression, string templateName)
+ public static IHtmlContent Editor(this IHtmlHelper htmlHelper, string expression, string templateName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(expression, templateName, htmlFieldName: null, additionalViewData: null);
}
@@ -129,8 +142,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// The name of the template used to create the HTML markup.
///
/// An anonymous or
- /// that can contain additional view data that will be merged into the
- /// instance created for the template.
+ /// that can contain additional view data that will be merged into the
+ /// instance created for the template.
///
/// A new containing the <input> element(s).
///
@@ -148,11 +161,16 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent Editor(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string expression,
string templateName,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(
expression,
templateName,
@@ -191,11 +209,16 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent Editor(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string expression,
string templateName,
string htmlFieldName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(expression, templateName, htmlFieldName, additionalViewData: null);
}
@@ -219,9 +242,19 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent EditorFor(
- [NotNull] this IHtmlHelper htmlHelper,
- [NotNull] Expression> expression)
+ this IHtmlHelper htmlHelper,
+ Expression> expression)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.EditorFor(expression, templateName: null, htmlFieldName: null, additionalViewData: null);
}
@@ -234,8 +267,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// An expression to be evaluated against the current model.
///
/// An anonymous or
- /// that can contain additional view data that will be merged into the
- /// instance created for the template.
+ /// that can contain additional view data that will be merged into the
+ /// instance created for the template.
///
/// The type of the model.
/// The type of the result.
@@ -251,10 +284,20 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent EditorFor(
- [NotNull] this IHtmlHelper htmlHelper,
- [NotNull] Expression> expression,
+ this IHtmlHelper htmlHelper,
+ Expression> expression,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.EditorFor(
expression,
templateName: null,
@@ -284,10 +327,20 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent EditorFor(
- [NotNull] this IHtmlHelper htmlHelper,
- [NotNull] Expression> expression,
+ this IHtmlHelper htmlHelper,
+ Expression> expression,
string templateName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.EditorFor(expression, templateName, htmlFieldName: null, additionalViewData: null);
}
@@ -301,8 +354,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// The name of the template that is used to create the HTML markup.
///
/// An anonymous or
- /// that can contain additional view data that will be merged into the
- /// instance created for the template.
+ /// that can contain additional view data that will be merged into the
+ /// instance created for the template.
///
/// The type of the model.
/// The type of the result.
@@ -318,11 +371,21 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent EditorFor(
- [NotNull] this IHtmlHelper htmlHelper,
- [NotNull] Expression> expression,
+ this IHtmlHelper htmlHelper,
+ Expression> expression,
string templateName,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.EditorFor(
expression,
templateName,
@@ -356,11 +419,21 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent EditorFor(
- [NotNull] this IHtmlHelper htmlHelper,
- [NotNull] Expression> expression,
+ this IHtmlHelper htmlHelper,
+ Expression> expression,
string templateName,
string htmlFieldName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
+ if (expression == null)
+ {
+ throw new ArgumentNullException(nameof(expression));
+ }
+
return htmlHelper.EditorFor(expression, templateName, htmlFieldName, additionalViewData: null);
}
@@ -380,8 +453,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// case-sensitive file systems.
///
///
- public static IHtmlContent EditorForModel([NotNull] this IHtmlHelper htmlHelper)
+ public static IHtmlContent EditorForModel(this IHtmlHelper htmlHelper)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(
expression: null,
templateName: null,
@@ -396,8 +474,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// The instance this method extends.
///
/// An anonymous or
- /// that can contain additional view data that will be merged into the
- /// instance created for the template.
+ /// that can contain additional view data that will be merged into the
+ /// instance created for the template.
///
/// A new containing the <input> element(s).
///
@@ -410,8 +488,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// case-sensitive file systems.
///
///
- public static IHtmlContent EditorForModel([NotNull] this IHtmlHelper htmlHelper, object additionalViewData)
+ public static IHtmlContent EditorForModel(this IHtmlHelper htmlHelper, object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(
expression: null,
templateName: null,
@@ -436,8 +519,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// case-sensitive file systems.
///
///
- public static IHtmlContent EditorForModel([NotNull] this IHtmlHelper htmlHelper, string templateName)
+ public static IHtmlContent EditorForModel(this IHtmlHelper htmlHelper, string templateName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(
expression: null,
templateName: templateName,
@@ -454,8 +542,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
/// The name of the template used to create the HTML markup.
///
/// An anonymous or
- /// that can contain additional view data that will be merged into the
- /// instance created for the template.
+ /// that can contain additional view data that will be merged into the
+ /// instance created for the template.
///
/// A new containing the <input> element(s).
///
@@ -469,10 +557,15 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent EditorForModel(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string templateName,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(
expression: null,
templateName: templateName,
@@ -503,10 +596,15 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent EditorForModel(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string templateName,
string htmlFieldName)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(
expression: null,
templateName: templateName,
@@ -527,8 +625,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
/// An anonymous or
- /// that can contain additional view data that will be merged into the
- /// instance created for the template.
+ /// that can contain additional view data that will be merged into the
+ /// instance created for the template.
///
/// A new containing the <input> element(s).
///
@@ -542,11 +640,16 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
///
public static IHtmlContent EditorForModel(
- [NotNull] this IHtmlHelper htmlHelper,
+ this IHtmlHelper htmlHelper,
string templateName,
string htmlFieldName,
object additionalViewData)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
return htmlHelper.Editor(
expression: null,
templateName: templateName,
diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperFormExtensions.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperFormExtensions.cs
index 67e63d3823..1376282a38 100644
--- a/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperFormExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/Rendering/HtmlHelperFormExtensions.cs
@@ -1,8 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using Microsoft.AspNet.Mvc.ViewFeatures;
-using Microsoft.Framework.Internal;
+using System;
namespace Microsoft.AspNet.Mvc.Rendering
{
@@ -22,8 +21,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
///
/// In this context, "renders" means the method writes its output using .
///
- public static MvcForm BeginForm([NotNull] this IHtmlHelper htmlHelper)
+ public static MvcForm BeginForm(this IHtmlHelper htmlHelper)
{
+ if (htmlHelper == null)
+ {
+ throw new ArgumentNullException(nameof(htmlHelper));
+ }
+
// Generates