diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/ElmExtensions.cs b/src/Microsoft.AspNet.Diagnostics.Elm/ElmExtensions.cs
index 7d0c21564f..4de0d94f7e 100644
--- a/src/Microsoft.AspNet.Diagnostics.Elm/ElmExtensions.cs
+++ b/src/Microsoft.AspNet.Diagnostics.Elm/ElmExtensions.cs
@@ -4,7 +4,6 @@
using System;
using Microsoft.AspNet.Diagnostics.Elm;
using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.OptionsModel;
@@ -15,8 +14,13 @@ namespace Microsoft.AspNet.Builder
///
/// Enables the Elm logging service, which can be accessed via the .
///
- public static IApplicationBuilder UseElmCapture([NotNull] this IApplicationBuilder builder)
+ public static IApplicationBuilder UseElmCapture(this IApplicationBuilder builder)
{
+ if (builder == null)
+ {
+ throw new ArgumentNullException(nameof(builder));
+ }
+
// add the elm provider to the factory here so the logger can start capturing logs immediately
var factory = builder.ApplicationServices.GetRequiredService();
var store = builder.ApplicationServices.GetRequiredService();
@@ -29,8 +33,13 @@ namespace Microsoft.AspNet.Builder
///
/// Enables viewing logs captured by the .
///
- public static IApplicationBuilder UseElmPage([NotNull] this IApplicationBuilder builder)
+ public static IApplicationBuilder UseElmPage(this IApplicationBuilder builder)
{
+ if (builder == null)
+ {
+ throw new ArgumentNullException(nameof(builder));
+ }
+
return builder.UseMiddleware();
}
}
diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/ElmLoggerProvider.cs b/src/Microsoft.AspNet.Diagnostics.Elm/ElmLoggerProvider.cs
index 498254117e..4a552270de 100644
--- a/src/Microsoft.AspNet.Diagnostics.Elm/ElmLoggerProvider.cs
+++ b/src/Microsoft.AspNet.Diagnostics.Elm/ElmLoggerProvider.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.Extensions.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNet.Diagnostics.Elm
@@ -12,8 +11,18 @@ namespace Microsoft.AspNet.Diagnostics.Elm
private readonly ElmStore _store;
private readonly ElmOptions _options;
- public ElmLoggerProvider([NotNull] ElmStore store, [NotNull] ElmOptions options)
+ public ElmLoggerProvider(ElmStore store, ElmOptions options)
{
+ if (store == null)
+ {
+ throw new ArgumentNullException(nameof(store));
+ }
+
+ if (options == null)
+ {
+ throw new ArgumentNullException(nameof(options));
+ }
+
_store = store;
_options = options;
}
diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/ElmScope.cs b/src/Microsoft.AspNet.Diagnostics.Elm/ElmScope.cs
index fb680260a5..e45d10607d 100644
--- a/src/Microsoft.AspNet.Diagnostics.Elm/ElmScope.cs
+++ b/src/Microsoft.AspNet.Diagnostics.Elm/ElmScope.cs
@@ -5,7 +5,6 @@ using System.Runtime.Remoting.Messaging;
#else
using System.Threading;
#endif
-using Microsoft.Extensions.Internal;
namespace Microsoft.AspNet.Diagnostics.Elm
{
@@ -61,8 +60,18 @@ namespace Microsoft.AspNet.Diagnostics.Elm
}
#endif
- public static IDisposable Push([NotNull] ElmScope scope, [NotNull] ElmStore store)
+ public static IDisposable Push(ElmScope scope, ElmStore store)
{
+ if (scope == null)
+ {
+ throw new ArgumentNullException(nameof(scope));
+ }
+
+ if (store == null)
+ {
+ throw new ArgumentNullException(nameof(store));
+ }
+
var temp = Current;
Current = scope;
Current.Parent = temp;
diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/ElmServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Diagnostics.Elm/ElmServiceCollectionExtensions.cs
index 5c0188084a..0b73d38d8a 100644
--- a/src/Microsoft.AspNet.Diagnostics.Elm/ElmServiceCollectionExtensions.cs
+++ b/src/Microsoft.AspNet.Diagnostics.Elm/ElmServiceCollectionExtensions.cs
@@ -3,7 +3,6 @@
using System;
using Microsoft.AspNet.Diagnostics.Elm;
-using Microsoft.Extensions.Internal;
namespace Microsoft.Extensions.DependencyInjection
{
@@ -12,8 +11,13 @@ namespace Microsoft.Extensions.DependencyInjection
///
/// Registers an and configures default .
///
- public static IServiceCollection AddElm([NotNull] this IServiceCollection services)
+ public static IServiceCollection AddElm(this IServiceCollection services)
{
+ if (services == null)
+ {
+ throw new ArgumentNullException(nameof(services));
+ }
+
services.AddOptions();
services.AddSingleton();
return services;
@@ -25,9 +29,19 @@ namespace Microsoft.Extensions.DependencyInjection
/// The services available in the application.
/// The which need to be configured.
public static void ConfigureElm(
- [NotNull] this IServiceCollection services,
- [NotNull] Action configureOptions)
+ this IServiceCollection services,
+ Action configureOptions)
{
+ if (services == null)
+ {
+ throw new ArgumentNullException(nameof(services));
+ }
+
+ if (configureOptions == null)
+ {
+ throw new ArgumentNullException(nameof(configureOptions));
+ }
+
services.Configure(configureOptions);
}
}
diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/ElmStore.cs b/src/Microsoft.AspNet.Diagnostics.Elm/ElmStore.cs
index 986e1e10bb..08ef7eb1c1 100644
--- a/src/Microsoft.AspNet.Diagnostics.Elm/ElmStore.cs
+++ b/src/Microsoft.AspNet.Diagnostics.Elm/ElmStore.cs
@@ -1,9 +1,9 @@
// 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.Linq;
-using Microsoft.Extensions.Internal;
namespace Microsoft.AspNet.Diagnostics.Elm
{
@@ -34,8 +34,13 @@ namespace Microsoft.AspNet.Diagnostics.Elm
/// Adds a new to the store.
///
/// The context to be added to the store.
- public void AddActivity([NotNull] ActivityContext activity)
+ public void AddActivity(ActivityContext activity)
{
+ if (activity == null)
+ {
+ throw new ArgumentNullException(nameof(activity));
+ }
+
lock (Activities)
{
Activities.AddLast(activity);
diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/project.json b/src/Microsoft.AspNet.Diagnostics.Elm/project.json
index 5f7941225f..a3f79b9424 100644
--- a/src/Microsoft.AspNet.Diagnostics.Elm/project.json
+++ b/src/Microsoft.AspNet.Diagnostics.Elm/project.json
@@ -7,8 +7,7 @@
},
"dependencies": {
"Microsoft.AspNet.Diagnostics": "1.0.0-*",
- "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*",
- "Microsoft.Extensions.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }
+ "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*"
},
"frameworks": {