Skip to content

Missing CLSCompliant(true) attribute on ref assemblies #476

@KristianWedberg

Description

@KristianWedberg

Describe the bug

The ref/net46/Microsoft.Data.SqlClient.dll assembly in the Microsoft.Data.SqlClient package (both 1.1.1 and 2.0.0-preview1.20021.1) is missing the [assembly: CLSCompliant(true)] attribute, even though assemblies in the lib/net46 and runtimes/win/lib/net46 folders do have the attribute.

This leads to CS3001 and CS3003 (not CLS-compliant) build warnings when using e.g. SqlBulkCopyOptions in a public API in a CLS compliant assembly targeting .NET 4.6.1:

In contrast, the System.Data.SqlClient package does not have this issue (i.e.
the ref/net46/Microsoft.Data.SqlClient.dll assembly does have the attribute).

To reproduce

Reference SqlBulkCopyOptions in a public API in a CLS compliant assembly targeting .NET 4.6.1:

AssemblyInfo.cs:

[assembly: CLSCompliant(true)]

Program.cs:

using Microsoft.Data.SqlClient;

public class MyClass
{
        public SqlBulkCopyOptions SqlBulkCopyOptions { get; set; }
}

This gives a build warning:

Warning	CS3003	Type of 'MyClass.SqlBulkCopyOptions' is not CLS-compliant

Expected behavior

No CLS related build warnings.

Further technical details

Microsoft.Data.SqlClient version: 1.1.1 and 2.0.0-preview1.20021.1
.NET target: .NET Framework 4.6.1
Operating system: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions