Skip to content

Commit

Permalink
Update preprocessor directives ahead of System.Diagnostics.Diagnostic…
Browse files Browse the repository at this point in the history
…Source .NET 7 update. (#3095)
  • Loading branch information
CodeBlanch authored Mar 28, 2022
1 parent de44411 commit bf79f0d
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>

#if NET461
#if NETFRAMEWORK
using System.Collections;
using System.Reflection;
using System.Runtime.CompilerServices;
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry.Exporter.Jaeger/Implementation/Batch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>

#if NETSTANDARD2_0 || NET461
#if NETSTANDARD2_0 || NETFRAMEWORK
using System;
#endif
using Thrift.Protocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>

#if NETSTANDARD2_0 || NET461
#if NETSTANDARD2_0 || NETFRAMEWORK
using System;
#endif
using Thrift.Protocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>

#if NETSTANDARD2_0 || NET461
#if NETSTANDARD2_0 || NETFRAMEWORK
namespace System
{
internal static class ShimExtensions
Expand Down
4 changes: 2 additions & 2 deletions src/OpenTelemetry/Internal/ServiceProviderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>

#if NET461 || NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP3_1_OR_GREATER
#if NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER || NETCOREAPP3_1_OR_GREATER
using Microsoft.Extensions.Options;
#endif

Expand All @@ -34,7 +34,7 @@ internal static class ServiceProviderExtensions
public static T GetOptions<T>(this IServiceProvider serviceProvider)
where T : class, new()
{
#if NET461 || NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP3_1_OR_GREATER
#if NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER || NETCOREAPP3_1_OR_GREATER
IOptions<T> options = (IOptions<T>)serviceProvider.GetService(typeof(IOptions<T>));

// Note: options could be null if user never invoked services.AddOptions().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System;
using System.Diagnostics.Metrics;
#if NET461
#if NETFRAMEWORK
using System.Linq;
#endif
using System.Threading;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task PrometheusExporterHttpServerIntegration()
.AddMeter(meter.Name)
.AddPrometheusExporter(o =>
{
#if NET461
#if NETFRAMEWORK
bool expectedDefaultState = true;
#else
bool expectedDefaultState = false;
Expand Down Expand Up @@ -142,7 +142,7 @@ public void ServerEndpointSanityCheckNegativeTest(params string[] uris)
if (ex is not ArgumentNullException)
{
Assert.Equal("System.ArgumentException", ex.GetType().ToString());
#if NET461
#if NETFRAMEWORK
Assert.Equal("Prometheus server path should be a valid URI with http/https scheme.\r\nParameter name: httpListenerPrefixes", ex.Message);
#else
Assert.Equal("Prometheus server path should be a valid URI with http/https scheme. (Parameter 'httpListenerPrefixes')", ex.Message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
// </copyright>

#if !NET461
#if !NETFRAMEWORK
using System;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void ProfilerCommandToActivity_UsesDnsEndPointAsEndPoint()
Assert.Equal(dnsEndPoint.Port, result.GetTagValue(SemanticConventions.AttributeNetPeerPort));
}

#if !NET461
#if !NETFRAMEWORK
[Fact]
public void ProfilerCommandToActivity_UsesOtherEndPointAsEndPoint()
{
Expand Down
3 changes: 2 additions & 1 deletion test/OpenTelemetry.Tests/Logs/LogRecordTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
#if !NET461

#if !NETFRAMEWORK
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down

0 comments on commit bf79f0d

Please sign in to comment.