Skip to content

Commit

Permalink
NuGet Audit fix - WCF .NET Client testing application (#3719)
Browse files Browse the repository at this point in the history
* NuGet Audit fix - WCF .NET Client testing application

* Fix WCF Client bytecode integration
  • Loading branch information
Kielek authored Oct 22, 2024
1 parent 5a64497 commit 0f582b9
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 11 deletions.
1 change: 1 addition & 0 deletions build/LibraryVersions.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public static partial class LibraryVersion
{
new("4.10.2"),
new("6.2.0"),
new("8.0.0", supportedFrameworks: new string[] {"net8.0"}),
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ private static NativeCallTargetDefinition[] GetDefinitionsArray()
nativeCallTargetDefinitions.Add(new("System.Private.ServiceModel", "System.ServiceModel.ChannelFactory", "InitializeEndpoint", new[] {"System.Void", "System.String", "System.ServiceModel.EndpointAddress"}, 4, 0, 0, 4, 65535, 65535, AssemblyFullName, "OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client.WcfClientIntegration"));
nativeCallTargetDefinitions.Add(new("System.Private.ServiceModel", "System.ServiceModel.ChannelFactory", "InitializeEndpoint", new[] {"System.Void", "System.ServiceModel.Description.ServiceEndpoint"}, 4, 0, 0, 4, 65535, 65535, AssemblyFullName, "OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client.WcfClientIntegration"));
nativeCallTargetDefinitions.Add(new("System.Private.ServiceModel", "System.ServiceModel.ChannelFactory", "InitializeEndpoint", new[] {"System.Void", "System.ServiceModel.Channels.Binding", "System.ServiceModel.EndpointAddress"}, 4, 0, 0, 4, 65535, 65535, AssemblyFullName, "OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client.WcfClientIntegration"));
nativeCallTargetDefinitions.Add(new("System.ServiceModel.Primitives", "System.ServiceModel.ChannelFactory", "InitializeEndpoint", new[] {"System.Void", "System.String", "System.ServiceModel.EndpointAddress"}, 6, 0, 0, 6, 65535, 65535, AssemblyFullName, "OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client.WcfClientIntegration"));
nativeCallTargetDefinitions.Add(new("System.ServiceModel.Primitives", "System.ServiceModel.ChannelFactory", "InitializeEndpoint", new[] {"System.Void", "System.ServiceModel.Description.ServiceEndpoint"}, 6, 0, 0, 6, 65535, 65535, AssemblyFullName, "OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client.WcfClientIntegration"));
nativeCallTargetDefinitions.Add(new("System.ServiceModel.Primitives", "System.ServiceModel.ChannelFactory", "InitializeEndpoint", new[] {"System.Void", "System.ServiceModel.Channels.Binding", "System.ServiceModel.EndpointAddress"}, 6, 0, 0, 6, 65535, 65535, AssemblyFullName, "OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client.WcfClientIntegration"));
nativeCallTargetDefinitions.Add(new("System.ServiceModel.Primitives", "System.ServiceModel.ChannelFactory", "InitializeEndpoint", new[] {"System.Void", "System.String", "System.ServiceModel.EndpointAddress"}, 6, 0, 0, 8, 65535, 65535, AssemblyFullName, "OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client.WcfClientIntegration"));
nativeCallTargetDefinitions.Add(new("System.ServiceModel.Primitives", "System.ServiceModel.ChannelFactory", "InitializeEndpoint", new[] {"System.Void", "System.ServiceModel.Description.ServiceEndpoint"}, 6, 0, 0, 8, 65535, 65535, AssemblyFullName, "OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client.WcfClientIntegration"));
nativeCallTargetDefinitions.Add(new("System.ServiceModel.Primitives", "System.ServiceModel.ChannelFactory", "InitializeEndpoint", new[] {"System.Void", "System.ServiceModel.Channels.Binding", "System.ServiceModel.EndpointAddress"}, 6, 0, 0, 8, 65535, 65535, AssemblyFullName, "OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client.WcfClientIntegration"));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client;
returnTypeName: ClrNames.Void,
parameterTypeNames: new[] { ClrNames.String, WcfClientConstants.EndpointAddressTypeName },
minimumVersion: WcfCommonConstants.Min6Version,
maximumVersion: WcfCommonConstants.Max6Version,
maximumVersion: WcfCommonConstants.Max8Version,
integrationName: WcfClientConstants.IntegrationName,
type: InstrumentationType.Trace)]
[InstrumentMethod(
Expand All @@ -56,7 +56,7 @@ namespace OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client;
returnTypeName: ClrNames.Void,
parameterTypeNames: new[] { WcfClientConstants.ServiceEndpointTypeName },
minimumVersion: WcfCommonConstants.Min6Version,
maximumVersion: WcfCommonConstants.Max6Version,
maximumVersion: WcfCommonConstants.Max8Version,
integrationName: WcfClientConstants.IntegrationName,
type: InstrumentationType.Trace)]
[InstrumentMethod(
Expand All @@ -66,7 +66,7 @@ namespace OpenTelemetry.AutoInstrumentation.Instrumentations.Wcf.Client;
returnTypeName: ClrNames.Void,
parameterTypeNames: new[] { WcfClientConstants.BindingTypeName, WcfClientConstants.EndpointAddressTypeName },
minimumVersion: WcfCommonConstants.Min6Version,
maximumVersion: WcfCommonConstants.Max6Version,
maximumVersion: WcfCommonConstants.Max8Version,
integrationName: WcfClientConstants.IntegrationName,
type: InstrumentationType.Trace)]
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal static class WcfCommonConstants

