Skip to content

fix: exclude SentrySqlListener from .NET Framework builds#5236

Draft
jamescrosswell wants to merge 1 commit into
mainfrom
issue-3173-sql-listener-netfx
Draft

fix: exclude SentrySqlListener from .NET Framework builds#5236
jamescrosswell wants to merge 1 commit into
mainfrom
issue-3173-sql-listener-netfx

Conversation

@jamescrosswell
Copy link
Copy Markdown
Collaborator

Summary

SqlClient's DiagnosticSource-based events are not delivered on .NET Framework (see dotnet/SqlClient#1529), so including SentrySqlListener in the net462 package is misleading — it compiles and registers but silently does nothing.

  • Wrapped SentrySqlListener entirely in #if !NETFRAMEWORK
  • Guarded the SQL listener field, lazy initializer, and SqlClientDiagnosticListener subscription in SentryDiagnosticSubscriber with the same guard
  • Excluded SentrySqlListenerExtensions and SentrySqlListenerTests from .NET Framework test builds

All existing tests pass unchanged on net9.0.

#skip-changelog

Closes #3173

SqlClient's DiagnosticSource integration does not work on .NET Framework
(see dotnet/SqlClient#1529), so compiling SentrySqlListener into the
net462 target was misleading. Wrap it and its subscriber wiring with
#if !NETFRAMEWORK guards.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.13%. Comparing base (a9cb3b2) to head (88c104a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5236      +/-   ##
==========================================
+ Coverage   74.12%   74.13%   +0.01%     
==========================================
  Files         508      508              
  Lines       18282    18282              
  Branches     3574     3574              
==========================================
+ Hits        13551    13553       +2     
+ Misses       3861     3860       -1     
+ Partials      870      869       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SqlListener should not be compiled/available in NetFX

1 participant