Skip to content

Huge build size regression due to added broker support #4410

Description

@dallmair

Describe the bug

We're using Microsoft.Data.SqlClient in a cloud service running on Linux x64 in containers. With the upgrade to the newly released version 6.1.6 (also happens with 7.0.2), our container size increased a lot.

#4288 added broker support for interactive Entra ID auth. To implement this, the Microsoft.Data.SqlClient.Extensions.Azure package gained a dependency on Microsoft.Identity.Client.Broker.

This is the crux: In a cloud service, we don't have interactive auth anyway, and the PR even explicitly states

Non-Windows: broker is never used.

Thus, it should be possible to have a build without all the binaries needed for broker support as that is all dead code in our case, but the build doesn't know and puts all the binaries there all the time.

To reproduce

Create a new .NET 10 console application project and add references to Microsoft.Data.SqlClient 7.0.1 and Microsoft.Data.SqlClient.Extensions.Azure 1.0.0. Compile the project and check the output directory size.

Then, upgrade the Microsoft.Data.SqlClient* dependencies to 7.0.2, rebuild the project, and check the output directory size again.

On my system (Release configuration):

Version Size in bytes
7.0.1 + 1.0.0 15,607,664
7.0.2 78,921,330

To be fair, in a production build one would use dotnet publish --runtime linux-x64 which brings down the output to 48,494,987 bytes, but that's still a whopping 32 MiB more than with the previous version.

Expected behavior

I'm able to choose whether I want to have broker support or not by being able to install a dedicated package that adds broker support if needed.

Further technical details

Microsoft.Data.SqlClient version: 7.0.2
.NET target: .NET 10.0
SQL Server version: -
Operating system: -

Additional context
-

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions