Skip to content

GetSqlJson method missing from refs assembly #3135

@MaceWindu

Description

@MaceWindu

Describe the bug

I'm testing new SqlJson functionality with SqlClient 6.0.1 and have strange issue with discoverability of GetSqlJson method on data reader

using var rd = cmd.ExecuteReader();
while (rd.Read())
{
        // CS1061: 'SqlDataReader' does not contain a definition for 'GetSqlJson' and no accessible extension method 'GetSqlJson' accepting a first argument of type 'SqlDataReader' could be found (are you missing a using directive or an assembly reference?)
	var value12 = rd.GetSqlJson(1);
        // even added assert to ensure it's expected type
	if (rd.GetType() == typeof(SqlDataReader))
	{
                // this works
		var value11 = ((dynamic)rd).GetSqlJson(1);
	}
}

To reproduce

Create new console project, add nuget reference <PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" /> and try to access GetSqlJson method on SqlDataReader instance

SqlDataReader rd = default!;
rd.GetSqlJson(0);

Expected behavior

Code compiles

Further technical details

Microsoft.Data.SqlClient version: nuget v6.0.1
.NET target: (e.g. .NET Framework 4.7.2, .NET 6.0): net462, net8.0, net9.0 (tried all 3)
SQL Server version: Azure Database
Operating system: Win10

VS info

Microsoft Visual Studio Enterprise 2022
Version 17.12.4
VisualStudio.17.Release/17.12.4+35707.178
Microsoft .NET Framework
Version 4.8.09037

Installed Version: Enterprise

C# Tools   4.12.0-3.24631.1+da7c6c4257b2f661024b9a506773372a09023eee
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Metadata

Metadata

Labels

Hotfix Candidate 🚑Issues/PRs that are candidate for backporting to earlier supported versions.Triage Done ✔️Issues that are triaged by dev team and are in investigation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions