Skip to content

Commit

Permalink
Updated projects to build better with VS Code / OmniSharp on Mac (#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
tillig authored Feb 15, 2023
1 parent 1c8cc26 commit 673e1f6
Show file tree
Hide file tree
Showing 45 changed files with 118 additions and 83 deletions.
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"cSpell.words": [
"fluentdData"
"awsx",
"fluentddata",
"otel",
"protobuf",
"traceparent",
"xunit"
]
}
3 changes: 2 additions & 1 deletion examples/wcf/shared/Examples.Wcf.Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net452;netstandard2.0</TargetFrameworks>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
<Description>OpenTelemetry extensions for AWS X-Ray.</Description>
<MinVerTagPrefix>Extensions.AWSXRay-</MinVerTagPrefix>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;netstandard2.0</TargetFrameworks>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
<Description>AWS client instrumentation for OpenTelemetry .NET</Description>
<MinVerTagPrefix>Instrumentation.AWS-</MinVerTagPrefix>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Description>An OpenTelemetry .NET exporter that exports to local ETW or UDS</Description>
<Authors>OpenTelemetry Authors</Authors>
<NoWarn>$(NoWarn),CS1591,SA1123,SA1310,CA1810,CA1822,CA2000,CA2208,SA1201,SA1202,SA1308,SA1309,SA1311,SA1402,SA1602,SA1649</NoWarn>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<MinVerTagPrefix>Exporter.Geneva-</MinVerTagPrefix>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<PackageTags>Instana Tracing APM</PackageTags>
<Description>Instana .NET Exporter for OpenTelemetry</Description>
<MinVerTagPrefix>Exporter.Instana-</MinVerTagPrefix>
<PackageTags>Instana Tracing APM</PackageTags>
<Description>Instana .NET Exporter for OpenTelemetry</Description>
<MinVerTagPrefix>Exporter.Instana-</MinVerTagPrefix>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<Description>Stackdriver .NET Exporter for OpenTelemetry.</Description>
<PackageTags>$(PackageTags);Stackdriver;Google;GCP;distributed-tracing</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks Condition="'$(Configuration)' == 'Debug'">$(TargetFrameworks);net6.0</TargetFrameworks> <!-- Added just to get proper nullable analysis in IDE -->
<TargetFrameworks Condition="'$(Configuration)' == 'Debug'">net6.0;$(TargetFrameworks)</TargetFrameworks> <!-- Added just to get proper nullable analysis in IDE -->
<MinVerTagPrefix>Extensions.AzureMonitor-</MinVerTagPrefix>
<EnableAnalysis>true</EnableAnalysis>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<Description>OpenTelemetry Extensions - Container Resource Detector from Docker environment.</Description>
<MinVerTagPrefix>Extensions.Docker-</MinVerTagPrefix>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks Condition="'$(Configuration)' == 'Debug'">$(TargetFrameworks);net6.0</TargetFrameworks> <!-- Added just to get proper nullable analysis in IDE -->
<TargetFrameworks Condition="'$(Configuration)' == 'Debug'">net6.0;$(TargetFrameworks)</TargetFrameworks> <!-- Added just to get proper nullable analysis in IDE -->
<Description>OpenTelemetry Persistent Storage Abstractions</Description>
<MinVerTagPrefix>Extensions.PersistentStorage.Abstractions-</MinVerTagPrefix>
<NoWarn>$(NoWarn),CA1031</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks Condition="'$(Configuration)' == 'Debug'">$(TargetFrameworks);net6.0</TargetFrameworks> <!-- Added just to get proper nullable analysis in IDE -->
<TargetFrameworks Condition="'$(Configuration)' == 'Debug'">net6.0;$(TargetFrameworks)</TargetFrameworks> <!-- Added just to get proper nullable analysis in IDE -->
<Description>OpenTelemetry Persistent Storage</Description>
<MinVerTagPrefix>Extensions.PersistentStorage-</MinVerTagPrefix>
</PropertyGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/OpenTelemetry.Extensions/OpenTelemetry.Extensions.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="'$(Configuration)' == 'Debug'">$(TargetFrameworks);net6.0</TargetFrameworks> <!-- Added just to get proper nullable analysis in IDE -->
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0;net462;</TargetFrameworks>
<TargetFrameworks Condition="'$(Configuration)' == 'Debug'">net6.0;$(TargetFrameworks)</TargetFrameworks> <!-- Added just to get proper nullable analysis in IDE -->
<Description>OpenTelemetry .NET SDK preview features and extensions</Description>
<MinVerTagPrefix>Extensions-</MinVerTagPrefix>
<Nullable>enable</Nullable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<Description>Elasticsearch instrumentation for OpenTelemetry .NET</Description>
<PackageTags>$(PackageTags);distributed-tracing</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using global::Grpc.Core;
using Grpc.Core;

namespace OpenTelemetry.Instrumentation.GrpcCore;

Expand All @@ -29,7 +29,7 @@ namespace OpenTelemetry.Instrumentation.GrpcCore;
/// https://github.com/opentracing-contrib/csharp-grpc/blob/master/src/OpenTracing.Contrib.Grpc/Streaming/TracingAsyncStreamReader.cs.
/// </remarks>
/// <typeparam name="T">The message type.</typeparam>
/// <seealso cref="global::Grpc.Core.IAsyncStreamReader{T}" />
/// <seealso cref="IAsyncStreamReader{T}" />
internal class AsyncStreamReaderProxy<T> : IAsyncStreamReader<T>
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System;
using System.Threading.Tasks;
using global::Grpc.Core;
using Grpc.Core;

namespace OpenTelemetry.Instrumentation.GrpcCore;

Expand All @@ -28,7 +28,7 @@ namespace OpenTelemetry.Instrumentation.GrpcCore;
/// https://github.com/opentracing-contrib/csharp-grpc/blob/master/src/OpenTracing.Contrib.Grpc/Streaming/TracingClientStreamWriter.cs.
/// </remarks>
/// <typeparam name="T">The message type.</typeparam>
/// <seealso cref="global::Grpc.Core.IClientStreamWriter{T}" />
/// <seealso cref="IClientStreamWriter{T}" />
internal class ClientStreamWriterProxy<T> : IClientStreamWriter<T>
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using global::Grpc.Core;
using global::Grpc.Core.Interceptors;
using Grpc.Core;
using Grpc.Core.Interceptors;
using OpenTelemetry.Context.Propagation;
using OpenTelemetry.Internal;

Expand All @@ -27,7 +27,7 @@ namespace OpenTelemetry.Instrumentation.GrpcCore;
/// <summary>
/// A client interceptor that starts and stops an Activity for each outbound RPC.
/// </summary>
/// <seealso cref="global::Grpc.Core.Interceptors.Interceptor" />
/// <seealso cref="Interceptor" />
public class ClientTracingInterceptor : Interceptor
{
/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using global::Grpc.Core;
using Google.Protobuf;
using Grpc.Core;
using OpenTelemetry.Trace;

namespace OpenTelemetry.Instrumentation.GrpcCore;
Expand Down Expand Up @@ -197,7 +197,7 @@ private void StopActivity(int statusCode, string statusDescription = null)
this.activity.SetTag(SemanticConventions.AttributeRpcGrpcStatusCode, statusCode);
if (statusDescription != null)
{
this.activity.SetStatus(OpenTelemetry.Trace.Status.Error.WithDescription(statusDescription));
this.activity.SetStatus(Trace.Status.Error.WithDescription(statusDescription));
}

this.activity.Stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System;
using System.Threading.Tasks;
using global::Grpc.Core;
using Grpc.Core;

namespace OpenTelemetry.Instrumentation.GrpcCore;

Expand All @@ -28,7 +28,7 @@ namespace OpenTelemetry.Instrumentation.GrpcCore;
/// https://github.com/opentracing-contrib/csharp-grpc/blob/master/src/OpenTracing.Contrib.Grpc/Streaming/TracingServerStreamWriter.cs.
/// </remarks>
/// <typeparam name="T">The message type.</typeparam>
/// <seealso cref="global::Grpc.Core.IServerStreamWriter{T}" />
/// <seealso cref="IServerStreamWriter{T}" />
internal class ServerStreamWriterProxy<T> : IServerStreamWriter<T>
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using global::Grpc.Core;
using global::Grpc.Core.Interceptors;
using Grpc.Core;
using Grpc.Core.Interceptors;
using OpenTelemetry.Context.Propagation;
using OpenTelemetry.Internal;

Expand All @@ -29,7 +29,7 @@ namespace OpenTelemetry.Instrumentation.GrpcCore;
/// <summary>
/// A service interceptor that starts and stops an Activity for each inbound RPC.
/// </summary>
/// <seealso cref="global::Grpc.Core.Interceptors.Interceptor" />
/// <seealso cref="Interceptor" />
public class ServerTracingInterceptor : Interceptor
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private static IEnumerable<string> ExtractActivityProperties(Dictionary<string,
return telemetryData.ContainsKey(key) ? new[] { telemetryData[key] } : Enumerable.Empty<string>();
}

private void SetStatusAndRecordException(Activity activity, System.Exception exception)
private void SetStatusAndRecordException(Activity activity, Exception exception)
{
activity.SetStatus(ActivityStatusCode.Error, exception.Message);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462;net6.0</TargetFrameworks>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>net6.0;netstandard2.0;net462</TargetFrameworks>
<Description>dotnet runtime instrumentation for OpenTelemetry .NET</Description>
<PackageTags>$(PackageTags);runtime</PackageTags>
<MinVerTagPrefix>Instrumentation.Runtime-</MinVerTagPrefix>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<Description>OpenTelemetry instrumentation for WCF</Description>
<PackageTags>$(PackageTags);distributed-tracing;WCF</PackageTags>
<MinVerTagPrefix>Instrumentation.Wcf-</MinVerTagPrefix>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<Description>Unit test project for AWS X-Ray for OpenTelemetry</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net452</TargetFrameworks>
</PropertyGroup>
Expand All @@ -10,7 +11,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPkgVer)" />
<PackageReference Include="xunit" Version="$(XUnitPkgVer)" />
<PackageReference Include="Moq" Version="$(MoqNet45PkgVer)" />
<PackageReference Condition="$([MSBuild]::IsOsPlatform('Windows'))" Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioPkgVer)">
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioPkgVer)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// limitations under the License.
// </copyright>

using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using OpenTelemetry.Contrib.Extensions.AWSXRay.Resources.Http;
using Xunit;
Expand All @@ -27,23 +28,27 @@ public class TestServerCertificateValidationProvider
[Fact]
public void TestValidCertificate()
{
using (CertificateUploader certificateUploader = new CertificateUploader())
// This test fails on Linux in netcoreapp3.1, but passes in net6.0 and net7.0.
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
certificateUploader.Create();
using (CertificateUploader certificateUploader = new CertificateUploader())
{
certificateUploader.Create();

// Loads the certificate to the trusted collection from the file
ServerCertificateValidationProvider serverCertificateValidationProvider =
ServerCertificateValidationProvider.FromCertificateFile(certificateUploader.FilePath);
// Loads the certificate to the trusted collection from the file
ServerCertificateValidationProvider serverCertificateValidationProvider =
ServerCertificateValidationProvider.FromCertificateFile(certificateUploader.FilePath);

// Validates if the certificate loaded into the trusted collection.
Assert.True(serverCertificateValidationProvider.IsCertificateLoaded);
// Validates if the certificate loaded into the trusted collection.
Assert.True(serverCertificateValidationProvider.IsCertificateLoaded);

var certificate = new X509Certificate2(certificateUploader.FilePath);
X509Chain chain = new X509Chain();
chain.Build(certificate);
var certificate = new X509Certificate2(certificateUploader.FilePath);
X509Chain chain = new X509Chain();
chain.Build(certificate);

// validates if certificate is valid
Assert.True(serverCertificateValidationProvider.ValidationCallback(null, certificate, chain, System.Net.Security.SslPolicyErrors.None));
// validates if certificate is valid
Assert.True(serverCertificateValidationProvider.ValidationCallback(null, certificate, chain, System.Net.Security.SslPolicyErrors.None));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<Description>Unit test project for AWS client instrumentation for OpenTelemetry</Description>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net452</TargetFrameworks>
</PropertyGroup>
Expand All @@ -13,7 +14,7 @@
<PackageReference Include="AWSSDK.SQS" Version="3.5.0.26" />
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.5.1.2" />
<PackageReference Include="Moq" Version="$(MoqNet45PkgVer)" />
<PackageReference Condition="$([MSBuild]::IsOsPlatform('Windows'))" Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioPkgVer)">
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioPkgVer)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public HttpContent GetRequestContent()

public Task<HttpContent> GetRequestContentAsync()
{
return Task.FromResult<HttpContent>(new HttpRequestMessage().Content);
return Task.FromResult(new HttpRequestMessage().Content);
}

public IWebResponseData GetResponse()
Expand All @@ -227,7 +227,7 @@ public Task<IWebResponseData> GetResponseAsync(CancellationToken cancellationTok
{
this.GetResponseAction?.Invoke();
var response = this.ResponseCreator(this);
return Task.FromResult<IWebResponseData>(CustomWebResponse.GenerateWebResponse(response));
return Task.FromResult(CustomWebResponse.GenerateWebResponse(response));
}

public void SetRequestHeaders(IDictionary<string, string> headers)
Expand Down
Loading

0 comments on commit 673e1f6

Please sign in to comment.