Skip to content

Extension not decompiling nuget packages right SqlCommand & SqlReader #6394

Open
@sant123

Description

@sant123

Environment data

dotnet --info output:

.NET SDK:
 Version:   7.0.110
 Commit:    ba920f88ac

Runtime Environment:
 OS Name:     fedora
 OS Version:  38
 OS Platform: Linux
 RID:         fedora.38-x64
 Base Path:   /usr/lib64/dotnet/sdk/7.0.110/

Host:
  Version:      7.0.10
  Architecture: x64
  Commit:       a6dbb800a4

.NET SDKs installed:
  7.0.110 [/usr/lib64/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.10 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.10 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/lib64/dotnet]

global.json file:
  Not found

VS Code version: 1.82.2
C# Extension version: v2.1.2

Steps to reproduce

  1. Install this package https://www.nuget.org/packages/Microsoft.Data.SqlClient/5.1.1
  2. Write this code
using Microsoft.Data.SqlClient;

var builder = new SqlConnectionStringBuilder
{
    DataSource = "localhost",
    UserID = "sa",
    Password = "",
    InitialCatalog = ""
};

try
{
    using var connection = new SqlConnection(builder.ConnectionString);

    Console.WriteLine("\nQuery data example:");
    Console.WriteLine("=========================================\n");

    connection.Open();

    var sql = "SELECT name, age FROM People";

    using var command = new SqlCommand(sql, connection);
    using var reader = command.ExecuteReader();

    while (reader.Read())
    {
        Console.WriteLine("{0} {1}", reader.GetString(0), reader.GetInt32(1));
    }
}
catch (SqlException e)
{
    Console.WriteLine(e);
}

Console.WriteLine("\nDone. Press enter.");
  1. Ctrl + Click the ExecuteReader method

Expected behavior

Decompiled library successfully with intellisense working

Actual behavior

image

Notice there is no type inference for SqlDataReader and its return type is null

Additional context

When getting intellisense for reader, the list is not complete. In this case is missing the Dispose() method.

image

Looking at SqlClient source code for v5.1.1 the method is defined without a [EditorBrowsable(EditorBrowsableState.Never)] data annotation so it should be showed.

Also tested with VS Code C# Extension v1.26.0, it works but the decompiling is different compared to the source.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions