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

Build conflict with SqlDbType #144

Closed
ajcvickers opened this issue Jul 31, 2019 · 11 comments
Closed

Build conflict with SqlDbType #144

ajcvickers opened this issue Jul 31, 2019 · 11 comments
Labels
🔗 External Issue is in an external component

Comments

@ajcvickers
Copy link
Member

A thread was started on an old EF Core issue that evolved into something which may be an issue with M.D.SqlClient, or should probably at least be investigated.

See dotnet/efcore#7820

Snippet of build output:

1>Build FAILED.
1>
1>TVPBuilder.cs(48,29,48,38): error CS0433: The type 'SqlDbType' exists in both 'System.Data.Common, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1>Program.cs(13,92,13,101): error CS0433: The type 'SqlDbType' exists in both 'System.Data.Common, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1>    0 Warning(s)
1>    2 Error(s)
1>
1>Time Elapsed 00:00:00.38

@slubowsky reported the issue, and @ErikEJ (one of our top contributors) has been able to reproduce it. I'm sure they will be wiling to help as needed if you need more information.

/cc @David-Engel @vickyharp @divega

@Wraith2
Copy link
Contributor

Wraith2 commented Aug 1, 2019

Looking at the locations for that type at https://apisof.net/catalog/System.Data.SqlDbType the only time it was present in S.D.SqlClient is the netstandard1.6+platform extensions. It shouldn't be present in any M.D.SqlClient builds as far as i can see. The answer might be to ensure that the project targets netstandard 2.0 or later and if it still preroduces the dependency resolution steps need to be checked.

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 1, 2019

@Wraith2 have a look at my repro csproj!

Looks like it is AppInsights package that pulls the dependency from a very old s.d.sqlclient

@Wraith2
Copy link
Contributor

Wraith2 commented Aug 1, 2019

It might be worth doing a build and then pulling the version of S.D.SqlClient that you find in the bin folder into a disassembler to see if it's a version that contains the type in question. If it is then in theory adding an explicit dependency to the latest version of S.D.SqlClient should force upgrade it. Dependency shenanigans can get messy though.

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 1, 2019

@Wraith2 How would I do a build ? - this issue prevents building

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 1, 2019

image

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 1, 2019

@Wraith2
Copy link
Contributor

Wraith2 commented Aug 1, 2019

@Wraith2 How would I do a build ? - this issue prevents building

Oh yeah... oops.

Directly adding a reference to the latest (or later) S.D.SqlClient should cause the later version to be used instead of that transative one though. Without binding redirects i'm not sure what you'd have to do to resolve this i'm afraid.

@David-Engel David-Engel added the 🔗 External Issue is in an external component label Aug 1, 2019
@David-Engel
Copy link
Contributor

I think Wraith2's suggestion may work around it (add a newer reference yourself). But you probably need to file an issue in the Application Insights server repo and ask them to update the version they depend on since that old System.Data.SqlClient version is where the issue lies:
https://github.com/microsoft/ApplicationInsights-dotnet-server/issues

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 1, 2019

Confirmed that adding a newer reference fixes the issue:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Data.SqlClient" Version="1.0.19189.1-Preview" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.8.0-beta1" />
    <PackageReference Include="System.Data.SqlClient" Version="4.6.1" />
  </ItemGroup>

</Project>

@ErikEJ
Copy link
Contributor

ErikEJ commented Aug 1, 2019

@cheenamalhotra
Copy link
Member

Closing issue here as issue identified with external library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔗 External Issue is in an external component
Projects
None yet
Development

No branches or pull requests

5 participants