Skip to content

Commit 4b28b79

Browse files
authored
Conditionally compile .NET 6.0-only files (#2962)
InternalException, NetEventSource and the types associated with SecPkgContext_ApplicationProtocol are only used by the old .NET 6.0 target.
1 parent 7214342 commit 4b28b79

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Common/System/Net/InternalException.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if NET && !NET8_0_OR_GREATER
6+
57
namespace System.Net
68
{
79
[Serializable]
@@ -21,3 +23,5 @@ public InternalException(string message, Exception innerException) : base(messag
2123
}
2224
}
2325
}
26+
27+
#endif

src/Microsoft.Data.SqlClient/netcore/src/Common/System/Net/Logging/NetEventSource.Common.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if NET && !NET8_0_OR_GREATER
6+
57
#if DEBUG
68
// Uncomment to enable runtime checks to help validate that NetEventSource isn't being misused
79
// in a way that will cause performance problems, e.g. unexpected boxing of value types.
@@ -771,3 +773,5 @@ private unsafe void WriteEvent(int eventId, string arg1, string arg2, string arg
771773
#endregion
772774
}
773775
}
776+
777+
#endif

src/Microsoft.Data.SqlClient/src/Interop/Windows/SChannel/Interop.SecPkgContext_ApplicationProtocol.netcore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#if NET
5+
#if NET && !NET8_0_OR_GREATER
66

77
using System;
88
using System.Runtime.InteropServices;

0 commit comments

Comments
 (0)