Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 7cd1637

Browse files
author
Gene Lee
authored
Fix MatchingRefApiCompat issues (#28369)
1 parent 82518b9 commit 7cd1637

8 files changed

+101
-6
lines changed

src/System.Data.SqlClient/ref/Configurations.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<BuildConfigurations>
55
netstandard;
66
netfx;
7+
netcoreapp;
78
</BuildConfigurations>
89
</PropertyGroup>
910
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
// ------------------------------------------------------------------------------
5+
// Changes to this file must follow the http://aka.ms/api-review process.
6+
// ------------------------------------------------------------------------------
7+
8+
namespace System.Data.SqlClient
9+
{
10+
public partial class SqlDataReader : System.Data.Common.IDbColumnSchemaGenerator
11+
{
12+
public System.Collections.ObjectModel.ReadOnlyCollection<System.Data.Common.DbColumn> GetColumnSchema() { throw null; }
13+
}
14+
}

src/System.Data.SqlClient/ref/System.Data.SqlClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ public SqlMetaData(string name, System.Data.SqlDbType dbType, long maxLength, lo
158158
public SqlMetaData(string name, System.Data.SqlDbType dbType, long maxLength, long locale, System.Data.SqlTypes.SqlCompareOptions compareOptions, bool useServerDefault, bool isUniqueKey, System.Data.SqlClient.SortOrder columnSortOrder, int sortOrdinal) { }
159159
public SqlMetaData(string name, System.Data.SqlDbType dbType, string database, string owningSchema, string objectName) { }
160160
public SqlMetaData(string name, System.Data.SqlDbType dbType, string database, string owningSchema, string objectName, bool useServerDefault, bool isUniqueKey, System.Data.SqlClient.SortOrder columnSortOrder, int sortOrdinal) { }
161+
public SqlMetaData(string name, System.Data.SqlDbType dbType, System.Type userDefinedType) { }
161162
public SqlMetaData(string name, System.Data.SqlDbType dbType, System.Type userDefinedType, string serverTypeName) { }
162163
public SqlMetaData(string name, System.Data.SqlDbType dbType, System.Type userDefinedType, string serverTypeName, bool useServerDefault, bool isUniqueKey, System.Data.SqlClient.SortOrder columnSortOrder, int sortOrdinal) { }
163164

src/System.Data.SqlClient/ref/System.Data.SqlClient.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,30 @@
1212
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
1313
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
1414
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
15+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
16+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
1517
<ItemGroup>
1618
<SuppressPackageTargetFrameworkCompatibility Include="$(UAPvNextTFM)" />
1719
<Compile Include="System.Data.SqlClient.cs" />
1820
<Compile Include="System.Data.SqlClient.Manual.cs" />
1921
</ItemGroup>
22+
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
23+
<Compile Include="System.Data.SqlClient.NetCoreApp.cs" />
24+
</ItemGroup>
2025
<ItemGroup Condition="'$(TargetGroup)' == 'netfx'">
2126
<Reference Include="mscorlib" />
2227
<Reference Include="System" />
2328
<Reference Include="System.Data" />
2429
<Reference Include="System.Xml" />
2530
</ItemGroup>
31+
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
32+
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
33+
<ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" />
34+
<ProjectReference Include="..\..\System.Data.Common\ref\System.Data.Common.csproj" />
35+
<ProjectReference Include="..\..\System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" />
36+
<ProjectReference Include="..\..\System.ComponentModel.Primitives\ref\System.ComponentModel.Primitives.csproj" />
37+
<ProjectReference Include="..\..\System.Xml.ReaderWriter\ref\System.Xml.ReaderWriter.csproj" />
38+
<ProjectReference Include="..\..\System.Runtime.InteropServices\ref\System.Runtime.InteropServices.csproj" />
39+
</ItemGroup>
2640
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
2741
</Project>

src/System.Data.SqlClient/src/Configurations.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
netstandard1.3;
99
netstandard;
1010
netfx-Windows_NT;
11+
netcoreapp;
12+
netcoreapp-Unix;
13+
netcoreapp-Windows_NT;
1114
</PackageConfigurations>
1215
<BuildConfigurations>
1316
$(PackageConfigurations)
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
#
2+
# netstandard dll has been shipped with IDbColumnSchemaGenerator inherited and SqlDataReader.GetColumnScheme() implemented in source, but not exposed in ref contract.
3+
# Removing SqlDataReader.GetColumnScheme() from netstandard implementation potentially breaks existing customer source code
4+
# that utilizes SqlDataReader.GetColumnScheme() indirectly by casting SqlDataReader to IDbColumnSchemaGenerator type.
5+
# In order to prevent it, the API needs to be kept in public, and following 2 error message should be remaining in this baseline file.
6+
#
17
Compat issues with assembly System.Data.SqlClient:
2-
MembersMustExist : Member 'Microsoft.SqlServer.Server.SqlMetaData..ctor(System.String, System.Data.SqlDbType, System.Type)' does not exist in the implementation but it does exist in the contract.
38
CannotRemoveBaseTypeOrInterface : Type 'System.Data.SqlClient.SqlDataReader' does not implement interface 'System.Data.Common.IDbColumnSchemaGenerator' in the implementation but it does in the contract.
49
MembersMustExist : Member 'System.Data.SqlClient.SqlDataReader.GetColumnSchema()' does not exist in the implementation but it does exist in the contract.
5-
Total Issues: 3
10+
Total Issues: 2
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!-- Not a bug. sni.dll is a native component that ships as part of the package. -->
2+
kernel32.dll!LoadLibraryExW
3+
sni.dll!GetSniMaxComposedSpnLength
4+
sni.dll!SNIAddProviderWrapper
5+
sni.dll!SNICheckConnectionWrapper
6+
sni.dll!SNICloseWrapper
7+
sni.dll!SNIGetInfoWrapper
8+
sni.dll!SNIGetLastError
9+
sni.dll!SNIInitialize
10+
sni.dll!SNIOpenSyncExWrapper
11+
sni.dll!SNIOpenWrapper
12+
sni.dll!SNIPacketAllocateWrapper
13+
sni.dll!SNIPacketGetDataWrapper
14+
sni.dll!SNIPacketRelease
15+
sni.dll!SNIPacketResetWrapper
16+
sni.dll!SNIPacketSetData
17+
sni.dll!SNIQueryInfo
18+
sni.dll!SNIReadAsyncWrapper
19+
sni.dll!SNIReadSyncOverAsync
20+
sni.dll!SNIRemoveProviderWrapper
21+
sni.dll!SNISecGenClientContextWrapper
22+
sni.dll!SNISecInitPackage
23+
sni.dll!SNISetInfoWrapper
24+
sni.dll!SNITerminate
25+
sni.dll!SNIWaitForSSLHandshakeToCompleteWrapper
26+
sni.dll!SNIWriteAsyncWrapper
27+
sni.dll!SNIWriteSyncOverAsync
28+
sni.dll!UnmanagedIsTokenRestricted
29+
sspicli.dll!AcceptSecurityContext
30+
sspicli.dll!AcquireCredentialsHandleW
31+
sspicli.dll!ApplyControlToken
32+
sspicli.dll!CompleteAuthToken
33+
sspicli.dll!DecryptMessage
34+
sspicli.dll!DeleteSecurityContext
35+
sspicli.dll!EncryptMessage
36+
sspicli.dll!EnumerateSecurityPackagesW
37+
sspicli.dll!FreeContextBuffer
38+
sspicli.dll!FreeCredentialsHandle
39+
sspicli.dll!InitializeSecurityContextW
40+
sspicli.dll!QueryContextAttributesW
41+
sspicli.dll!QuerySecurityContextToken
42+
sspicli.dll!SetContextAttributesW
43+
sspicli.dll!SspiEncodeStringsAsAuthIdentity
44+
sspicli.dll!SspiFreeAuthIdentity

src/System.Data.SqlClient/src/System.Data.SqlClient.csproj

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.2-Release|AnyCPU'" />
2525
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.3-Debug|AnyCPU'" />
2626
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard1.3-Release|AnyCPU'" />
27-
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard' OR '$(TargetGroup)' == 'uap' ">
27+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Debug|AnyCPU'" />
30+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Release|AnyCPU'" />
31+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />
32+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Release|AnyCPU'" />
33+
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard' OR '$(TargetGroup)' == 'netcoreapp' OR '$(TargetGroup)' == 'uap' ">
2834
<Compile Include="System.Data.SqlClient.TypeForwards.cs" />
2935
</ItemGroup>
3036
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true' AND '$(OSGroup)' != 'AnyOS'">
@@ -221,7 +227,7 @@
221227
<Compile Include="System\Data\SqlClient\SqlCredential.cs" />
222228
</ItemGroup>
223229
<!-- Manage the SNI toggle for Windows netstandard and UWP -->
224-
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard' AND '$(TargetsWindows)' == 'true'">
230+
<ItemGroup Condition="('$(TargetGroup)' == 'netstandard' OR '$(TargetGroup)' == 'netcoreapp') AND '$(TargetsWindows)' == 'true'">
225231
<Compile Include="System\Data\SqlClient\TdsParserStateObjectFactory.Windows.cs" />
226232
</ItemGroup>
227233
<ItemGroup Condition="'$(TargetGroup)' == 'uap'">
@@ -232,7 +238,7 @@
232238
<Compile Include="System\Data\SqlClient\TdsParser.Unix.cs" />
233239
</ItemGroup>
234240
<!-- Assets needed on Windows but should be avoided on UAP to avoid sni.dll -->
235-
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(IsPartialFacadeAssembly)' != 'true' and '$(TargetGroup)' != 'uap' ">
241+
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(IsPartialFacadeAssembly)' != 'true' and '$(TargetGroup)' != 'uap'">
236242
<Compile Include="System\Data\SqlClient\TdsParserStateObjectNative.cs" />
237243
<Compile Include="Interop\SNINativeMethodWrapper.Windows.cs" />
238244
<Compile Include="System\Data\SqlClient\TdsParserSafeHandles.cs" />
@@ -472,7 +478,7 @@
472478
<Reference Include="System.Net.NameResolution" />
473479
<Reference Include="System.Diagnostics.Tracing" />
474480
</ItemGroup>
475-
<ItemGroup Condition="'$(OSGroup)' != 'AnyOS' AND '$(TargetGroup)' == 'uap'">
481+
<ItemGroup Condition="('$(OSGroup)' != 'AnyOS' AND '$(TargetGroup)' == 'uap') OR '$(TargetGroup)' == 'netcoreapp'">
476482
<Reference Include="System.Transactions.Local" />
477483
<Reference Include="System.Collections.NonGeneric" />
478484
</ItemGroup>
@@ -485,6 +491,13 @@
485491
<LogicalName>System.Data.SqlClient.SqlMetaData.xml</LogicalName>
486492
</EmbeddedResource>
487493
</ItemGroup>
494+
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
495+
<Reference Include="System.Runtime.Extensions" />
496+
<Reference Include="System.Data.Common" />
497+
<Reference Include="System.ComponentModel.Primitives" />
498+
<Reference Include="System.Xml.ReaderWriter" />
499+
<Reference Include="System.Runtime.InteropServices" />
500+
</ItemGroup>
488501
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
489502
<Import Project=".\GenerateThisAssemblyCs.targets" Condition="'$(IsPartialFacadeAssembly)' != 'true'" />
490503
</Project>

0 commit comments

Comments
 (0)