Skip to content

Commit 6ea53bf

Browse files
author
Josh Peterson
committed
Implement NamedPipeClientStream in the unityaot profile (case 1159863)
This change builds the class library code to implement the `NamedPipeClientStream` class in the unityaot profile on Windows. For the time being, we will not implement this class for non-Windows platforms, since that requires the Mono.Posix.dll assembly and a native library as well. We may consider adding support on Posix platforms in the future.
1 parent 48242a6 commit 6ea53bf

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs

+15-7
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public NamedPipeClientStream (string serverName, string pipeName, PipeDirection
7474
}
7575

7676
public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
77-
#if MOBILE
77+
#if MOBILE && !UNITY_AOT
7878
: base (direction, DefaultBufferSize)
7979
{
8080
throw new NotImplementedException ();
@@ -88,13 +88,17 @@ public NamedPipeClientStream (string serverName, string pipeName, PipeDirection
8888
public NamedPipeClientStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle)
8989
: base (direction, DefaultBufferSize)
9090
{
91-
#if MOBILE
91+
#if MOBILE && !UNITY_AOT
9292
throw new NotImplementedException ();
9393
#else
9494
if (IsWindows)
9595
impl = new Win32NamedPipeClient (this, safePipeHandle);
9696
else
97+
#if UNITY_AOT
98+
throw new NotImplementedException ();
99+
#else
97100
impl = new UnixNamedPipeClient (this, safePipeHandle);
101+
#endif
98102
IsConnected = isConnected;
99103
InitializeHandle (safePipeHandle, true, isAsync);
100104
#endif
@@ -106,13 +110,17 @@ public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRigh
106110
if (impersonationLevel != TokenImpersonationLevel.None ||
107111
inheritability != HandleInheritability.None)
108112
throw ThrowACLException ();
109-
#if MOBILE
113+
#if MOBILE && !UNITY_AOT
110114
throw new NotImplementedException ();
111115
#else
112116
if (IsWindows)
113117
impl = new Win32NamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
114118
else
119+
#if UNITY_AOT
120+
throw new NotImplementedException ();
121+
#else
115122
impl = new UnixNamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
123+
#endif
116124
#endif
117125

118126
}
@@ -121,13 +129,13 @@ public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRigh
121129
Dispose (false);
122130
}
123131

124-
#if !MOBILE
132+
#if !MOBILE || UNITY_AOT
125133
INamedPipeClient impl;
126134
#endif
127135

128136
public void Connect ()
129137
{
130-
#if MOBILE
138+
#if MOBILE && !UNITY_AOT
131139
throw new NotImplementedException ();
132140
#else
133141
impl.Connect ();
@@ -138,7 +146,7 @@ public void Connect ()
138146

139147
public void Connect (int timeout)
140148
{
141-
#if MOBILE
149+
#if MOBILE && !UNITY_AOT
142150
throw new NotImplementedException ();
143151
#else
144152
impl.Connect (timeout);
@@ -174,7 +182,7 @@ protected override internal void CheckPipePropertyOperations () {
174182
public int NumberOfServerInstances {
175183
get {
176184
CheckPipePropertyOperations ();
177-
#if MOBILE
185+
#if MOBILE && !UNITY_AOT
178186
throw new NotImplementedException ();
179187
#else
180188
return impl.NumberOfServerInstances;

mcs/class/System.Core/System.IO.Pipes/PipeStream.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public abstract class PipeStream : Stream
4646
// FIXME: not precise.
4747
internal const int DefaultBufferSize = 0x400;
4848

49-
#if !MOBILE
49+
#if !MOBILE || UNITY_AOT
5050
internal static bool IsWindows {
5151
get { return Win32Marshal.IsWindows; }
5252
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#include winaot_System.Core.dll.sources
22
../referencesource/System.Core/System/Linq/Enumerable.cs
33
corefx/SR.cs
4+
System.IO.Pipes/PipeWin32.cs

0 commit comments

Comments
 (0)