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

[SqlClient] Broken on .NET Framework? #1739

Closed
CodeBlanch opened this issue Nov 14, 2022 · 17 comments
Closed

[SqlClient] Broken on .NET Framework? #1739

CodeBlanch opened this issue Nov 14, 2022 · 17 comments
Labels
bug Something isn't working comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient

Comments

@CodeBlanch
Copy link
Member

I noticed working on open-telemetry/opentelemetry-dotnet#3900 that the .NET Framework integration test is failing.

On .NET Framework Sql instrumentation listens to SqlEventSource which uses keywords.

When SqlCommands are executing the EventSource code is writing this error instead of behaving normally (firing BeginExecute \ EndExecute):

ERROR: Exception in Command Processing for EventSource Microsoft-AdoNet-SystemData: Use of undefined keyword value 0x1 for event BeginExecute.

Working with @tarekgh it seems the nested public static class Keywords is not present in the final code. We suspect some kind of trimming issue. Waiting to hear back from some other folks.

Not sure when this started. We don't run the .NET Framework integration tests in our CI. But as far as I can tell, instrumentation is broken on .NET Framework. Could be only certain versions or OSes are impacted. I'm running 4.8.09032 on Windows 11.

@CodeBlanch CodeBlanch added the bug Something isn't working label Nov 14, 2022
@RassK
Copy link
Contributor

RassK commented Nov 16, 2022

Just discovered the same issue.

Windows 11 Pro (22621.819), .NET 4.8.1 (533320)

Quick test app
SqlClientTests.zip

Running dependencies (SQL Server on Linux Docker container)
docker run -p 1433:1433 -e SA_PASSWORD=Passw0rd -e ACCEPT_EULA=Y --name sql-server-1433 mcr.microsoft.com/mssql/server:2019-CU17-ubuntu-20.04

@CodeBlanch
Copy link
Member Author

Update for anyone interested: It looks like this broke with the release of .NET 4.8.1. It should work in all prior versions but I haven't had a chance to verify yet.

@pellared
Copy link
Member

@CodeBlanch Is this bug reported so that it will be eventually fixed in .NET 4.8.1 patch release? Is there any issue that we can track?

@tarekgh
Copy link

tarekgh commented Nov 23, 2022

@pellared we are currently what is the best action to take here. We'll update you when we have more news. it is kind slow these days because of the holidays :-)

CC @ajcvickers

@ajcvickers
Copy link

Note that regardless of the holidays, getting a change into .NET Framework is a long process. Expect months.

@pellared
Copy link
Member

pellared commented Feb 9, 2023

The issue was also reported here: open-telemetry/opentelemetry-dotnet-instrumentation#2177

@Kronos11
Copy link

Kronos11 commented Feb 9, 2023

Just a note, but this is a pretty major blocker for us being able to adopt OTel within our large enterprise application. I hope it can be prioritized as such.

@cijothomas
Copy link
Member

This was originally assumed to be broken only on .NET FW 4.8.1, but it looks like even Net462 is broken?

@tarekgh
Copy link

tarekgh commented Feb 9, 2023

This was originally assumed to be broken only on .NET FW 4.8.1, but open-telemetry/opentelemetry-dotnet-instrumentation#2177 (comment) even Net462 is broken?

Note, the .NET Framework installs one version on the machine which supports multiple targets. So, most likely the installed version is 4.8 and the app is just targeting 4.6.2.

@dave-at-bits
Copy link

Has anyone been able to find a workaround for this? It's odd because this issue is only happening to my machine on our team. I went so far as to reformat and still encounter the issue. But I suspect that's just due to the fact that I had the latest version of .Net both times.

@tarekgh
Copy link

tarekgh commented Apr 25, 2023

@ajcvickers you were the one looking at fixing this issue. Is there any update here?

@luizfbicalho
Copy link

So, if I have a .net framework webapp it doesn't generate the Trace for the sql client connections, is that?

@luizfbicalho
Copy link

luizfbicalho commented Jul 28, 2023

Is this a case to use @ErikEJ Entity Framework 6 SQL Server provider based on Microsoft.Data.SqlClient?

https://github.com/ErikEJ/EntityFramework6PowerTools

UPDATE
I added this project and now the trace is correct

@josephedwardchang
Copy link

Just discovered the same issue.

Windows 11 Pro (22621.819), .NET 4.8.1 (533320)

Quick test app SqlClientTests.zip

Running dependencies (SQL Server on Linux Docker container) docker run -p 1433:1433 -e SA_PASSWORD=Passw0rd -e ACCEPT_EULA=Y --name sql-server-1433 mcr.microsoft.com/mssql/server:2019-CU17-ubuntu-20.04

i've also run into this issue generating Entity Framework storedproc and the call to ExecuteFunction <T> has this error on VS2019 but not in VS2022 (both updated latest). i'm using Win10 Pro 22H2 latest updates and .Net 4.8.1. I'm using separate folders on a single project: one in VS2019 and another exact same copy in VS2022. Since it is working on VS2022 i'll continue to use that instead of waiting for a fix on VS2019.

@CodeBlanch
Copy link
Member Author

Update: The .NET Framework team is working on a fix and it should be available in the next month or two. I'll post more details when we have a more concrete date.

@CodeBlanch
Copy link
Member Author

Happy to report that this will be fixed in the next .NET Framework Cumulative Update: https://devblogs.microsoft.com/dotnet/dotnet-framework-september-2023-cumulative-update-preview/#sqlclient

@pellared
Copy link
Member

@CodeBlanch, I think we can close this bug.

I tested it here: open-telemetry/opentelemetry-dotnet-instrumentation#3412

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient
Projects
None yet
Development

No branches or pull requests