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

What runtimes is SqlClientDiagnosticListener supported on? #1529

Closed
SimonCropp opened this issue Mar 2, 2022 · 8 comments
Closed

What runtimes is SqlClientDiagnosticListener supported on? #1529

SimonCropp opened this issue Mar 2, 2022 · 8 comments

Comments

@SimonCropp
Copy link
Contributor

SimonCropp commented Mar 2, 2022

When using a DiagnosticListener.AllListeners to subscribe to a SqlClientDiagnosticListener it does not work for net48.

Here is a runnable repo (only on windows since it is using localdb): https://github.com/SimonCropp/SqlClientDiagnosticListenerExperiments/

In the test Subscriber.OnNext is not called on net48.

Is this expected? if so where is it documented?

this is in the context of the Microsoft.Data.SqlClient nuget

@SimonCropp
Copy link
Contributor Author

i decompiled all the microsoft.data.sqlclient.dll net461, netcoreapp3.1, netstandard2.0,
netstandard2.1. the SqlClientDiagnosticListener code does not exist in net461.

Looking at the csproj, it seems listener code is only included in netcoreapp and netstandard?

https://github.com/dotnet/SqlClient/blob/main/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj#L462-L469

 <ItemGroup Condition="'$(OSGroup)' != 'AnyOS' AND '$(TargetGroup)' == 'netstandard'">
    <Compile Include="Microsoft\Data\SqlClient\SqlAuthenticationProviderManager.NetStandard.cs" />
    <Compile Include="Microsoft\Data\SqlClient\SqlDiagnosticListener.NetStandard.cs" />
    <Compile Include="Microsoft\Data\SqlClient\SqlDelegatedTransaction.NetStandard.cs" />
    <Compile Include="Microsoft\Data\SqlClient\TdsParser.NetStandard.cs" />
    <Compile Include="Microsoft\Data\SqlClient\SNI\SNIStreams.Task.cs" />    
    <Compile Include="Microsoft\Data\SqlClient\SNI\SslOverTdsStream.NetStandard.cs" />
  </ItemGroup>

https://github.com/dotnet/SqlClient/blob/main/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj#L508-L518

  <ItemGroup Condition="'$(OSGroup)' != 'AnyOS' AND '$(TargetGroup)' == 'netcoreapp'">
    <Compile Include="Microsoft\Data\ProviderBase\DbConnectionPool.NetCoreApp.cs" />
    <Compile Include="Microsoft\Data\SqlClient\SqlAuthenticationProviderManager.NetCoreApp.cs" />
    <Compile Include="Microsoft\Data\SqlClient\SqlDiagnosticListener.NetCoreApp.cs" />
    <Compile Include="Microsoft\Data\SqlClient\SqlDelegatedTransaction.NetCoreApp.cs" />
    <Compile Include="Microsoft\Data\SqlClient\TdsParser.NetCoreApp.cs" />
    <Compile Include="Microsoft\Data\SqlClient\SNI\SslOverTdsStream.NetCoreApp.cs" />
    <Compile Include="Microsoft\Data\SqlClient\SqlConnectionFactory.AssemblyLoadContext.cs" />    
    <Compile Include="Microsoft\Data\SqlClient\SqlDependencyUtils.AssemblyLoadContext.cs" />
    <Compile Include="Microsoft\Data\SqlClient\SNI\SNIStreams.ValueTask.cs" />
  </ItemGroup>

@JRahnama
Copy link
Contributor

JRahnama commented Mar 3, 2022

@SimonCropp I am looking into this and will update you soon.

@SimonCropp
Copy link
Contributor Author

@JRahnama thanks. please let me know if u need more help

@JRahnama
Copy link
Contributor

JRahnama commented Mar 3, 2022

@SimonCropp according to documentation diagnostic listener is only available in netcore and not .Net framework that is why we did not add it to netfx and just for netcore.

@SimonCropp
Copy link
Contributor Author

@JRahnama thats weird given the net461 of https://www.nuget.org/packages/System.Diagnostics.DiagnosticSource/ has DiagnosticListener.AllListeners.Subscribe(...);. u can see that it compiles and runs in my repro on net48. I can even debug into it and see a System.Net.Http.Desktop listener come through

image

@JRahnama
Copy link
Contributor

JRahnama commented Mar 4, 2022

@SimonCropp we are talking internally to see if that is supported on netfx and is not added for netstandard support, Either documentation or nuget needs to be fixed. Meantime we do not support DiagnosticSource on .Net Framework at the moment.

@JRahnama
Copy link
Contributor

JRahnama commented Mar 9, 2022

Closing the issue as adding DiagnosticSource to SqlClient netfx is not on the current plan.

@JRahnama JRahnama closed this as completed Mar 9, 2022
@SimonCropp
Copy link
Contributor Author

@JRahnama thanks for the clarrification

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

No branches or pull requests

2 participants