public const string ServiceModelPrimitivesAssemblyName = "System.ServiceModel.Primitives";
public const string Min6Version = "6.0.0";
public const string Max6Version = "6.*.*";
public const string Max8Version = "8.*.*";
#endif
public const string Min4Version = "4.0.0";
public const string Max4Version = "4.*.*";
Expand Down
6 changes: 4 additions & 2 deletions test/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.Data.SqlClient" Version="4.8.6" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="8.0.0" />
<PackageVersion Include="System.Formats.Asn1" Version="8.0.1" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageVersion Include="System.ServiceModel.Http" Version="6.2.0" />
<PackageVersion Include="System.ServiceModel.NetTcp" Version="6.2.0" />
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
<PackageVersion Include="System.ServiceModel.Http" Version="8.0.0" />
<PackageVersion Include="System.ServiceModel.NetTcp" Version="8.0.0" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="Testcontainers" Version="3.10.0" />
<PackageVersion Include="Verify.Xunit" Version="20.8.2" />
Expand Down
3 changes: 3 additions & 0 deletions test/IntegrationTests/LibraryVersions.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ public static TheoryData<string> WCFCoreClient
#else
theoryData.Add("4.10.2");
theoryData.Add("6.2.0");
#if NET8_0
theoryData.Add("8.0.0");
#endif
#endif
return theoryData;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition=" '$(LibraryVersion)' != '' or '$(TargetFramework)' == 'net8.0' " >
<PackageReference Include="System.ServiceModel.Http" VersionOverride="$(LibraryVersion)" />
<PackageReference Include="System.ServiceModel.NetTcp" VersionOverride="$(LibraryVersion)" />
</ItemGroup>

<ItemGroup Condition=" '$(LibraryVersion)' == '' and '$(TargetFramework)' != 'net8.0' " >
<PackageReference Include="System.ServiceModel.Http" VersionOverride="6.2.0" />
<PackageReference Include="System.ServiceModel.NetTcp" VersionOverride="6.2.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Security.Cryptography.Pkcs" />
<PackageReference Include="System.Formats.Asn1" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion tools/LibraryVersionsGenerator/PackageVersionDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ all lower versions than 8.15.10 contains references impacted by
Versions = new List<PackageVersion>
{
new("4.10.2"),
new("*")
new("6.2.0"),
new("*", supportedTargetFrameworks: new[] { "net8.0" }, supportedExecutionFrameworks: new[] { "net8.0" })
}
},
new()
Expand Down

0 comments on commit 0f582b9

Please sign in to comment.