Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

net8.0 + Microsoft.Data.SqlClient <5.2.0 incompatibility #163

Open
scp-mb opened this issue May 1, 2024 · 1 comment
Open

net8.0 + Microsoft.Data.SqlClient <5.2.0 incompatibility #163

scp-mb opened this issue May 1, 2024 · 1 comment

Comments

@scp-mb
Copy link

scp-mb commented May 1, 2024

Microsoft.SqlServer.SqlManagementObjects 171.30.0 depends on Microsoft.Data.SqlClient 5.1.4. Upgrading a tests project from net6.0 to net8.0 produces the following exception

OneTimeSetUp: System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types. Could not load type 'SqlGuidCaster' from assembly 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5' because it contains an object field at offset 0 that is incorrectly aligned or overlapped by a non-object field. ----> System.TypeLoadException : Could not load type 'SqlGuidCaster' from assembly 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5' because it contains an object field at offset 0 that is incorrectly aligned or overlapped by a non-object field.

Upgrading to Microsoft.Data.SqlClient 5.2.0 fixes the issue, as documented here: dotnet/SqlClient#1930

@shueybubbles
Copy link
Collaborator

thx for opening an issue. We move pretty slowly on SMO dependency updates but it should be fine for apps to use 5.2 if it solves their problems.
Note that it introduces another problem per #162

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants