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

Remove net 6.0 targets #2498

Merged
merged 8 commits into from
Nov 27, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/bootstrap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ runs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- id: dotnet
shell: bash
run: |
dotnet --list-sdks
dotnet --version
dotnet tool restore
AGENT_VERSION=$(dotnet minver -t=v -p=canary.0 -v=e)
echo "Version Number: ${AGENT_VERSION}"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@
if: "${{ inputs.azure == 'true' && runner.os == 'Linux' }}"
shell: bash
run: |
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install azure-functions-core-tools-4
sudo apt-get install azure-functions-core-tools-4=4.0.6280-1

- name: 'Windows: Azure functions core tools'
if: "${{ inputs.azure == 'true' && runner.os == 'Windows' }}"
shell: cmd
run: choco install azure-functions-core-tools -y --no-progress -r --version 4.0.4829
run: choco install azure-functions-core-tools -y --no-progress -r --version 4.0.6280

# TEST CONTAINERS CLOUD
# If no PR event or if a PR event that's caused by a non-fork and non dependabot actor
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@ jobs:

- name: 'Tests: Integrations'
run: ./build.sh test --test-suite integrations


- name: Store crash dumps
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: results
retention-days: 1
path: build/output/**/*.dmp

startup-hook-tests:
runs-on: ubuntu-latest
needs: [ 'format', 'tests' ]
Expand All @@ -134,7 +142,7 @@ jobs:

- name: 'Tests: StartupHooks'
run: ./build.sh test --test-suite startuphooks

profiler-tests:
runs-on: ubuntu-latest
needs: [ 'format', 'tests' ]
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ jobs:

- name: 'Tests: Integrations'
run: ./build.bat test --test-suite integrations

- name: Store crash dumps
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: results
retention-days: 1
path: build/output/**/*.dmp

startup-hook-tests:
runs-on: windows-2022
Expand All @@ -82,7 +90,7 @@ jobs:

- name: 'Tests: StartupHooks'
run: ./build.bat test --test-suite startuphooks

profiler-tests:
runs-on: windows-2022
needs: [ 'format', 'tests' ]
Expand Down Expand Up @@ -114,7 +122,6 @@ jobs:
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2


- name: Clean the application
run: msbuild /t:Clean /p:Configuration=Release

Expand Down Expand Up @@ -166,7 +173,6 @@ jobs:
--logger:"junit;LogFilePath=%cd%\build\output\junit-{framework}-{assembly}.xml;MethodFormat=Class;FailureBodyFormat=Verbose"

- name: Store test results
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: test-results-iis
Expand Down
44 changes: 20 additions & 24 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<GlobalPackageReference Include="MinVer" Version="4.3.0" PrivateAssets="All" />
<GlobalPackageReference Condition="'$(TargetFramework)' == 'net462'" Include="Microsoft.NETFramework.ReferenceAssemblies.net462" Version="1.0.3" PrivateAssets="all"/>
<GlobalPackageReference Condition="'$(TargetFramework)' == 'net462'" Include="Microsoft.NETFramework.ReferenceAssemblies.net462" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>
<!-- Community Packages -->
<ItemGroup>
Expand Down Expand Up @@ -53,15 +52,15 @@
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.8.1" />
<PackageVersion Include="Oracle.ManagedDataAccess" Version="21.13.0" />
<PackageVersion Include="Oracle.ManagedDataAccess.Core" Version="3.21.90"/>
<PackageVersion Include="Oracle.ManagedDataAccess.Core" Version="3.21.90" />
<PackageVersion Include="Polly" Version="7.2.1" />
<PackageVersion Include="Proc" Version="0.6.2"/>
<PackageVersion Include="Proc" Version="0.8.2" />
<PackageVersion Include="RabbitMQ.Client" Version="6.8.1" />
<PackageVersion Include="RichardSzalay.MockHttp" Version="6.0.0"/>
<PackageVersion Include="RichardSzalay.MockHttp" Version="6.0.0" />
<PackageVersion Include="SQLite.CodeFirst" Version="1.5.3.29" />
<PackageVersion Include="SharpZipLib" Version="1.3.3" />
<PackageVersion Include="SpecFlow.Tools.MsBuild.Generation" Version="3.5.5"/>
<PackageVersion Include="SpecFlow.xUnit" Version="3.5.5"/>
<PackageVersion Include="SpecFlow.Tools.MsBuild.Generation" Version="3.5.5" />
<PackageVersion Include="SpecFlow.xUnit" Version="3.5.5" />
<PackageVersion Include="StackExchange.Redis" Version="2.7.20" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="Testcontainers.Elasticsearch" Version="3.7.0" />
Expand All @@ -77,7 +76,6 @@
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>

<!-- Microsoft/System packages -->
<ItemGroup>
<PackageVersion Include="Microsoft.AspNet.Identity.EntityFramework" Version="2.2.3" />
Expand All @@ -98,43 +96,41 @@
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.0.0" />
<PackageVersion Include="Microsoft.Azure.DocumentDB.Core" Version="2.22.0" />
<PackageVersion Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker" Version="1.20.0"/>
<PackageVersion Include="Microsoft.Azure.Functions.Worker" Version="1.20.0" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Core" Version="1.6.0" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0"/>
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.1"/>
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.1" />
<PackageVersion Include="Microsoft.Azure.ServiceBus" Version="3.0.0" />
<PackageVersion Include="Microsoft.Azure.Storage.Blob" Version="11.2.2" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.5" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.0" PrivateAssets="All"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.0" PrivateAssets="All" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.2" />

<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" />

<PackageVersion Include="Microsoft.NET.Sdk.Functions" Version="4.1.1" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.1" />
<PackageVersion Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.Owin.Host.SystemWeb" Version="4.1.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageVersion Include="Microsoft.Web.Administration" Version="11.1.0" />
<PackageVersion Include="MicrosoftAspNetCore.Http" Version="2.1.22" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta1.20427.1" />
<PackageVersion Include="System.Data.SQLite" Version="1.0.112" />
<PackageVersion Include="System.Data.SqlClient" Version="4.8.6"/>
<PackageVersion Include="System.Data.SqlClient" Version="4.8.6" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="5.0.0" />
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="6.0.1" />
<PackageVersion Include="System.IO.FileSystem.AccessControl" Version="4.7.0" />
<PackageVersion Include="System.Reflection.Emit" Version="4.3.0" />
<PackageVersion Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
<PackageVersion Include="System.Reflection.Metadata" Version="5.0.0" />
<PackageVersion Include="System.Runtime.Loader" Version="4.3.0"/>
<PackageVersion Include="System.Runtime.Loader" Version="4.3.0" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="4.9.0" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>
Expand Down
8 changes: 7 additions & 1 deletion ElasticApmAgent.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleAspNetCoreApp", "test
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{267A241E-571F-458F-B04C-B6C4DE79E735}"
ProjectSection(SolutionItems) = preProject
test\.runsettings = test\.runsettings
test\Directory.Build.props = test\Directory.Build.props
test\xunit.runner.json = test\xunit.runner.json
test\.runsettings = test\.runsettings
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elastic.Apm", "src\Elastic.Apm\Elastic.Apm.csproj", "{90BC9629-C8D2-4FD5-863E-EA2D5FB37341}"
Expand Down Expand Up @@ -240,6 +240,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HostingTestApp", "test\inte
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Apm.Extensions.Tests.Shared", "test\integrations\Elastic.Apm.Extensions.Tests.Shared\Elastic.Apm.Extensions.Tests.Shared.csproj", "{7482D2D9-BBF7-4C8B-B26C-BEA9BCF345B0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7A07D777-DEC2-4BB7-B4A1-028BA658762A}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
26 changes: 19 additions & 7 deletions build/scripts/Build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,27 @@ module Build =
let testElseWhere = ["Tests"; "OpenTelemetry.Tests"; "StartupHook.Tests"; "Profiler.Managed.Tests"; "Azure"]
let filter = testElseWhere |> List.map (fun s -> $"FullyQualifiedName!~Elastic.Apm.%s{s}") |> String.concat "&"
Some filter
| _ -> None
| _ -> None

