diff --git a/src/OpenTelemetry.Api/Internal/Guard.cs b/src/OpenTelemetry.Api/Internal/Guard.cs
index 73f5caa26..ae6e816ae 100644
--- a/src/OpenTelemetry.Api/Internal/Guard.cs
+++ b/src/OpenTelemetry.Api/Internal/Guard.cs
@@ -24,7 +24,7 @@ namespace OpenTelemetry.Internal
///
/// Methods for guarding against exception throwing values.
///
- public static class Guard
+ internal static class Guard
{
private const string DefaultParamName = "N/A";
@@ -136,11 +136,11 @@ namespace OpenTelemetry.Internal
}
///
- /// Throw an exception if the value is not within the given range.
+ /// Throw an exception if the value is not of the expected type.
///
/// The value to check.
/// The parameter name to use in the thrown exception.
- /// The type to attempt to convert to.
+ /// The type attempted to convert to.
/// The value casted to the specified type.
[DebuggerHidden]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/OpenTelemetry.Api/Trace/TracerProviderBuilder.cs b/src/OpenTelemetry.Api/Trace/TracerProviderBuilder.cs
index e902a3872..f63564ec9 100644
--- a/src/OpenTelemetry.Api/Trace/TracerProviderBuilder.cs
+++ b/src/OpenTelemetry.Api/Trace/TracerProviderBuilder.cs
@@ -51,7 +51,7 @@ namespace OpenTelemetry.Trace
/// Adds a listener for objects created with the given operation name to the .
///
///
- /// This is provided to capture legacy objects created without using the API.
+ /// This is provided to capture legacy objects created without using the API.
///
/// Operation name of the objects to capture.
/// Returns for chaining.
diff --git a/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj b/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj
index 1336a810f..aa23bb337 100644
--- a/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj
+++ b/src/OpenTelemetry.Exporter.Console/OpenTelemetry.Exporter.Console.csproj
@@ -17,6 +17,7 @@
+
diff --git a/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj b/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj
index 8eb494b7f..404dc1b16 100644
--- a/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj
+++ b/src/OpenTelemetry.Exporter.InMemory/OpenTelemetry.Exporter.InMemory.csproj
@@ -15,4 +15,8 @@
+
+
+
+
diff --git a/src/OpenTelemetry.Exporter.Jaeger/OpenTelemetry.Exporter.Jaeger.csproj b/src/OpenTelemetry.Exporter.Jaeger/OpenTelemetry.Exporter.Jaeger.csproj
index 1b264bc21..3d22d4321 100644
--- a/src/OpenTelemetry.Exporter.Jaeger/OpenTelemetry.Exporter.Jaeger.csproj
+++ b/src/OpenTelemetry.Exporter.Jaeger/OpenTelemetry.Exporter.Jaeger.csproj
@@ -25,6 +25,7 @@
+
diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj
index fa9ece21a..d9490575f 100644
--- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj
+++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj
@@ -42,6 +42,7 @@
+
diff --git a/src/OpenTelemetry.Exporter.Prometheus/OpenTelemetry.Exporter.Prometheus.csproj b/src/OpenTelemetry.Exporter.Prometheus/OpenTelemetry.Exporter.Prometheus.csproj
index f69c2c2d9..5730aec8a 100644
--- a/src/OpenTelemetry.Exporter.Prometheus/OpenTelemetry.Exporter.Prometheus.csproj
+++ b/src/OpenTelemetry.Exporter.Prometheus/OpenTelemetry.Exporter.Prometheus.csproj
@@ -24,6 +24,7 @@
+
diff --git a/src/OpenTelemetry.Exporter.ZPages/OpenTelemetry.Exporter.ZPages.csproj b/src/OpenTelemetry.Exporter.ZPages/OpenTelemetry.Exporter.ZPages.csproj
index 14dadaf44..ea031a58f 100644
--- a/src/OpenTelemetry.Exporter.ZPages/OpenTelemetry.Exporter.ZPages.csproj
+++ b/src/OpenTelemetry.Exporter.ZPages/OpenTelemetry.Exporter.ZPages.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/OpenTelemetry.Exporter.Zipkin/OpenTelemetry.Exporter.Zipkin.csproj b/src/OpenTelemetry.Exporter.Zipkin/OpenTelemetry.Exporter.Zipkin.csproj
index 3555bd872..7ed212f92 100644
--- a/src/OpenTelemetry.Exporter.Zipkin/OpenTelemetry.Exporter.Zipkin.csproj
+++ b/src/OpenTelemetry.Exporter.Zipkin/OpenTelemetry.Exporter.Zipkin.csproj
@@ -16,6 +16,7 @@
+
diff --git a/src/OpenTelemetry.Extensions.Hosting/OpenTelemetry.Extensions.Hosting.csproj b/src/OpenTelemetry.Extensions.Hosting/OpenTelemetry.Extensions.Hosting.csproj
index 27fcf6fef..2919f598b 100644
--- a/src/OpenTelemetry.Extensions.Hosting/OpenTelemetry.Extensions.Hosting.csproj
+++ b/src/OpenTelemetry.Extensions.Hosting/OpenTelemetry.Extensions.Hosting.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.csproj b/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.csproj
index 51ed98cb9..3af399242 100644
--- a/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.csproj
+++ b/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule.csproj
@@ -7,6 +7,7 @@
+
diff --git a/src/OpenTelemetry.Instrumentation.AspNet/OpenTelemetry.Instrumentation.AspNet.csproj b/src/OpenTelemetry.Instrumentation.AspNet/OpenTelemetry.Instrumentation.AspNet.csproj
index 353cf4628..27a45714b 100644
--- a/src/OpenTelemetry.Instrumentation.AspNet/OpenTelemetry.Instrumentation.AspNet.csproj
+++ b/src/OpenTelemetry.Instrumentation.AspNet/OpenTelemetry.Instrumentation.AspNet.csproj
@@ -12,6 +12,7 @@
+
diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
index 6fd27b06c..26c13d611 100644
--- a/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
+++ b/src/OpenTelemetry.Instrumentation.AspNetCore/OpenTelemetry.Instrumentation.AspNetCore.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj b/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj
index b599e57b1..e7c5b9162 100644
--- a/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj
+++ b/src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj
@@ -8,6 +8,7 @@
+
diff --git a/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj b/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj
index 95ad43be5..55ab8e552 100644
--- a/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj
+++ b/src/OpenTelemetry.Instrumentation.Http/OpenTelemetry.Instrumentation.Http.csproj
@@ -7,6 +7,10 @@
true
+
+
+
+
diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj b/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj
index 0ade9df73..662610993 100644
--- a/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj
+++ b/src/OpenTelemetry.Instrumentation.SqlClient/OpenTelemetry.Instrumentation.SqlClient.csproj
@@ -7,6 +7,10 @@
true
+
+
+
+
diff --git a/src/OpenTelemetry.Instrumentation.StackExchangeRedis/OpenTelemetry.Instrumentation.StackExchangeRedis.csproj b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/OpenTelemetry.Instrumentation.StackExchangeRedis.csproj
index 9890827d0..c0f8d415e 100644
--- a/src/OpenTelemetry.Instrumentation.StackExchangeRedis/OpenTelemetry.Instrumentation.StackExchangeRedis.csproj
+++ b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/OpenTelemetry.Instrumentation.StackExchangeRedis.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/OpenTelemetry.Shims.OpenTracing/OpenTelemetry.Shims.OpenTracing.csproj b/src/OpenTelemetry.Shims.OpenTracing/OpenTelemetry.Shims.OpenTracing.csproj
index 669d7c68a..6736743f2 100644
--- a/src/OpenTelemetry.Shims.OpenTracing/OpenTelemetry.Shims.OpenTracing.csproj
+++ b/src/OpenTelemetry.Shims.OpenTracing/OpenTelemetry.Shims.OpenTracing.csproj
@@ -18,4 +18,8 @@
+
+
+
+
diff --git a/src/OpenTelemetry/DiagnosticSourceInstrumentation/PropertyFetcher.cs b/src/OpenTelemetry/DiagnosticSourceInstrumentation/PropertyFetcher.cs
index e77e702b5..debe49a67 100644
--- a/src/OpenTelemetry/DiagnosticSourceInstrumentation/PropertyFetcher.cs
+++ b/src/OpenTelemetry/DiagnosticSourceInstrumentation/PropertyFetcher.cs
@@ -48,7 +48,7 @@ namespace OpenTelemetry.Instrumentation
{
Guard.Null(obj, nameof(obj));
- if (!this.TryFetch(obj, out T value))
+ if (!this.TryFetch(obj, out T value, true))
{
throw new ArgumentException($"Unable to fetch property: '{nameof(obj)}'", nameof(obj));
}
@@ -61,10 +61,11 @@ namespace OpenTelemetry.Instrumentation
///
/// Object to be fetched.
/// Fetched value.
- /// if the property was fetched.
- public bool TryFetch(object obj, out T value)
+ /// Set this to if we know is not .
+ /// if the property was fetched.
+ public bool TryFetch(object obj, out T value, bool skipObjNullCheck = false)
{
- if (obj == null)
+ if (!skipObjNullCheck && obj == null)
{
value = default;
return false;
diff --git a/test/OpenTelemetry.Tests/Internal/GuardTest.cs b/test/OpenTelemetry.Tests/Internal/GuardTest.cs
index 8b1e66669..64bd41acc 100644
--- a/test/OpenTelemetry.Tests/Internal/GuardTest.cs
+++ b/test/OpenTelemetry.Tests/Internal/GuardTest.cs
@@ -21,10 +21,10 @@ using Xunit;
namespace OpenTelemetry.Tests.Internal
{
- public static class GuardTest
+ public class GuardTest
{
[Fact]
- public static void NullTest()
+ public void NullTest()
{
// Valid
Guard.Null(1);
@@ -38,7 +38,7 @@ namespace OpenTelemetry.Tests.Internal
}
[Fact]
- public static void NullOrEmptyTest()
+ public void NullOrEmptyTest()
{
// Valid
Guard.NullOrEmpty("a");
@@ -53,7 +53,7 @@ namespace OpenTelemetry.Tests.Internal
}
[Fact]
- public static void NullOrWhitespaceTest()
+ public void NullOrWhitespaceTest()
{
// Valid
Guard.NullOrWhitespace("a");
@@ -70,7 +70,7 @@ namespace OpenTelemetry.Tests.Internal
}
[Fact]
- public static void InvalidTimeoutTest()
+ public void InvalidTimeoutTest()
{
// Valid
Guard.InvalidTimeout(Timeout.Infinite);
@@ -83,7 +83,7 @@ namespace OpenTelemetry.Tests.Internal
}
[Fact]
- public static void RangeIntTest()
+ public void RangeIntTest()
{
// Valid
Guard.Range(0);
@@ -101,7 +101,7 @@ namespace OpenTelemetry.Tests.Internal
}
[Fact]
- public static void RangeDoubleTest()
+ public void RangeDoubleTest()
{
// Valid
Guard.Range(1.0, min: 1.0, max: 1.0);
@@ -117,7 +117,7 @@ namespace OpenTelemetry.Tests.Internal
}
[Fact]
- public static void TypeTest()
+ public void TypeTest()
{
// Valid
Guard.Type(0);
@@ -130,7 +130,7 @@ namespace OpenTelemetry.Tests.Internal
}
[Fact]
- public static void ZeroTest()
+ public void ZeroTest()
{
// Valid
Guard.Zero(1);