diff --git a/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisAttributeUtilities.cs b/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisAttributeUtilities.cs
index 80cb142361..b27c691e53 100644
--- a/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisAttributeUtilities.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisAttributeUtilities.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;
@@ -29,9 +29,14 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation
/// The type.
/// The to find attributes on.
///
- public static IEnumerable GetCustomAttributes([NotNull] ISymbol symbol)
+ public static IEnumerable GetCustomAttributes(ISymbol symbol)
where TAttribute : Attribute
{
+ if (symbol == null)
+ {
+ throw new ArgumentNullException(nameof(symbol));
+ }
+
var attributes = symbol.GetAttributes();
if (attributes.Length > 0)
{
diff --git a/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisSymbolBasedPropertyInfo.cs b/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisSymbolBasedPropertyInfo.cs
index df39e07492..f94571436a 100644
--- a/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisSymbolBasedPropertyInfo.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisSymbolBasedPropertyInfo.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;
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
using Microsoft.CodeAnalysis;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Runtime.Precompilation
{
@@ -22,8 +21,13 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation
/// Initializes a new instance of .
///
/// The .
- public CodeAnalysisSymbolBasedPropertyInfo([NotNull] IPropertySymbol propertySymbol)
+ public CodeAnalysisSymbolBasedPropertyInfo(IPropertySymbol propertySymbol)
{
+ if (propertySymbol == null)
+ {
+ throw new ArgumentNullException(nameof(propertySymbol));
+ }
+
_propertySymbol = propertySymbol;
PropertyType = new CodeAnalysisSymbolBasedTypeInfo(_propertySymbol.Type);
}
diff --git a/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisSymbolBasedTypeInfo.cs b/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisSymbolBasedTypeInfo.cs
index 4d7d8ec776..3865b6e04b 100644
--- a/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisSymbolBasedTypeInfo.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime.Precompilation/CodeAnalysisSymbolBasedTypeInfo.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;
@@ -9,7 +9,6 @@ using System.Reflection;
using System.Text;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
using Microsoft.CodeAnalysis;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Runtime.Precompilation
{
@@ -35,8 +34,13 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation
/// Initializes a new instance of .
///
/// The .
- public CodeAnalysisSymbolBasedTypeInfo([NotNull] ITypeSymbol type)
+ public CodeAnalysisSymbolBasedTypeInfo(ITypeSymbol type)
{
+ if (type == null)
+ {
+ throw new ArgumentNullException(nameof(type));
+ }
+
_type = type;
_underlyingType = UnwrapArrayType(type);
}
@@ -174,10 +178,10 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation
ITypeSymbol sourceTypeSymbol,
System.Reflection.TypeInfo targetTypeInfo)
{
- return string.Equals(
- targetTypeInfo.FullName,
- GetFullName(sourceTypeSymbol),
- StringComparison.Ordinal);
+ return string.Equals(
+ targetTypeInfo.FullName,
+ GetFullName(sourceTypeSymbol),
+ StringComparison.Ordinal);
}
///
@@ -185,8 +189,13 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation
///
/// The to generate the name for.
/// The assembly qualified name.
- public static string GetAssemblyQualifiedName([NotNull] ITypeSymbol symbol)
+ public static string GetAssemblyQualifiedName(ITypeSymbol symbol)
{
+ if (symbol == null)
+ {
+ throw new ArgumentNullException(nameof(symbol));
+ }
+
var builder = new StringBuilder();
GetAssemblyQualifiedName(builder, symbol);
diff --git a/src/Microsoft.AspNet.Razor.Runtime.Precompilation/PrecompilationTagHelperTypeResolver.cs b/src/Microsoft.AspNet.Razor.Runtime.Precompilation/PrecompilationTagHelperTypeResolver.cs
index eba15977fe..5622267dd0 100644
--- a/src/Microsoft.AspNet.Razor.Runtime.Precompilation/PrecompilationTagHelperTypeResolver.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime.Precompilation/PrecompilationTagHelperTypeResolver.cs
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Reflection;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
using Microsoft.CodeAnalysis;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Runtime.Precompilation
{
@@ -24,14 +23,24 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation
/// Initializes a new instance of .
///
/// The .
- public PrecompilationTagHelperTypeResolver([NotNull] Compilation compilation)
+ public PrecompilationTagHelperTypeResolver(Compilation compilation)
{
+ if (compilation == null)
+ {
+ throw new ArgumentNullException(nameof(compilation));
+ }
+
_compilation = compilation;
}
///
- protected override IEnumerable GetTopLevelExportedTypes([NotNull] AssemblyName assemblyName)
+ protected override IEnumerable GetTopLevelExportedTypes(AssemblyName assemblyName)
{
+ if (assemblyName == null)
+ {
+ throw new ArgumentNullException(nameof(assemblyName));
+ }
+
lock (_assemblyLookupLock)
{
IEnumerable result;
diff --git a/src/Microsoft.AspNet.Razor.Runtime.Precompilation/project.json b/src/Microsoft.AspNet.Razor.Runtime.Precompilation/project.json
index 235b12f3f5..79d17c5352 100644
--- a/src/Microsoft.AspNet.Razor.Runtime.Precompilation/project.json
+++ b/src/Microsoft.AspNet.Razor.Runtime.Precompilation/project.json
@@ -9,10 +9,6 @@
"warningsAsErrors": true
},
"dependencies": {
- "Microsoft.Framework.NotNullAttribute.Sources": {
- "version": "1.0.0-*",
- "type": "build"
- },
"Microsoft.Framework.PropertyActivator.Sources": {
"version": "1.0.0-*",
"type": "build"
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/DefaultTagHelperContent.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/DefaultTagHelperContent.cs
index 6b06b93a71..6f68a8b4ef 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/DefaultTagHelperContent.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/DefaultTagHelperContent.cs
@@ -132,72 +132,132 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
}
///
- public override TagHelperContent AppendFormat([NotNull] string format, object arg0)
+ public override TagHelperContent AppendFormat(string format, object arg0)
{
+ if (format == null)
+ {
+ throw new ArgumentNullException(nameof(format));
+ }
+
Buffer.Append(string.Format(format, arg0));
return this;
}
///
- public override TagHelperContent AppendFormat([NotNull] string format, object arg0, object arg1)
+ public override TagHelperContent AppendFormat(string format, object arg0, object arg1)
{
+ if (format == null)
+ {
+ throw new ArgumentNullException(nameof(format));
+ }
+
Buffer.Append(string.Format(format, arg0, arg1));
return this;
}
///
- public override TagHelperContent AppendFormat([NotNull] string format, object arg0, object arg1, object arg2)
+ public override TagHelperContent AppendFormat(string format, object arg0, object arg1, object arg2)
{
+ if (format == null)
+ {
+ throw new ArgumentNullException(nameof(format));
+ }
+
Buffer.Append(string.Format(format, arg0, arg1, arg2));
return this;
}
///
- public override TagHelperContent AppendFormat([NotNull] string format, params object[] args)
+ public override TagHelperContent AppendFormat(string format, params object[] args)
{
+ if (format == null)
+ {
+ throw new ArgumentNullException(nameof(format));
+ }
+
Buffer.Append(string.Format(format, args));
return this;
}
///
public override TagHelperContent AppendFormat(
- [NotNull] IFormatProvider provider,
- [NotNull] string format,
+ IFormatProvider provider,
+ string format,
object arg0)
{
+ if (provider == null)
+ {
+ throw new ArgumentNullException(nameof(provider));
+ }
+
+ if (format == null)
+ {
+ throw new ArgumentNullException(nameof(format));
+ }
+
Buffer.Append(string.Format(provider, format, arg0));
return this;
}
///
public override TagHelperContent AppendFormat(
- [NotNull] IFormatProvider provider,
- [NotNull] string format,
+ IFormatProvider provider,
+ string format,
object arg0,
object arg1)
{
+ if (provider == null)
+ {
+ throw new ArgumentNullException(nameof(provider));
+ }
+
+ if (format == null)
+ {
+ throw new ArgumentNullException(nameof(format));
+ }
+
Buffer.Append(string.Format(provider, format, arg0, arg1));
return this;
}
///
public override TagHelperContent AppendFormat(
- [NotNull] IFormatProvider provider,
- [NotNull] string format,
+ IFormatProvider provider,
+ string format,
object arg0,
object arg1,
object arg2)
{
+ if (provider == null)
+ {
+ throw new ArgumentNullException(nameof(provider));
+ }
+
+ if (format == null)
+ {
+ throw new ArgumentNullException(nameof(format));
+ }
+
Buffer.Append(string.Format(provider, format, arg0, arg1, arg2));
return this;
}
///
public override TagHelperContent AppendFormat(
- [NotNull] IFormatProvider provider,
- [NotNull] string format,
+ IFormatProvider provider,
+ string format,
params object[] args)
{
+ if (provider == null)
+ {
+ throw new ArgumentNullException(nameof(provider));
+ }
+
+ if (format == null)
+ {
+ throw new ArgumentNullException(nameof(format));
+ }
+
Buffer.Append(string.Format(provider, format, args));
return this;
}
@@ -232,8 +292,18 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
}
///
- public override void WriteTo([NotNull] TextWriter writer, [NotNull] IHtmlEncoder encoder)
+ public override void WriteTo(TextWriter writer, IHtmlEncoder encoder)
{
+ if (writer == null)
+ {
+ throw new ArgumentNullException(nameof(writer));
+ }
+
+ if (encoder == null)
+ {
+ throw new ArgumentNullException(nameof(encoder));
+ }
+
Buffer.WriteTo(writer, encoder);
}
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/OutputElementHintAttribute.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/OutputElementHintAttribute.cs
index 62e814f74c..3ed807c6fd 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/OutputElementHintAttribute.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/OutputElementHintAttribute.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{
@@ -18,8 +17,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
///
/// The HTML element the may output.
///
- public OutputElementHintAttribute([NotNull] string outputElement)
+ public OutputElementHintAttribute(string outputElement)
{
+ if (outputElement == null)
+ {
+ throw new ArgumentNullException(nameof(outputElement));
+ }
+
OutputElement = outputElement;
}
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/ReadOnlyTagHelperAttributeList.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/ReadOnlyTagHelperAttributeList.cs
index cb8904d48e..6cd5eebade 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/ReadOnlyTagHelperAttributeList.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/ReadOnlyTagHelperAttributeList.cs
@@ -32,8 +32,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// .
///
/// The collection to wrap.
- public ReadOnlyTagHelperAttributeList([NotNull] IEnumerable attributes)
+ public ReadOnlyTagHelperAttributeList(IEnumerable attributes)
{
+ if (attributes == null)
+ {
+ throw new ArgumentNullException(nameof(attributes));
+ }
+
Attributes = new List(attributes);
}
@@ -64,10 +69,15 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// matching .
///
/// is compared case-insensitively.
- public TAttribute this[[NotNull] string name]
+ public TAttribute this[string name]
{
get
{
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
return Attributes.FirstOrDefault(attribute => NameEquals(name, attribute));
}
}
@@ -93,8 +103,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
///
/// s is compared case-insensitively.
///
- public bool Contains([NotNull] TAttribute item)
+ public bool Contains(TAttribute item)
{
+ if (item == null)
+ {
+ throw new ArgumentNullException(nameof(item));
+ }
+
return Attributes.Contains(item);
}
@@ -109,8 +124,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// exists in the collection; otherwise, false.
///
/// is compared case-insensitively.
- public bool ContainsName([NotNull] string name)
+ public bool ContainsName(string name)
{
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
return Attributes.Any(attribute => NameEquals(name, attribute));
}
@@ -124,8 +144,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
///
/// s is compared case-insensitively.
///
- public int IndexOf([NotNull] TAttribute item)
+ public int IndexOf(TAttribute item)
{
+ if (item == null)
+ {
+ throw new ArgumentNullException(nameof(item));
+ }
+
return Attributes.IndexOf(item);
}
@@ -141,8 +166,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// true if a with the same
/// exists in the collection; otherwise, false.
/// is compared case-insensitively.
- public bool TryGetAttribute([NotNull] string name, out TAttribute attribute)
+ public bool TryGetAttribute(string name, out TAttribute attribute)
{
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
attribute = Attributes.FirstOrDefault(attr => NameEquals(name, attr));
return attribute != null;
@@ -160,8 +190,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// true if at least one with the same
/// exists in the collection; otherwise, false.
/// is compared case-insensitively.
- public bool TryGetAttributes([NotNull] string name, out IEnumerable attributes)
+ public bool TryGetAttributes(string name, out IEnumerable attributes)
{
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
attributes = Attributes.Where(attribute => NameEquals(name, attribute));
return attributes.Any();
@@ -187,8 +222,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// The attribute to compare against.
/// true if case-insensitively matches s
/// .
- protected static bool NameEquals(string name, [NotNull] TAttribute attribute)
+ protected static bool NameEquals(string name, TAttribute attribute)
{
+ if (attribute == null)
+ {
+ throw new ArgumentNullException(nameof(attribute));
+ }
+
return string.Equals(name, attribute.Name, StringComparison.OrdinalIgnoreCase);
}
}
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RuntimePropertyInfo.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RuntimePropertyInfo.cs
index b79ff696d7..a889ca1c81 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RuntimePropertyInfo.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RuntimePropertyInfo.cs
@@ -1,11 +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.Collections.Generic;
using System.Reflection;
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Runtime
{
@@ -18,8 +17,13 @@ namespace Microsoft.AspNet.Razor.Runtime
/// Initializes a new instance of .
///
/// The instance to adapt.
- public RuntimePropertyInfo([NotNull] PropertyInfo propertyInfo)
+ public RuntimePropertyInfo(PropertyInfo propertyInfo)
{
+ if (propertyInfo == null)
+ {
+ throw new ArgumentNullException(nameof(propertyInfo));
+ }
+
Property = propertyInfo;
}
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RuntimeTypeInfo.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RuntimeTypeInfo.cs
index c8148f1f19..c67d732d9b 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RuntimeTypeInfo.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RuntimeTypeInfo.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;
@@ -27,8 +27,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// Initializes a new instance of
///
/// The instance to adapt.
- public RuntimeTypeInfo([NotNull] TypeInfo typeInfo)
+ public RuntimeTypeInfo(TypeInfo typeInfo)
{
+ if (typeInfo == null)
+ {
+ throw new ArgumentNullException(nameof(typeInfo));
+ }
+
TypeInfo = typeInfo;
}
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttribute.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttribute.cs
index f9fada7a01..8b38c978ec 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttribute.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttribute.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{
@@ -25,9 +24,14 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// .
///
/// A whose values should be copied.
- public TagHelperAttribute([NotNull] IReadOnlyTagHelperAttribute attribute)
- : this (attribute?.Name, attribute?.Value)
+ public TagHelperAttribute(IReadOnlyTagHelperAttribute attribute)
+ : this(attribute?.Name, attribute?.Value)
{
+ if (attribute == null)
+ {
+ throw new ArgumentNullException(nameof(attribute));
+ }
+
Minimized = attribute.Minimized;
}
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttributeList.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttributeList.cs
index feaa5da34b..abfde82719 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttributeList.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttributeList.cs
@@ -25,9 +25,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// .
///
/// The collection to wrap.
- public TagHelperAttributeList([NotNull] IEnumerable attributes)
+ public TagHelperAttributeList(IEnumerable attributes)
: base(attributes)
{
+ if (attributes == null)
+ {
+ throw new ArgumentNullException(nameof(attributes));
+ }
}
///
@@ -40,9 +44,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{
return base[index];
}
- [param: NotNull]
set
{
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
if (value.Name == null)
{
throw new ArgumentException(
@@ -83,15 +91,29 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// attributes["name"] = new TagHelperAttribute("name", "value");
///
///
- public new TagHelperAttribute this[[NotNull] string name]
+ public new TagHelperAttribute this[string name]
{
get
{
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
return base[name];
}
- [param: NotNull]
set
{
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
// Name will be null if user attempts to set the attribute via an implicit conversion:
// output.Attributes["someName"] = "someValue"
if (value.Name == null)
@@ -152,8 +174,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
///
/// The of the attribute to add.
/// The of the attribute to add.
- public void Add([NotNull] string name, object value)
+ public void Add(string name, object value)
{
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
Attributes.Add(new TagHelperAttribute(name, value));
}
@@ -161,8 +188,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
///
/// 's must not be null.
///
- public void Add([NotNull] TagHelperAttribute attribute)
+ public void Add(TagHelperAttribute attribute)
{
+ if (attribute == null)
+ {
+ throw new ArgumentNullException(nameof(attribute));
+ }
+
if (attribute.Name == null)
{
throw new ArgumentException(
@@ -179,8 +211,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
///
/// 's must not be null.
///
- public void Insert(int index, [NotNull] TagHelperAttribute attribute)
+ public void Insert(int index, TagHelperAttribute attribute)
{
+ if (attribute == null)
+ {
+ throw new ArgumentNullException(nameof(attribute));
+ }
+
if (attribute.Name == null)
{
throw new ArgumentException(
@@ -194,8 +231,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
}
///
- public void CopyTo([NotNull] TagHelperAttribute[] array, int index)
+ public void CopyTo(TagHelperAttribute[] array, int index)
{
+ if (array == null)
+ {
+ throw new ArgumentNullException(nameof(array));
+ }
+
Attributes.CopyTo(array, index);
}
@@ -203,8 +245,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
///
/// s is compared case-insensitively.
///
- public bool Remove([NotNull] TagHelperAttribute attribute)
+ public bool Remove(TagHelperAttribute attribute)
{
+ if (attribute == null)
+ {
+ throw new ArgumentNullException(nameof(attribute));
+ }
+
return Attributes.Remove(attribute);
}
@@ -225,8 +272,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// true if at least 1 was removed; otherwise, false.
///
/// is compared case-insensitively.
- public bool RemoveAll([NotNull] string name)
+ public bool RemoveAll(string name)
{
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
return Attributes.RemoveAll(attribute => NameEquals(name, attribute)) > 0;
}
diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperContext.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperContext.cs
index 3ee7ba85fc..96cdbc971b 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperContext.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperContext.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{
@@ -26,11 +25,31 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// A delegate used to execute and retrieve the rendered child content
/// asynchronously.
public TagHelperContext(
- [NotNull] IEnumerable allAttributes,
- [NotNull] IDictionary