let verbosity =
match suite with
| TestSuite.Integrations -> "detailed"
| _ -> "minimal"

let blame =
match suite with
| TestSuite.Integrations -> Some [
"--blame-hang-timeout"; "15m";
"--blame-crash-dump-type"; "mini";
"--results-directory"; "build/output"]
| _ -> None

let command =
["test"; "-c"; "Release"; sln; "--no-build"; "--verbosity"; "minimal"; "-s"; "test/.runsettings"]
["test"; "-c"; "Release"; sln; "--no-build"; "--verbosity"; verbosity; "-s"; "test/.runsettings"]
@ (match filter with None -> [] | Some f -> ["--filter"; f])
@ (match framework with None -> [] | Some f -> ["-f"; f])
@ (match logger with None -> [] | Some l -> [l])
@ (match blame with None -> [] | Some l -> l)
@ ["--"; "RunConfiguration.CollectSourceInformation=true"]

DotNet.ExecWithTimeout command (TimeSpan.FromMinutes 30)
Expand Down Expand Up @@ -236,16 +250,14 @@ module Build =
ToolRestore()
DotNet.Exec ["restore" ; Paths.Solution; "-v"; "q"]
if isWindows then DotNet.Exec ["restore" ; aspNetFullFramework; "-v"; "q"]

let Format () =
DotNet.Exec ["dotnet"; "format"; "--verbosity"; "quiet"; "--exclude"; "src/Elastic.Apm/Libraries/"]

DotNet.Exec ["format"; "--verbosity"; "quiet"; "--verify-no-changes"; "--exclude"; "src/Elastic.Apm/Libraries/"]
let private copyDllsAndPdbs (destination: DirectoryInfo) (source: DirectoryInfo) =
source.GetFiles()
|> Seq.filter (fun file -> file.Extension = ".dll" || file.Extension = ".pdb")
|> Seq.iter (fun file -> file.CopyTo(Path.combine destination.FullName file.Name, true) |> ignore)

/// Creates versioned ElasticApmAgent.zip file
/// Creates versioned ElasticApmAgent.zip file
let AgentZip () =
let name = "ElasticApmAgent"
let currentAssemblyVersion = Versioning.CurrentVersion.FileVersion
Expand Down Expand Up @@ -277,7 +289,7 @@ module Build =

// assemblies compiled against 6.0 version of System.Diagnostics.DiagnosticSource
!! (Paths.BuildOutput (sprintf "Elastic.Apm.StartupHook.Loader_%i.0.0/netstandard2.0" oldDiagnosticSourceVersion.Major))
++ (Paths.BuildOutput (sprintf "Elastic.Apm_%i.0.0/net6.0" diagnosticSourceVersion6.Major))
++ (Paths.BuildOutput (sprintf "Elastic.Apm_%i.0.0/net8.0" diagnosticSourceVersion6.Major))
|> Seq.filter Path.isDirectory
|> Seq.map DirectoryInfo
|> Seq.iter (copyDllsAndPdbs (agentDir.CreateSubdirectory(sprintf "%i.0.0" diagnosticSourceVersion6.Major)))
Expand Down
2 changes: 1 addition & 1 deletion sample/ApiSamples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public static void SampleSpanWithCustomContextFillAll()
// ReSharper restore ArrangeMethodOrOperatorBody
#pragma warning restore IDE0022

#if NET6_0_OR_GREATER
#if NET8_0_OR_GREATER
/// <summary>
/// Test for https://github.com/elastic/apm-agent-dotnet/issues/884
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Elastic.Apm/Api/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ static bool CheckForLoadedAssembly(string name)
// Legacy mechanism: if the profiler is loaded add a `p` suffix to Agent.Version
service.Agent.Version += "-p";
// Check if profiler was injected via K8S hook.
var envvars =new EnvironmentVariables(logger);
if (envvars.SafeCheckValue("ELASTIC_APM_ACTIVATION_METHOD", "K8S")
var envvars = new EnvironmentVariables(logger);
if (envvars.SafeCheckValue("ELASTIC_APM_ACTIVATION_METHOD", "K8S")
|| envvars.SafeCheckValue("ELASTIC_APM_ACTIVATION_METHOD", "K8S_ATTACH"))
activationMethod = Consts.ActivationK8SAttach;
else
Expand Down
4 changes: 2 additions & 2 deletions src/Elastic.Apm/Elastic.Apm.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462;net472;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net462;net472;net8.0</TargetFrameworks>
<IsPackable>true</IsPackable>
</PropertyGroup>
<PropertyGroup>
Expand Down Expand Up @@ -103,7 +103,7 @@
<PackageReference Include="System.Threading.Tasks.Dataflow" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="System.Diagnostics.PerformanceCounter" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/Elastic.Apm/Filters/CookieHeaderRedactionFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Elastic.Apm.Config;
using Elastic.Apm.Helpers;
using Elastic.Apm.Model;
#if NET6_0_OR_GREATER
#if NET8_0_OR_GREATER
using System.Buffers;
#endif

Expand Down Expand Up @@ -45,7 +45,7 @@ internal static void HandleCookieHeader(Dictionary<string, string> headers, IRea
// e.g. Cookies | cookies | COOKIES
const int maxKeys = 4;

#if NET6_0_OR_GREATER
#if NET8_0_OR_GREATER
var matchedKeys = ArrayPool<string>.Shared.Rent(maxKeys);
var matchedValues = ArrayPool<string>.Shared.Rent(maxKeys);
#else
Expand Down Expand Up @@ -81,7 +81,7 @@ internal static void HandleCookieHeader(Dictionary<string, string> headers, IRea
}
}

#if NET6_0_OR_GREATER
#if NET8_0_OR_GREATER
ArrayPool<string>.Shared.Return(matchedKeys);
ArrayPool<string>.Shared.Return(matchedValues);
#endif
Expand Down
8 changes: 5 additions & 3 deletions src/Elastic.Apm/Libraries/Newtonsoft.Json/JsonException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ public JsonException(string message, Exception? innerException)
/// <exception cref="ArgumentNullException">The <paramref name="info"/> parameter is <c>null</c>.</exception>
/// <exception cref="SerializationException">The class name is <c>null</c> or <see cref="Exception.HResult"/> is zero (0).</exception>
public JsonException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#pragma warning disable SYSLIB0051
: base(info, context)
#pragma warning restore SYSLIB0051
{
}
#endif

internal static JsonException Create(IJsonLineInfo lineInfo, string path, string message)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region License
#region License

// Copyright (c) 2007 James Newton-King
//
Expand Down Expand Up @@ -35,9 +35,11 @@
#nullable enable
namespace Elastic.Apm.Libraries.Newtonsoft.Json.Serialization
{
internal class JsonFormatterConverter : IFormatterConverter
{
private readonly JsonSerializerInternalReader _reader;
#pragma warning disable SYSLIB0050
internal class JsonFormatterConverter : IFormatterConverter
#pragma warning restore SYSLIB0050
{
private readonly JsonSerializerInternalReader _reader;
private readonly JsonISerializableContract _contract;
private readonly JsonProperty? _member;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region License
#region License

// Copyright (c) 2007 James Newton-King
//
Expand Down Expand Up @@ -183,8 +183,10 @@ internal object GetUninitializedObject()
throw new JsonException("Insufficient permissions. Creating an uninitialized '{0}' type requires full trust.".FormatWith(CultureInfo.InvariantCulture, NonNullableUnderlyingType));
}

return FormatterServices.GetUninitializedObject(NonNullableUnderlyingType);
}
#pragma warning disable SYSLIB0050
return FormatterServices.GetUninitializedObject(NonNullableUnderlyingType);
#pragma warning restore SYSLIB0050
}
#endif
}
}
Loading
Loading