opentelemetry-dotnet: [SqlClient] Broken on .NET Framework?

I noticed working on #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.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 5
  • Comments: 16 (9 by maintainers)

Most upvoted comments

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

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.

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.

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