Skip to content

Add netstandard2.1 target and update DiagnosticSource dependency#2679

Merged
stevejgordon merged 9 commits into
mainfrom
2657-netstandard
Oct 21, 2025
Merged

Add netstandard2.1 target and update DiagnosticSource dependency#2679
stevejgordon merged 9 commits into
mainfrom
2657-netstandard

Conversation

@stevejgordon
Copy link
Copy Markdown
Contributor

@stevejgordon stevejgordon commented Oct 6, 2025

Fixes #2657
Fixes #2445

This adds a netstandard2.1 target so that features such as OTel bridge are available on older runtimes, even though those are out of support. This prevents an update of our package, without a runtime update, breaking/removing features. Features may still not be 100% compatible with older unsupported runtimes, but should work in general.

As part of this, I updated the minimum dependency for System.Diagnostics.DiagnosticSource which is no generally 8.0.0. We still ship a version of Elastic.Apm and loader for the Startup hooks zip file which are built against 6.0.0. These support older unsupported runtimes although with no official testing.

NOTE: We DOT NOT update System.Diagnostics.DiagnosticSource on net462 and net472. While this worked and tested fine in local dev, it fails the IIS tests in CI. For now, we leave the version in these targets unchanged from 5.0.0. This is likely fine as we do not depend on any newer APIs in those targets.

Compiler pre-processor directives now prefer NET over a specific .NET version. We also add NETSTANDARD2_1 so that features continue to work on older runtimes without a specific .NET target, i.e. 6 and 7.

Docs PR to follow.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 6, 2025

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 6, 2025

🔍 Preview links for changed docs

@stevejgordon
Copy link
Copy Markdown
Contributor Author

I updated to the .NET 9 SDK and that I suspect is triggering the new formatting warnings, but I'm not entirely sure why. Will work on resolving those.

@stevejgordon stevejgordon force-pushed the 2657-netstandard branch 2 times, most recently from 8d5b054 to 5ddfaca Compare October 6, 2025 15:39
Comment thread src/Elastic.Apm/OpenTelemetry/ElasticActivityListener.cs
Comment thread src/Elastic.Apm/OpenTelemetry/ElasticActivityListener.cs Outdated
Comment thread src/Elastic.Apm/OpenTelemetry/ElasticActivityListener.cs
Comment thread src/Elastic.Apm/OpenTelemetry/ElasticActivityListener.cs
Comment thread src/Elastic.Apm/OpenTelemetry/ElasticActivityListener.cs Outdated
@stevejgordon stevejgordon reopened this Oct 7, 2025
@stevejgordon
Copy link
Copy Markdown
Contributor Author

Working on the test failures. The IIS ones suggest we might still have to ship an older DiagnosticsSource build too, although I need to investigate why exactly based on our packaging process.

@stevejgordon stevejgordon force-pushed the 2657-netstandard branch 7 times, most recently from 067043d to b99f3da Compare October 10, 2025 13:44
@stevejgordon stevejgordon force-pushed the 2657-netstandard branch 2 times, most recently from e8607fd to c9b0b45 Compare October 15, 2025 10:59
Copy link
Copy Markdown
Contributor

@JeremyBessonElastic JeremyBessonElastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/startuphook/ElasticApmAgentStartupHook/StartupHook.cs
Comment thread src/startuphook/ElasticApmAgentStartupHook/StartupHook.cs
Comment thread src/startuphook/ElasticApmAgentStartupHook/StartupHook.cs
Comment thread src/startuphook/ElasticApmAgentStartupHook/StartupHook.cs
@stevejgordon stevejgordon merged commit 1738583 into main Oct 21, 2025
25 of 26 checks passed
@stevejgordon stevejgordon deleted the 2657-netstandard branch October 21, 2025 12:18
stevejgordon added a commit that referenced this pull request Nov 26, 2025
**NOTE: To be merged after code from #2679** is released.

This updates to align with the versions we use and support after the
`DiagnosticSource` changes in #2679.

This also fixes the version numbers for .NET that we reference, ensuring
we don't mention unsupported runtimes.

This also add more explicit supported version ranges based on the
currently supported versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants