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

Npgsql dependency #297

Closed
DAbraham2 opened this issue Oct 12, 2022 · 1 comment · Fixed by #298
Closed

Npgsql dependency #297

DAbraham2 opened this issue Oct 12, 2022 · 1 comment · Fixed by #298
Labels
status: oncall Flagged for awareness from Honeycomb Telemetry Oncall type: bug Something isn't working

Comments

@DAbraham2
Copy link

Hello All!

First of all, I love your commitment to OpenTelemetry and that your lib is finally open.

Recently, I was developing an ASP.NET app with Npgsql as the EntityFramework provider.
But seconds after I have pulled the AutoInstrumentations nuget, I have found out that my databases were not working as intended.

Migrations were failing all over the place and couldn't even start the application.

Anyway, after 4 coffees and 2 mental-brakedowns I have found out that AutoInstrumentations is depending on Npgsql.OpenTelemetry 7.0.0-rc.1.
With using Npgsql.EntityFramework 6.0.7 - that depending on Npgsql 6.0.7 - , it got a bit tangled up and caused EF not to communicate with the DB.

I know both (AutoInstrumentations and Npgsql) is just prerelease, but it would be wonderful if I didn't have to upgrade other used dependencies to preview versions as well.

I have no clue what is the evident difference in Npgsql versions but removing the AutoInstrumentations dependency and installing Npgsql.OpenTelemetry 6.0.7 solved the problems for me.

Versions

  • .NET runtime & version (eg .NET Core, .NET Framework): .NET6.0
  • Honeycomb OpenTelemetry Distribution: Honeycomb.OpenTelemetry.AutoInstrumentations 0.24.0-beta
  • Pgsql.EntityFrameworkCore.PostgreSQL 6.0.7

Steps to reproduce

  1. dotnet new WebApp
  2. Create DbContext
  3. dotnet add {project} package Npgsql.EntityFrameworkCore.PostgreSQL -v 6.0.7
  4. dotnet add {project} package "Honeycomb.OpenTelemetry" -v 1.0.0
  5. dotnet add {project} package Honeycomb.OpenTelemetry.AutoInstrumentations --prerelease
  6. use .AddAutoInstrument();
  7. dotnet ef migrations add Abc -c DbContext

Additional context
Following that dotnet ef command will fail due to a MethodAccessException caused in npgsql.npgsqlconnection.get_settings()

@DAbraham2 DAbraham2 added the type: bug Something isn't working label Oct 12, 2022
@vreynolds vreynolds added the status: oncall Flagged for awareness from Honeycomb Telemetry Oncall label Oct 12, 2022
@cartermp
Copy link
Member

Ouch, good find.

installing Npgsql.OpenTelemetry 6.0.7

Yep, that seems like it's probably the appropriate fix, at least until .NET 7 is fully released.

I have no clue what is the evident difference in Npgsql versions but removing the AutoInstrumentations dependency and installing Npgsql.OpenTelemetry 6.0.7 solved the problems for me.

I don't know either, but I will say that having worked on .NET as well, EF has always been a little special, and more-or-less intrinsically tied to the runtime rather than just being some package (or set of packages) you can pull in freely like most .NET packages. This is just some carelessness on my part here in pulling it in without validating which major version family we should be using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: oncall Flagged for awareness from Honeycomb Telemetry Oncall type: bug Something isn't working
Projects
None yet
3 participants