Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Solution] Update preprocessor directives ahead of System.Diagnostics.DiagnosticSource .NET 7 update #3095

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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