diff --git a/src/Microsoft.AspNet.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs b/src/Microsoft.AspNet.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs
index a1a1a8b408..2dcf943c4f 100644
--- a/src/Microsoft.AspNet.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs
+++ b/src/Microsoft.AspNet.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using Microsoft.AspNet.Mvc.Rendering;
-using Microsoft.AspNet.Mvc.Routing;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
using Microsoft.Extensions.WebEncoders;
@@ -108,6 +107,16 @@ namespace Microsoft.AspNet.Mvc.Razor.TagHelpers
///
public override void Process(TagHelperContext context, TagHelperOutput output)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ if (output == null)
+ {
+ throw new ArgumentNullException(nameof(output));
+ }
+
IEnumerable attributeNames;
if (ElementAttributeLookups.TryGetValue(output.TagName, out attributeNames))
{
@@ -130,6 +139,16 @@ namespace Microsoft.AspNet.Mvc.Razor.TagHelpers
/// The .
protected void ProcessUrlAttribute(string attributeName, TagHelperOutput output)
{
+ if (attributeName == null)
+ {
+ throw new ArgumentNullException(nameof(attributeName));
+ }
+
+ if (output == null)
+ {
+ throw new ArgumentNullException(nameof(output));
+ }
+
IEnumerable attributes;
if (output.Attributes.TryGetAttributes(attributeName, out attributes))
{
diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs
index 1d75b25bd9..0f007a2f48 100644
--- a/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs
+++ b/src/Microsoft.AspNet.Mvc.TagHelpers/AnchorTagHelper.cs
@@ -111,6 +111,16 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
///
public override void Process(TagHelperContext context, TagHelperOutput output)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ if (output == null)
+ {
+ throw new ArgumentNullException(nameof(output));
+ }
+
// If "href" is already set, it means the user is attempting to use a normal anchor.
if (output.Attributes.ContainsName(Href))
{
diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/CacheTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/CacheTagHelper.cs
index 84d8a56395..10bf6d3b10 100644
--- a/src/Microsoft.AspNet.Mvc.TagHelpers/CacheTagHelper.cs
+++ b/src/Microsoft.AspNet.Mvc.TagHelpers/CacheTagHelper.cs
@@ -138,6 +138,16 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
///
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ if (output == null)
+ {
+ throw new ArgumentNullException(nameof(output));
+ }
+
TagHelperContent result = null;
if (Enabled)
{
diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/EnvironmentTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/EnvironmentTagHelper.cs
index 8029209710..fc0eb0f175 100644
--- a/src/Microsoft.AspNet.Mvc.TagHelpers/EnvironmentTagHelper.cs
+++ b/src/Microsoft.AspNet.Mvc.TagHelpers/EnvironmentTagHelper.cs
@@ -48,6 +48,16 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
///
public override void Process(TagHelperContext context, TagHelperOutput output)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ if (output == null)
+ {
+ throw new ArgumentNullException(nameof(output));
+ }
+
// Always strip the outer tag name as we never want to render
output.TagName = null;
@@ -80,7 +90,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
// Matching environment name found, do nothing
return;
}
-
+
// No matching environment name found, suppress all output
output.SuppressOutput();
}
diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/FormTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/FormTagHelper.cs
index 0f08b1b6a3..7b75c89985 100644
--- a/src/Microsoft.AspNet.Mvc.TagHelpers/FormTagHelper.cs
+++ b/src/Microsoft.AspNet.Mvc.TagHelpers/FormTagHelper.cs
@@ -99,6 +99,16 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
///
public override void Process(TagHelperContext context, TagHelperOutput output)
{
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ if (output == null)
+ {
+ throw new ArgumentNullException(nameof(output));
+ }
+
var antiforgeryDefault = true;
// If "action" is already set, it means the user is attempting to use a normal