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

FileNotFoundException for Microsoft.SqlServer.Types 10.0.0.0 when trying to use SQL Server geography data #75481

Closed
nyctef opened this issue Mar 8, 2018 · 4 comments

Comments

@nyctef
Copy link

nyctef commented Mar 8, 2018

Hopefully this is the right place to post this-

We've been hitting an issue using System.Data.SqlClient through a netstandard2.0 project where Microsoft.SqlServer.Types 10.0.0.0 will fail to load when trying to fetch geography data from SQL Server. I think we can work around this problem by getting the dll from nuget, but since the nuget package only has a net40 version, this means the project we're installing the nuget package into can't be netstandard2.0 any more.

I've created an example repo here: https://github.com/nyctef/geography-repro to try and demonstrate the problem - it should crash on machines were Microsoft.SqlServer.Types 10.0.0.0 isn't in the GAC already.

@stakx
Copy link
Contributor

stakx commented May 1, 2018

IMHO, Microsoft.SqlServer.Types has always been a bit problematic. Even the .NET Framework BCL contains a hidden reference to this external assembly (in System.Data.Entity), which may or may not actually be available at runtime.

That has always felt like a hack to me. It appears to me that Microsoft couldn't quite figure out how to have an OGC-compliant DbSpatialServices for SqlClient in the FCL without actually making the Microsoft.SqlServer.Types assemblies part of the FCL. (This would bring an additional product-specific native DLL into the framework since the OGC methods have been implemented in C++, probably for performance reasons.) I guess the only way to really solve this would be to add SqlGeometry and SqlGeography to System.Data.SqlTypes, including the OGC method implementations tied to them.

Since that probably won't happen anytime soon (just my guess), I could imagine that you'll have to resort in your .NET Standard project to a strategy similar to what System.Data.Entity does; that is, try to load the Microsoft.SqlServer.Types at runtime using reflection. I have no idea how you would cleanly model (using the type system) that run-time dependency.

@wtgodbe wtgodbe added this to the Future milestone May 30, 2019
@terrajobst
Copy link
Contributor

Transferring to dotnet/runtime as this seems to be an issue with the System.Data.SqlClient NuGet package, not .NET Standard.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Sep 12, 2022
@terrajobst terrajobst transferred this issue from dotnet/standard Sep 12, 2022
@ghost
Copy link

ghost commented Sep 12, 2022

Tagging subscribers to this area: @cheenamalhotra, @David-Engel
See info in area-owners.md if you want to be subscribed.

Issue Details

Hopefully this is the right place to post this-

We've been hitting an issue using System.Data.SqlClient through a netstandard2.0 project where Microsoft.SqlServer.Types 10.0.0.0 will fail to load when trying to fetch geography data from SQL Server. I think we can work around this problem by getting the dll from nuget, but since the nuget package only has a net40 version, this means the project we're installing the nuget package into can't be netstandard2.0 any more.

I've created an example repo here: https://github.com/nyctef/geography-repro to try and demonstrate the problem - it should crash on machines were Microsoft.SqlServer.Types 10.0.0.0 isn't in the GAC already.

Author: nyctef
Assignees: -
Labels:

area-System.Data.SqlClient

Milestone: Future

@David-Engel
Copy link
Contributor

System.Data.SqlClient is unlikely to ever see support for that Microsoft.SqlServer.Types package. System.Data.SqlClient is in strict maintenance mode and not receiving anything other than critical security and bug fixes. Migrate to Microsoft.Data.SqlClient for the latest features and support.

We have an issue in the SqlClient repo to track the status of spatial support: dotnet/SqlClient#30

Regards,
David

@David-Engel David-Engel removed the untriaged New issue has not been triaged by the area owner label Sep 12, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants