From 0eeaf5054caa4b3b84b3efbb6e4b3c18a3a8557c Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Mon, 25 Nov 2024 10:44:23 +0000 Subject: [PATCH] Remove net 6.0 targets and update accordingly --- .github/workflows/bootstrap/action.yml | 2 +- .../workflows/install-dependencies/action.yml | 6 ++-- Directory.Packages.props | 16 +++++----- build/scripts/Build.fs | 8 ++--- sample/ApiSamples/Program.cs | 2 +- src/Elastic.Apm/Api/Service.cs | 4 +-- src/Elastic.Apm/Elastic.Apm.csproj | 4 +-- .../Filters/CookieHeaderRedactionFilter.cs | 6 ++-- .../Newtonsoft.Json/JsonException.cs | 8 +++-- .../Serialization/JsonFormatterConverter.cs | 10 ++++--- .../Serialization/JsonObjectContract.cs | 8 +++-- .../JsonSerializerInternalReader.cs | 6 ++-- .../JsonSerializerInternalWriter.cs | 6 ++-- .../Newtonsoft.Json/Utilities/AsyncUtils.cs | 2 +- .../Logging/IApmLoggingExtensions.cs | 2 +- src/Elastic.Apm/Logging/ScopedLogger.cs | 2 +- .../Metrics/Linux/GlobalMemoryStatus.cs | 6 ++-- .../MetricsProvider/CgroupMetricsProvider.cs | 10 +++---- .../OpenTelemetry/ElasticActivityListener.cs | 4 +-- src/Elastic.Apm/Report/PayloadSenderV2.cs | 2 +- .../Elastic.Apm.Azure.ServiceBus.csproj | 2 +- .../Elastic.Apm.EntityFrameworkCore.csproj | 4 +-- .../ApplicationBuilderExtensions.cs | 2 +- .../Elastic.Apm.AspNetCore.csproj | 4 +-- .../CompositeLogger.cs | 2 -- .../Elastic.Apm.Extensions.Hosting.csproj | 30 +++++++++---------- .../ServiceCollectionExtensions.cs | 2 +- .../Elastic.Apm.Extensions.Logging.csproj | 6 ++-- .../Elastic.Apm.NetCoreAll.csproj | 2 +- .../Elastic.Apm.Profiler.Managed.Core.csproj | 2 +- .../DuckTyping/DuckType.Statics.cs | 2 +- test/Elastic.Apm.Tests/LoggerTests.cs | 2 +- .../Elastic.Apm.AzureFunctionApp.Core.csproj | 2 +- .../Elastic.AzureFunctionApp.InProcess.csproj | 2 +- .../local.settings.json | 3 +- .../AspNetCoreBasicTests.cs | 4 +-- .../SampleAspNetCoreApp.csproj | 10 +------ .../SampleConsoleNetCoreApp.csproj | 2 +- .../WebApiSample/WebApiSample.csproj | 2 +- .../AdoNet/AdoNetTestData.cs | 1 - .../ValueTaskContinuationGeneratorTests.cs | 4 +-- .../DuckTyping/DuckIgnoreTests.cs | 2 +- .../Elastic.Apm.AdoNet.csproj | 2 +- .../MySqlDataSample/MySqlDataSample.csproj | 2 +- .../NpgsqlSample/NpgsqlSample.csproj | 2 +- .../OracleManagedDataAccessCoreSample.csproj | 2 +- .../SqlClientSample/SqlClientSample.csproj | 2 +- .../SqliteSample/SqliteSample.csproj | 2 +- .../Elastic.Apm.StartupHook.Sample.csproj | 2 +- .../StartupHookTests.cs | 1 - 50 files changed, 108 insertions(+), 113 deletions(-) diff --git a/.github/workflows/bootstrap/action.yml b/.github/workflows/bootstrap/action.yml index 6dd6532b3..d5b4b52d5 100644 --- a/.github/workflows/bootstrap/action.yml +++ b/.github/workflows/bootstrap/action.yml @@ -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}" diff --git a/.github/workflows/install-dependencies/action.yml b/.github/workflows/install-dependencies/action.yml index df05f3bde..0b4f65c99 100644 --- a/.github/workflows/install-dependencies/action.yml +++ b/.github/workflows/install-dependencies/action.yml @@ -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 diff --git a/Directory.Packages.props b/Directory.Packages.props index dc7fefcd7..3733e4ccf 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -111,15 +111,15 @@ - - - - - - - + + + + + + + - + diff --git a/build/scripts/Build.fs b/build/scripts/Build.fs index af344d962..1cbadf365 100644 --- a/build/scripts/Build.fs +++ b/build/scripts/Build.fs @@ -236,16 +236,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 @@ -277,7 +275,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))) diff --git a/sample/ApiSamples/Program.cs b/sample/ApiSamples/Program.cs index 58d3eb5dc..ef51c3f08 100644 --- a/sample/ApiSamples/Program.cs +++ b/sample/ApiSamples/Program.cs @@ -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 /// /// Test for https://github.com/elastic/apm-agent-dotnet/issues/884 /// diff --git a/src/Elastic.Apm/Api/Service.cs b/src/Elastic.Apm/Api/Service.cs index 4a827d2bd..07107c7a9 100644 --- a/src/Elastic.Apm/Api/Service.cs +++ b/src/Elastic.Apm/Api/Service.cs @@ -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 diff --git a/src/Elastic.Apm/Elastic.Apm.csproj b/src/Elastic.Apm/Elastic.Apm.csproj index ef7b4ae93..361acc507 100644 --- a/src/Elastic.Apm/Elastic.Apm.csproj +++ b/src/Elastic.Apm/Elastic.Apm.csproj @@ -1,6 +1,6 @@ - netstandard2.0;net462;net472;net6.0 + netstandard2.0;net462;net472;net8.0 true @@ -103,7 +103,7 @@ - + diff --git a/src/Elastic.Apm/Filters/CookieHeaderRedactionFilter.cs b/src/Elastic.Apm/Filters/CookieHeaderRedactionFilter.cs index ed81382fb..b8574c057 100644 --- a/src/Elastic.Apm/Filters/CookieHeaderRedactionFilter.cs +++ b/src/Elastic.Apm/Filters/CookieHeaderRedactionFilter.cs @@ -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 @@ -45,7 +45,7 @@ internal static void HandleCookieHeader(Dictionary headers, IRea // e.g. Cookies | cookies | COOKIES const int maxKeys = 4; -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER var matchedKeys = ArrayPool.Shared.Rent(maxKeys); var matchedValues = ArrayPool.Shared.Rent(maxKeys); #else @@ -81,7 +81,7 @@ internal static void HandleCookieHeader(Dictionary headers, IRea } } -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER ArrayPool.Shared.Return(matchedKeys); ArrayPool.Shared.Return(matchedValues); #endif diff --git a/src/Elastic.Apm/Libraries/Newtonsoft.Json/JsonException.cs b/src/Elastic.Apm/Libraries/Newtonsoft.Json/JsonException.cs index a570b8ab7..c0548f1c2 100644 --- a/src/Elastic.Apm/Libraries/Newtonsoft.Json/JsonException.cs +++ b/src/Elastic.Apm/Libraries/Newtonsoft.Json/JsonException.cs @@ -73,9 +73,11 @@ public JsonException(string message, Exception? innerException) /// The parameter is null. /// The class name is null or is zero (0). 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) diff --git a/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs b/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs index bc8c03805..1282cd9cf 100644 --- a/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs +++ b/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs @@ -1,4 +1,4 @@ -#region License +#region License // Copyright (c) 2007 James Newton-King // @@ -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; diff --git a/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonObjectContract.cs b/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonObjectContract.cs index f23fe0274..47dd88017 100644 --- a/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonObjectContract.cs +++ b/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonObjectContract.cs @@ -1,4 +1,4 @@ -#region License +#region License // Copyright (c) 2007 James Newton-King // @@ -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 } } diff --git a/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs b/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs index 92ea3d3b0..ade850b08 100644 --- a/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs +++ b/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs @@ -1552,9 +1552,11 @@ private object CreateISerializable(JsonReader reader, JsonISerializableContract TraceWriter.Trace(TraceLevel.Info, JsonPosition.FormatMessage(reader as IJsonLineInfo, reader.Path, "Deserializing {0} using ISerializable constructor.".FormatWith(CultureInfo.InvariantCulture, contract.UnderlyingType)), null); } - SerializationInfo serializationInfo = new SerializationInfo(contract.UnderlyingType, new JsonFormatterConverter(this, contract, member)); +#pragma warning disable SYSLIB0050 + SerializationInfo serializationInfo = new SerializationInfo(contract.UnderlyingType, new JsonFormatterConverter(this, contract, member)); +#pragma warning restore SYSLIB0050 - bool finished = false; + bool finished = false; do { switch (reader.TokenType) diff --git a/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs b/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs index f79534f72..2bc1540b8 100644 --- a/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs +++ b/src/Elastic.Apm/Libraries/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs @@ -761,10 +761,12 @@ private void SerializeISerializable(JsonWriter writer, ISerializable value, Json WriteObjectStart(writer, value, contract, member, collectionContract, containerProperty); - SerializationInfo serializationInfo = new SerializationInfo(contract.UnderlyingType, new FormatterConverter()); +#pragma warning disable SYSLIB0050 + SerializationInfo serializationInfo = new SerializationInfo(contract.UnderlyingType, new FormatterConverter()); value.GetObjectData(serializationInfo, Serializer._context); +#pragma warning restore SYSLIB0050 - foreach (SerializationEntry serializationEntry in serializationInfo) + foreach (SerializationEntry serializationEntry in serializationInfo) { JsonContract? valueContract = GetContractSafe(serializationEntry.Value); diff --git a/src/Elastic.Apm/Libraries/Newtonsoft.Json/Utilities/AsyncUtils.cs b/src/Elastic.Apm/Libraries/Newtonsoft.Json/Utilities/AsyncUtils.cs index 063bf03da..7fae325f5 100644 --- a/src/Elastic.Apm/Libraries/Newtonsoft.Json/Utilities/AsyncUtils.cs +++ b/src/Elastic.Apm/Libraries/Newtonsoft.Json/Utilities/AsyncUtils.cs @@ -100,7 +100,7 @@ public static Task ReadAsync(this TextReader reader, char[] buffer, int ind public static bool IsCompletedSucessfully(this Task task) { // IsCompletedSuccessfully is the faster method, but only currently exposed on .NET Core 2.0 -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER return task.IsCompletedSuccessfully; #else return task.Status == TaskStatus.RanToCompletion; diff --git a/src/Elastic.Apm/Logging/IApmLoggingExtensions.cs b/src/Elastic.Apm/Logging/IApmLoggingExtensions.cs index b645b54ca..4b9b4521c 100644 --- a/src/Elastic.Apm/Logging/IApmLoggingExtensions.cs +++ b/src/Elastic.Apm/Logging/IApmLoggingExtensions.cs @@ -72,7 +72,7 @@ private static LogValuesFormatter GetOrAddFormatter(string message, IReadOnlyCol return formatter; formatter = new LogValuesFormatter(message, args); -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER Formatters.AddOrUpdate(message, formatter); return formatter; #else diff --git a/src/Elastic.Apm/Logging/ScopedLogger.cs b/src/Elastic.Apm/Logging/ScopedLogger.cs index fd01dd417..ed49289f1 100644 --- a/src/Elastic.Apm/Logging/ScopedLogger.cs +++ b/src/Elastic.Apm/Logging/ScopedLogger.cs @@ -30,7 +30,7 @@ internal LogValuesFormatter GetOrAddFormatter(string message, IReadOnlyCollectio return formatter; formatter = new LogValuesFormatter($"{{{{{{Scope}}}}}} {message}", args, Scope); -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER Formatters.AddOrUpdate(message, formatter); return formatter; #else diff --git a/src/Elastic.Apm/Metrics/Linux/GlobalMemoryStatus.cs b/src/Elastic.Apm/Metrics/Linux/GlobalMemoryStatus.cs index 0cb69e84a..025a097c6 100644 --- a/src/Elastic.Apm/Metrics/Linux/GlobalMemoryStatus.cs +++ b/src/Elastic.Apm/Metrics/Linux/GlobalMemoryStatus.cs @@ -8,7 +8,7 @@ using System.Runtime.InteropServices; using Elastic.Apm.Logging; -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER using System.Buffers; using System.Buffers.Text; #endif @@ -19,7 +19,7 @@ internal static class GlobalMemoryStatus { public const string ProcMemInfo = "/proc/meminfo"; -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER private static readonly FileStreamOptions Options = new() { BufferSize = 0, Mode = FileMode.Open, Access = FileAccess.Read }; private static readonly byte Space = (byte)' '; @@ -57,7 +57,7 @@ internal static (long totalMemory, long availableMemory) GetTotalAndAvailableSys } try { -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER using var fs = new FileStream(memInfoPath, Options); var buffer = ArrayPool.Shared.Rent(8192); // Should easily be large enough for max meminfo file. diff --git a/src/Elastic.Apm/Metrics/MetricsProvider/CgroupMetricsProvider.cs b/src/Elastic.Apm/Metrics/MetricsProvider/CgroupMetricsProvider.cs index fad8b88d1..d1f64a488 100644 --- a/src/Elastic.Apm/Metrics/MetricsProvider/CgroupMetricsProvider.cs +++ b/src/Elastic.Apm/Metrics/MetricsProvider/CgroupMetricsProvider.cs @@ -12,7 +12,7 @@ using Elastic.Apm.Helpers; using Elastic.Apm.Logging; -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER using System.Buffers.Text; using System.Runtime.CompilerServices; using System.Text; @@ -46,7 +46,7 @@ internal class CgroupMetricsProvider : IMetricsProvider internal static readonly Regex Cgroup2MountPoint = new("^\\d+? \\d+? .+? .+? (.*?) .*cgroup2.*cgroup.*"); internal static readonly Regex MemoryCgroup = new("^\\d+:memory:.*"); -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER private static readonly FileStreamOptions Options = new() { BufferSize = 0, Mode = FileMode.Open, Access = FileAccess.Read }; #endif @@ -316,7 +316,7 @@ private MetricSample GetMemoryMemLimitBytes() return new MetricSample(SystemProcessCgroupMemoryMemLimitBytes, totalMemory); } -#if NET6_0_OR_GREATER // Optimised code for newer runtimes +#if NET8_0_OR_GREATER // Optimised code for newer runtimes return GetLongValueFromFile(_cGroupFiles.MaxMemoryFile, SystemProcessCgroupMemoryMemLimitBytes); #else using var reader = new StreamReader(_cGroupFiles.MaxMemoryFile); @@ -339,7 +339,7 @@ private MetricSample GetMemoryMemUsageBytes() { try { -#if NET6_0_OR_GREATER // Optimised code for newer runtimes +#if NET8_0_OR_GREATER // Optimised code for newer runtimes return GetLongValueFromFile(_cGroupFiles.UsedMemoryFile, SystemProcessCgroupMemoryMemUsageBytes); #else using var reader = new StreamReader(_cGroupFiles.UsedMemoryFile); @@ -356,7 +356,7 @@ private MetricSample GetMemoryMemUsageBytes() return null; } -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER [MethodImpl(MethodImplOptions.AggressiveInlining)] private MetricSample GetLongValueFromFile(string path, string sampleName) { diff --git a/src/Elastic.Apm/OpenTelemetry/ElasticActivityListener.cs b/src/Elastic.Apm/OpenTelemetry/ElasticActivityListener.cs index d045e8ceb..dca9db9c7 100644 --- a/src/Elastic.Apm/OpenTelemetry/ElasticActivityListener.cs +++ b/src/Elastic.Apm/OpenTelemetry/ElasticActivityListener.cs @@ -200,7 +200,7 @@ private void CreateSpanForActivity(Activity activity, long timestamp, List(response.Content.ReadAsStream()); #else var intakeResponse = _payloadItemSerializer.Deserialize(response.Content.ReadAsStreamAsync().GetAwaiter().GetResult()); diff --git a/src/azure/Elastic.Apm.Azure.ServiceBus/Elastic.Apm.Azure.ServiceBus.csproj b/src/azure/Elastic.Apm.Azure.ServiceBus/Elastic.Apm.Azure.ServiceBus.csproj index 391eebd8a..f703a4abc 100644 --- a/src/azure/Elastic.Apm.Azure.ServiceBus/Elastic.Apm.Azure.ServiceBus.csproj +++ b/src/azure/Elastic.Apm.Azure.ServiceBus/Elastic.Apm.Azure.ServiceBus.csproj @@ -1,7 +1,7 @@ - netstandard2.0; net6.0 + netstandard2.0;net8.0 Elastic.Apm.Azure.ServiceBus Elastic.Apm.Azure.ServiceBus Elastic.Apm.Azure.ServiceBus diff --git a/src/instrumentations/Elastic.Apm.EntityFrameworkCore/Elastic.Apm.EntityFrameworkCore.csproj b/src/instrumentations/Elastic.Apm.EntityFrameworkCore/Elastic.Apm.EntityFrameworkCore.csproj index cbedad1a4..46bf44606 100644 --- a/src/instrumentations/Elastic.Apm.EntityFrameworkCore/Elastic.Apm.EntityFrameworkCore.csproj +++ b/src/instrumentations/Elastic.Apm.EntityFrameworkCore/Elastic.Apm.EntityFrameworkCore.csproj @@ -1,6 +1,6 @@  - netstandard2.0;net6.0 + netstandard2.0;net8.0 Elastic.Apm.EntityFrameworkCore Elastic.Apm.EntityFrameworkCore Elastic.Apm.EntityFrameworkCore @@ -11,7 +11,7 @@ - + diff --git a/src/integrations/Elastic.Apm.AspNetCore/ApplicationBuilderExtensions.cs b/src/integrations/Elastic.Apm.AspNetCore/ApplicationBuilderExtensions.cs index 1efbfe841..3cc8e7465 100644 --- a/src/integrations/Elastic.Apm.AspNetCore/ApplicationBuilderExtensions.cs +++ b/src/integrations/Elastic.Apm.AspNetCore/ApplicationBuilderExtensions.cs @@ -93,7 +93,7 @@ params IDiagnosticsSubscriber[] subscribers } private static string GetEnvironmentName(this IServiceProvider serviceProvider) => -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER (serviceProvider.GetService(typeof(IWebHostEnvironment)) as IWebHostEnvironment)?.EnvironmentName; #else #pragma warning disable CS0246 diff --git a/src/integrations/Elastic.Apm.AspNetCore/Elastic.Apm.AspNetCore.csproj b/src/integrations/Elastic.Apm.AspNetCore/Elastic.Apm.AspNetCore.csproj index 245a1fe50..54566d7eb 100644 --- a/src/integrations/Elastic.Apm.AspNetCore/Elastic.Apm.AspNetCore.csproj +++ b/src/integrations/Elastic.Apm.AspNetCore/Elastic.Apm.AspNetCore.csproj @@ -5,7 +5,7 @@ Elastic.Apm.AspNetCore Elastic APM for ASP.NET Core. This package contains auto instrumentation for ASP.NET Core. See: https://github.com/elastic/apm-agent-dotnet/tree/main/docs apm, monitoring, elastic, elasticapm, analytics, aspnetcore - netstandard2.0;netstandard2.1;net6.0 + netstandard2.0;netstandard2.1;net8.0 true @@ -23,7 +23,7 @@ - + diff --git a/src/integrations/Elastic.Apm.Extensions.Hosting/CompositeLogger.cs b/src/integrations/Elastic.Apm.Extensions.Hosting/CompositeLogger.cs index efa3b5039..6c3bddee8 100644 --- a/src/integrations/Elastic.Apm.Extensions.Hosting/CompositeLogger.cs +++ b/src/integrations/Elastic.Apm.Extensions.Hosting/CompositeLogger.cs @@ -30,6 +30,4 @@ public void Log(LogLevel level, TState state, Exception e, Func ApmLogger.IsEnabled(logLevel) || TraceLogger.IsEnabled(logLevel); - - } diff --git a/src/integrations/Elastic.Apm.Extensions.Hosting/Elastic.Apm.Extensions.Hosting.csproj b/src/integrations/Elastic.Apm.Extensions.Hosting/Elastic.Apm.Extensions.Hosting.csproj index 96cd9a6e0..0a148d83f 100644 --- a/src/integrations/Elastic.Apm.Extensions.Hosting/Elastic.Apm.Extensions.Hosting.csproj +++ b/src/integrations/Elastic.Apm.Extensions.Hosting/Elastic.Apm.Extensions.Hosting.csproj @@ -4,22 +4,20 @@ Elastic.Apm.Extensions.Hosting Elastic APM .NET Agent. This package offers integration with Microsoft.Extensions.Hosting.IHostBuilder for agent registration apm, monitoring, elastic, elasticapm, analytics, netcore - netstandard2.0;net6.0 + netstandard2.0;net8.0 true - - - - - - - - - + + + + + + + @@ -29,11 +27,13 @@ - - - - - + + + + + + + diff --git a/src/integrations/Elastic.Apm.Extensions.Hosting/ServiceCollectionExtensions.cs b/src/integrations/Elastic.Apm.Extensions.Hosting/ServiceCollectionExtensions.cs index 2931fe1a3..afb85db01 100644 --- a/src/integrations/Elastic.Apm.Extensions.Hosting/ServiceCollectionExtensions.cs +++ b/src/integrations/Elastic.Apm.Extensions.Hosting/ServiceCollectionExtensions.cs @@ -106,7 +106,7 @@ public static IServiceCollection AddElasticApm(this IServiceCollection services, } private static string GetDefaultEnvironmentName(IServiceProvider serviceProvider) => -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER (serviceProvider.GetService(typeof(IHostEnvironment)) as IHostEnvironment)?.EnvironmentName; // This is preferred since 3.0 #else #pragma warning disable CS0246 diff --git a/src/integrations/Elastic.Apm.Extensions.Logging/Elastic.Apm.Extensions.Logging.csproj b/src/integrations/Elastic.Apm.Extensions.Logging/Elastic.Apm.Extensions.Logging.csproj index 88cd762a6..0c9255e35 100644 --- a/src/integrations/Elastic.Apm.Extensions.Logging/Elastic.Apm.Extensions.Logging.csproj +++ b/src/integrations/Elastic.Apm.Extensions.Logging/Elastic.Apm.Extensions.Logging.csproj @@ -1,7 +1,7 @@ - netstandard2.0;net6.0 + netstandard2.0;net8.0 Elastic.Apm.Extensions.Logging Elastic.Apm.Extensions.Logging Elastic.Apm.Extensions.Logging @@ -19,8 +19,8 @@ - - + + diff --git a/src/integrations/Elastic.Apm.NetCoreAll/Elastic.Apm.NetCoreAll.csproj b/src/integrations/Elastic.Apm.NetCoreAll/Elastic.Apm.NetCoreAll.csproj index 1d1ba10d2..583242880 100644 --- a/src/integrations/Elastic.Apm.NetCoreAll/Elastic.Apm.NetCoreAll.csproj +++ b/src/integrations/Elastic.Apm.NetCoreAll/Elastic.Apm.NetCoreAll.csproj @@ -1,6 +1,6 @@ - netstandard2.0;net6.0 + netstandard2.0;net8.0 Elastic.Apm.NetCoreAll Elastic.Apm.NetCoreAll Elastic APM .NET agent. This is a convenient package that automatically pulls in ASP.NET Core, and Entity Framework Core auto instrumentation with the Elastic APM .NET Agent. If your application uses the Microsoft.AspNetCore.All package the easiest way to reference the Elastic APM project is to use this package. If you only need specific functionalities (e.g. EF Core monitoring, or ASP.NET Core without EF Core monitoring, etc) you can reference specific Elastic.Apm packages. See: https://github.com/elastic/apm-agent-dotnet/tree/main/docs diff --git a/src/profiler/Elastic.Apm.Profiler.Managed.Core/Elastic.Apm.Profiler.Managed.Core.csproj b/src/profiler/Elastic.Apm.Profiler.Managed.Core/Elastic.Apm.Profiler.Managed.Core.csproj index cc9b62bf3..ac11a7546 100644 --- a/src/profiler/Elastic.Apm.Profiler.Managed.Core/Elastic.Apm.Profiler.Managed.Core.csproj +++ b/src/profiler/Elastic.Apm.Profiler.Managed.Core/Elastic.Apm.Profiler.Managed.Core.csproj @@ -1,7 +1,7 @@ - net462;netstandard2.0;net6.0 + net462;netstandard2.0;net8.0 false diff --git a/src/profiler/Elastic.Apm.Profiler.Managed/DuckTyping/DuckType.Statics.cs b/src/profiler/Elastic.Apm.Profiler.Managed/DuckTyping/DuckType.Statics.cs index e4c1ba5c2..06e95ca64 100644 --- a/src/profiler/Elastic.Apm.Profiler.Managed/DuckTyping/DuckType.Statics.cs +++ b/src/profiler/Elastic.Apm.Profiler.Managed/DuckTyping/DuckType.Statics.cs @@ -66,7 +66,7 @@ public static partial class DuckType private static Dictionary> _ignoresAccessChecksToAssembliesSetDictionary = new Dictionary>(); #pragma warning restore IDE0044, IDE1006 - + internal static long AssemblyCount => _assemblyCount; internal static long TypeCount => _typeCount; diff --git a/test/Elastic.Apm.Tests/LoggerTests.cs b/test/Elastic.Apm.Tests/LoggerTests.cs index 10a02acb4..1be429dd6 100644 --- a/test/Elastic.Apm.Tests/LoggerTests.cs +++ b/test/Elastic.Apm.Tests/LoggerTests.cs @@ -156,7 +156,7 @@ public void EnsureFormattersAreShared() var scopedLogger = consoleLogger.Scoped("MyTestScope"); for (var i = 0; i < 10; i++) scopedLogger.Warning()?.Log("This is a test log from the test StructuredLogTemplateWith1MissingArgument, args: {arg1}", i); -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER var cachedFormatterCount = scopedLogger.Formatters.Count(); cachedFormatterCount.Should().Be(1); diff --git a/test/azure/applications/Elastic.Apm.AzureFunctionApp.Core/Elastic.Apm.AzureFunctionApp.Core.csproj b/test/azure/applications/Elastic.Apm.AzureFunctionApp.Core/Elastic.Apm.AzureFunctionApp.Core.csproj index 7728c0570..5850f50c5 100644 --- a/test/azure/applications/Elastic.Apm.AzureFunctionApp.Core/Elastic.Apm.AzureFunctionApp.Core.csproj +++ b/test/azure/applications/Elastic.Apm.AzureFunctionApp.Core/Elastic.Apm.AzureFunctionApp.Core.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 enable enable false diff --git a/test/azure/applications/Elastic.AzureFunctionApp.InProcess/Elastic.AzureFunctionApp.InProcess.csproj b/test/azure/applications/Elastic.AzureFunctionApp.InProcess/Elastic.AzureFunctionApp.InProcess.csproj index 8bb50ce7e..54fda31ea 100644 --- a/test/azure/applications/Elastic.AzureFunctionApp.InProcess/Elastic.AzureFunctionApp.InProcess.csproj +++ b/test/azure/applications/Elastic.AzureFunctionApp.InProcess/Elastic.AzureFunctionApp.InProcess.csproj @@ -1,6 +1,6 @@ - net6.0 + net8.0 v4 Library enable diff --git a/test/azure/applications/Elastic.AzureFunctionApp.InProcess/local.settings.json b/test/azure/applications/Elastic.AzureFunctionApp.InProcess/local.settings.json index 320edb1e3..fd2cd88b4 100644 --- a/test/azure/applications/Elastic.AzureFunctionApp.InProcess/local.settings.json +++ b/test/azure/applications/Elastic.AzureFunctionApp.InProcess/local.settings.json @@ -5,7 +5,8 @@ "FUNCTIONS_WORKER_RUNTIME": "dotnet", "FUNCTIONS_EXTENSION_VERSION": "4", "WEBSITE_OWNER_NAME": "abcd1234-abcd-acdc-1234-112233445566+testfaas_group-CentralUSwebspace-Linux", - "WEBSITE_SITE_NAME": "testfaas" + "WEBSITE_SITE_NAME": "testfaas", + "FUNCTIONS_INPROC_NET8_ENABLED": "1" // Include this breaks on the latest version of func - Excluding it for now. //"WEBSITE_INSTANCE_ID": "20367ea8-70b9-41b4-a552-b2a826b3aa0b" }, diff --git a/test/integrations/Elastic.Apm.AspNetCore.Tests/AspNetCoreBasicTests.cs b/test/integrations/Elastic.Apm.AspNetCore.Tests/AspNetCoreBasicTests.cs index 10f38113d..137eeb935 100644 --- a/test/integrations/Elastic.Apm.AspNetCore.Tests/AspNetCoreBasicTests.cs +++ b/test/integrations/Elastic.Apm.AspNetCore.Tests/AspNetCoreBasicTests.cs @@ -89,9 +89,7 @@ public async Task HomeSimplePageTransactionTest() var aspNetCoreVersion = Assembly.Load("Microsoft.AspNetCore").GetName().Version.ToString(); agent.Service.Framework.Version.Should().Be(aspNetCoreVersion); -#if NET6_0 - agent.Service.Runtime.Name.Should().Be(Runtime.DotNetName + " 6"); -#elif NET8_0 +#if NET8_0 agent.Service.Runtime.Name.Should().Be(Runtime.DotNetName + " 8"); #else agent.Service.Runtime.Name.Should().Be(Runtime.DotNetCoreName); diff --git a/test/integrations/applications/SampleAspNetCoreApp/SampleAspNetCoreApp.csproj b/test/integrations/applications/SampleAspNetCoreApp/SampleAspNetCoreApp.csproj index 09e04e82c..758744247 100644 --- a/test/integrations/applications/SampleAspNetCoreApp/SampleAspNetCoreApp.csproj +++ b/test/integrations/applications/SampleAspNetCoreApp/SampleAspNetCoreApp.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 false AnyCPU @@ -16,14 +16,6 @@ - - - - - - - - diff --git a/test/integrations/applications/SampleConsoleNetCoreApp/SampleConsoleNetCoreApp.csproj b/test/integrations/applications/SampleConsoleNetCoreApp/SampleConsoleNetCoreApp.csproj index 2000ec119..cf1be170e 100644 --- a/test/integrations/applications/SampleConsoleNetCoreApp/SampleConsoleNetCoreApp.csproj +++ b/test/integrations/applications/SampleConsoleNetCoreApp/SampleConsoleNetCoreApp.csproj @@ -2,7 +2,7 @@ Exe - net6.0;net8.0 + net8.0 diff --git a/test/integrations/applications/WebApiSample/WebApiSample.csproj b/test/integrations/applications/WebApiSample/WebApiSample.csproj index 64c89df05..1c3b77682 100644 --- a/test/integrations/applications/WebApiSample/WebApiSample.csproj +++ b/test/integrations/applications/WebApiSample/WebApiSample.csproj @@ -1,7 +1,7 @@  - net6.0;net8.0 + net8.0 false diff --git a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/AdoNetTestData.cs b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/AdoNetTestData.cs index 01379b4ac..5da7a6574 100644 --- a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/AdoNetTestData.cs +++ b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/AdoNet/AdoNetTestData.cs @@ -20,7 +20,6 @@ public IEnumerator GetEnumerator() { // TODO: Add x64/x86 options. macOS and Linux do not support x86 yield return new object[] { "net8.0" }; - yield return new object[] { "net6.0" }; } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); diff --git a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/Continuations/ValueTaskContinuationGeneratorTests.cs b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/Continuations/ValueTaskContinuationGeneratorTests.cs index c49190903..69679eddf 100644 --- a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/Continuations/ValueTaskContinuationGeneratorTests.cs +++ b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/Continuations/ValueTaskContinuationGeneratorTests.cs @@ -7,7 +7,7 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. // -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER using System; using System.Threading; using System.Threading.Tasks; @@ -23,7 +23,7 @@ public static TReturn OnAsyncMethodEnd(TTarget instance, TRetu returnValue; [Fact] - public async ValueTask SuccessTest() + public async Task SuccessTest() { var tcg = new ValueTaskContinuationGenerator(); var cTask = tcg.SetContinuation(this, GetPreviousTask(), null, CallTargetState.GetDefault()); diff --git a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/DuckTyping/DuckIgnoreTests.cs b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/DuckTyping/DuckIgnoreTests.cs index 77ef2078f..621f9132a 100644 --- a/test/profiler/Elastic.Apm.Profiler.Managed.Tests/DuckTyping/DuckIgnoreTests.cs +++ b/test/profiler/Elastic.Apm.Profiler.Managed.Tests/DuckTyping/DuckIgnoreTests.cs @@ -25,7 +25,7 @@ public void NonPublicStructCopyTest() Assert.Equal(ValuesDuckType.Third.ToString(), ((IGetValue)copy).GetValueProp); } -#if NET6_0_OR_GREATER +#if NET8_0_OR_GREATER [Fact] public void NonPublicStructInterfaceProxyTest() { diff --git a/test/profiler/applications/Elastic.Apm.AdoNet/Elastic.Apm.AdoNet.csproj b/test/profiler/applications/Elastic.Apm.AdoNet/Elastic.Apm.AdoNet.csproj index cced4bb1e..9d1026735 100644 --- a/test/profiler/applications/Elastic.Apm.AdoNet/Elastic.Apm.AdoNet.csproj +++ b/test/profiler/applications/Elastic.Apm.AdoNet/Elastic.Apm.AdoNet.csproj @@ -1,7 +1,7 @@ - net462;net6.0;net8.0 + net462;net8.0 diff --git a/test/profiler/applications/MySqlDataSample/MySqlDataSample.csproj b/test/profiler/applications/MySqlDataSample/MySqlDataSample.csproj index 35ffd8a2f..8f69d0010 100644 --- a/test/profiler/applications/MySqlDataSample/MySqlDataSample.csproj +++ b/test/profiler/applications/MySqlDataSample/MySqlDataSample.csproj @@ -2,7 +2,7 @@ Exe - net462;net6.0;net8.0 + net462;net8.0 diff --git a/test/profiler/applications/NpgsqlSample/NpgsqlSample.csproj b/test/profiler/applications/NpgsqlSample/NpgsqlSample.csproj index 627143054..7b43bb7ac 100644 --- a/test/profiler/applications/NpgsqlSample/NpgsqlSample.csproj +++ b/test/profiler/applications/NpgsqlSample/NpgsqlSample.csproj @@ -3,7 +3,7 @@ 5.0.18 Exe - net462;net6.0;net8.0 + net462;net8.0 diff --git a/test/profiler/applications/OracleManagedDataAccessCoreSample/OracleManagedDataAccessCoreSample.csproj b/test/profiler/applications/OracleManagedDataAccessCoreSample/OracleManagedDataAccessCoreSample.csproj index e795de6d9..3d4993ad8 100644 --- a/test/profiler/applications/OracleManagedDataAccessCoreSample/OracleManagedDataAccessCoreSample.csproj +++ b/test/profiler/applications/OracleManagedDataAccessCoreSample/OracleManagedDataAccessCoreSample.csproj @@ -2,7 +2,7 @@ Exe - net6.0;net8.0 + net8.0 diff --git a/test/profiler/applications/SqlClientSample/SqlClientSample.csproj b/test/profiler/applications/SqlClientSample/SqlClientSample.csproj index 72841a793..0de2ff849 100644 --- a/test/profiler/applications/SqlClientSample/SqlClientSample.csproj +++ b/test/profiler/applications/SqlClientSample/SqlClientSample.csproj @@ -3,7 +3,7 @@ 4.8.6 Exe - net462;net6.0;net8.0 + net462;net8.0 diff --git a/test/profiler/applications/SqliteSample/SqliteSample.csproj b/test/profiler/applications/SqliteSample/SqliteSample.csproj index 1169e0dde..2fed60f08 100644 --- a/test/profiler/applications/SqliteSample/SqliteSample.csproj +++ b/test/profiler/applications/SqliteSample/SqliteSample.csproj @@ -3,7 +3,7 @@ 8.0.2 Exe - net462;net6.0;net8.0 + net462;net8.0 x64 diff --git a/test/startuphook/Elastic.Apm.StartupHook.Sample/Elastic.Apm.StartupHook.Sample.csproj b/test/startuphook/Elastic.Apm.StartupHook.Sample/Elastic.Apm.StartupHook.Sample.csproj index b7bbc052d..ccd7e8ece 100644 --- a/test/startuphook/Elastic.Apm.StartupHook.Sample/Elastic.Apm.StartupHook.Sample.csproj +++ b/test/startuphook/Elastic.Apm.StartupHook.Sample/Elastic.Apm.StartupHook.Sample.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 false diff --git a/test/startuphook/Elastic.Apm.StartupHook.Tests/StartupHookTests.cs b/test/startuphook/Elastic.Apm.StartupHook.Tests/StartupHookTests.cs index 4b2c2b733..4e0b2fe62 100644 --- a/test/startuphook/Elastic.Apm.StartupHook.Tests/StartupHookTests.cs +++ b/test/startuphook/Elastic.Apm.StartupHook.Tests/StartupHookTests.cs @@ -27,7 +27,6 @@ public class StartupHookTests // NOTE: We test the two latest supported LTS releases. private static IEnumerable<(string TargetFramework, string RuntimeName, string Version, string ShortVersion)> GetDotNetFrameworkVersionInfos() { - yield return ("net6.0", ".NET 6", "6.0.0.0", "60"); yield return ("net8.0", ".NET 8", "8.0.0.0", "80"); }