Skip to content

Commit

Permalink
Change NetNamedPipe from net6.0-windows to net6.0 in preference to Su…
Browse files Browse the repository at this point in the history
…pportedOSPlatform and throwing if not on Windows
  • Loading branch information
mconnew committed Apr 20, 2023
1 parent 04ee51e commit ae14cdb
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 33 deletions.
32 changes: 1 addition & 31 deletions src/System.ServiceModel.NetNamedPipe/src/Resources/strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@
<data name="ValueMustBeNonNegative" xml:space="preserve">
<value>The value of this argument must be non-negative.</value>
</data>
<data name="SessionValueInvalid" xml:space="preserve">
<value>The Session value '{0}' is invalid. Please specify 'CurrentSession','ServiceSession' or a valid non-negative Windows Session Id.</value>
</data>
<data name="PackageFullNameInvalid" xml:space="preserve">
<value>The package full name '{0}' is invalid.</value>
</data>
<data name="ChannelTypeNotSupported" xml:space="preserve">
<value>The specified channel type {0} is not supported by this channel manager.</value>
</data>
Expand All @@ -150,12 +144,6 @@
<data name="PipeEndpointNotFound" xml:space="preserve">
<value>The pipe endpoint '{0}' could not be found on your local machine.</value>
</data>
<data name="SecurityServerTooBusy" xml:space="preserve">
<value>Server '{0}' sent back a fault indicating it is too busy to process the request. Please retry later. Please see the inner exception for fault details.</value>
</data>
<data name="SecurityEndpointNotFound" xml:space="preserve">
<value>Server '{0}' sent back a fault indicating it is in the process of shutting down. Please see the inner exception for fault details.</value>
</data>
<data name="PipeUriSchemeWrong" xml:space="preserve">
<value>URIs used with pipes must use the scheme: 'net.pipe'.</value>
</data>
Expand Down Expand Up @@ -198,9 +186,6 @@
<data name="PipeShutdownReadError" xml:space="preserve">
<value>The shutdown indicator was not received from the pipe. The application on the other end of the pipe may not have sent it. The pipe will still be closed.</value>
</data>
<data name="LockTimeoutExceptionMessage" xml:space="preserve">
<value>Cannot claim lock within the allotted timeout of {0}. The time allotted to this operation may have been a portion of a longer timeout.</value>
</data>
<data name="PipeClosed" xml:space="preserve">
<value>The operation cannot be completed because the pipe was closed. This may have been caused by the application on the other end of the pipe exiting.</value>
</data>
Expand All @@ -225,22 +210,7 @@
<data name="TraceCodeFailedPipeConnect" xml:space="preserve">
<value>An attempt to connect to the named pipe endpoint at '{1}' failed. Another attempt will be made with {0} remaining in the overall timeout.</value>
</data>
<data name="ActivityBoundary" xml:space="preserve">
<value>Activity boundary</value>
</data>
<data name="InsufficentMemory" xml:space="preserve">
<value>Insufficient memory avaliable to complete the operation.</value>
</data>
<data name="ActivityProcessAction" xml:space="preserve">
<value>Process action '{0}'.</value>
</data>
<data name="CannotDetermineSPNBasedOnAddress" xml:space="preserve">
<value>Client cannot determine the Service Principal Name based on the identity in the target address '{0}' for the purpose of SspiNegotiation/Kerberos. The target address identity must be a UPN identity (like acmedomain\alice) or SPN identity (like host/bobs-machine).</value>
</data>
<data name="ValueMustBePositive" xml:space="preserve">
<value>The value of this argument must be positive.</value>
</data>
<data name="PlatformNotSupported_NetNamedPipe" xml:space="preserve">
<value>NetNamedPipe is not supported on this platform.</value>
</data>
</root>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<CLSCompliant>true</CLSCompliant>
<IsPackable>true</IsPackable>
<IsShipping>$(Ship_WcfPackages)</IsShipping>
<TargetFrameworks>net6.0-windows</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<RootNamespace>System.ServiceModel</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageDescription>Provides the types that permit SOAP messages to be exchanged using named pipes (example: NetNamedPipeBinding).</PackageDescription>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime;
using System.Runtime.Versioning;

namespace System.ServiceModel.Channels
{
[SupportedOSPlatform("windows")]
public sealed class NamedPipeConnectionPoolSettings
{
private string _groupName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Principal;

namespace System.ServiceModel.Channels
{
[SupportedOSPlatform("windows")]
public class NamedPipeTransportBindingElement : ConnectionOrientedTransportBindingElement
{
private readonly List<SecurityIdentifier> _allowedUsers = new List<SecurityIdentifier>();
private readonly NamedPipeConnectionPoolSettings _connectionPoolSettings = new NamedPipeConnectionPoolSettings();

public NamedPipeTransportBindingElement() : base() { }
public NamedPipeTransportBindingElement() : base()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
throw ExceptionHelper.PlatformNotSupported(SR.Format(SR.PlatformNotSupported_NetNamedPipe));
}
}

protected NamedPipeTransportBindingElement(NamedPipeTransportBindingElement elementToBeCloned)
: base(elementToBeCloned)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,26 @@

using System.ComponentModel;
using System.Net.Security;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;

namespace System.ServiceModel
{
[SupportedOSPlatform("windows")]
public sealed class NamedPipeTransportSecurity
{
internal const ProtectionLevel DefaultProtectionLevel = ProtectionLevel.EncryptAndSign;
private ProtectionLevel _protectionLevel;

public NamedPipeTransportSecurity()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
throw ExceptionHelper.PlatformNotSupported(SR.Format(SR.PlatformNotSupported_NetNamedPipe));
}

_protectionLevel = DefaultProtectionLevel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.ServiceModel.Channels;
using System.Xml;

namespace System.ServiceModel
{
[SupportedOSPlatform("windows")]
public class NetNamedPipeBinding : Binding
{
// private BindingElements
Expand All @@ -16,6 +19,11 @@ public class NetNamedPipeBinding : Binding

public NetNamedPipeBinding() : base()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
throw ExceptionHelper.PlatformNotSupported(SR.Format(SR.PlatformNotSupported_NetNamedPipe));
}

Initialize();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.ServiceModel.Channels;

namespace System.ServiceModel
{
[SupportedOSPlatform("windows")]
public sealed class NetNamedPipeSecurity
{
internal const NetNamedPipeSecurityMode DefaultMode = NetNamedPipeSecurityMode.Transport;
Expand All @@ -14,6 +17,11 @@ public sealed class NetNamedPipeSecurity

public NetNamedPipeSecurity()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
throw ExceptionHelper.PlatformNotSupported(SR.Format(SR.PlatformNotSupported_NetNamedPipe));
}

_mode = DefaultMode;
}

Expand Down

0 comments on commit ae14cdb

Please sign in to comment.