microsoft / microsoft/sqlmanagementobjects

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

Open
#163 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
143
Forks
28
PR merge metrics
No merged PRs in 30d

Description

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: https://github.com/dotnet/SqlClient/issues/1930

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the tests project and its Microsoft.SqlServer.SqlManagementObjects dependency. Reproduce the net8.0 test startup failure with Microsoft.Data.SqlClient 5.1.4, then verify that using version 5.2.0 allows the tests to load successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.