[System.ServiceModel.Internals] Do not include win32 p/invokes in mobile builds
authorSebastien Pouliot <sebastien@xamarin.com>
Fri, 20 Nov 2015 15:07:37 +0000 (10:07 -0500)
committerSebastien Pouliot <sebastien@xamarin.com>
Fri, 20 Nov 2015 15:07:37 +0000 (10:07 -0500)
This cause native linking issues for tvOS as Xcode 7.1 does not allow
`-u` in bitcode-enabled builds so we have to call directly the symbols
and it must exists at (native) link time.

mcs/class/System.ServiceModel.Internals/MobileStubs.cs [new file with mode: 0644]
mcs/class/System.ServiceModel.Internals/mobile_System.ServiceModel.Internals.dll.sources [new file with mode: 0644]
mcs/class/System.ServiceModel.Internals/monotouch_System.ServiceModel.Internals.dll.sources [new file with mode: 0644]
mcs/class/System.ServiceModel.Internals/monotouch_tv_System.ServiceModel.Internals.dll.sources [new file with mode: 0644]
mcs/class/System.ServiceModel.Internals/xammac_System.ServiceModel.Internals.dll.sources [new file with mode: 0644]

diff --git a/mcs/class/System.ServiceModel.Internals/MobileStubs.cs b/mcs/class/System.ServiceModel.Internals/MobileStubs.cs
new file mode 100644 (file)
index 0000000..f82ff50
--- /dev/null
@@ -0,0 +1,146 @@
+// help compiles sources for mobile without having unusable
+// Windows p/invoke in the assemblies
+//
+// Copyright 2015 Xamarin Inc.
+
+#if MOBILE
+
+namespace System.Runtime.Interop {
+
+       using Microsoft.Win32.SafeHandles;
+       using System.Runtime.Diagnostics;
+       using System.Runtime.InteropServices;
+       using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;
+
+       sealed class SafeEventLogWriteHandle : SafeHandleZeroOrMinusOneIsInvalid {
+
+               SafeEventLogWriteHandle () : base (true)
+               {
+               }
+
+               public static SafeEventLogWriteHandle RegisterEventSource (string uncServerName, string sourceName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               static bool DeregisterEventSource (IntPtr hEventLog)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               protected override bool ReleaseHandle ()
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+
+       static class UnsafeNativeMethods {
+
+               public const int ERROR_MORE_DATA = 234;
+               public const int ERROR_ARITHMETIC_OVERFLOW = 534;
+               public const int ERROR_NOT_ENOUGH_MEMORY = 8;
+
+               [StructLayout (LayoutKind.Explicit, Size = 16)]
+               public struct EventData {
+                       [FieldOffset(0)]
+                       internal UInt64 DataPointer;
+                       [FieldOffset(8)]
+                       internal uint Size;
+                       [FieldOffset(12)]
+                       internal int Reserved;
+               }
+
+               public static SafeWaitHandle CreateWaitableTimer (IntPtr mustBeZero, bool manualReset, string timerName)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static bool SetWaitableTimer (SafeWaitHandle handle, ref long dueTime, int period, IntPtr mustBeZero, IntPtr mustBeZeroAlso, bool resume)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static int QueryPerformanceCounter (out long time)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static uint GetSystemTimeAdjustment (out int adjustment, out uint increment, out uint adjustmentDisabled)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               public static void GetSystemTimeAsFileTime (out long time)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static string GetComputerName (ComputerNameFormat nameType)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static bool IsDebuggerPresent ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static void DebugBreak ()
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static void OutputDebugString (string lpOutputString)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal unsafe delegate void EtwEnableCallback (ref Guid sourceId, int isEnabled, byte level, long matchAnyKeywords, long matchAllKeywords, void* filterData, void* callbackContext);
+
+               internal static unsafe uint EventRegister (ref Guid providerId, EtwEnableCallback enableCallback, void* callbackContext, ref long registrationHandle)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static uint EventUnregister (long registrationHandle)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static bool EventEnabled (long registrationHandle, ref EventDescriptor eventDescriptor)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static unsafe uint EventWrite (long registrationHandle, ref EventDescriptor eventDescriptor, uint userDataCount, EventData* userData)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static unsafe uint EventWriteTransfer (long registrationHandle, ref EventDescriptor eventDescriptor, ref Guid activityId, ref Guid relatedActivityId, uint userDataCount, EventData* userData)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static unsafe uint EventWriteString (long registrationHandle, byte level, long keywords, char* message)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static unsafe uint EventActivityIdControl (int ControlCode, ref Guid ActivityId)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static bool ReportEvent (SafeHandle hEventLog, ushort type, ushort category, uint eventID, byte[] userSID, ushort numStrings, uint dataLen, HandleRef strings, byte[] rawData)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal static SafeEventLogWriteHandle RegisterEventSource (string uncServerName, string sourceName)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
+}
+#endif
diff --git a/mcs/class/System.ServiceModel.Internals/mobile_System.ServiceModel.Internals.dll.sources b/mcs/class/System.ServiceModel.Internals/mobile_System.ServiceModel.Internals.dll.sources
new file mode 100644 (file)
index 0000000..a2290a9
--- /dev/null
@@ -0,0 +1,78 @@
+../../build/common/Consts.cs
+../../build/common/SR.cs
+EventLogEntryType.cs
+InternalSR.cs
+MobileStubs.cs
+Assembly/AssemblyInfo.cs
+../../../external/referencesource/System.ServiceModel.Internals/AssemblyInfo.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/ActionItem.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/AssertHelper.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/AsyncCompletionResult.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/AsyncEventArgsCallback.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/AsyncEventArgs.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/AsyncResult.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/AsyncWaitHandle.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/BackoffTimeoutHelper.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/BufferedOutputStream.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/CallbackException.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Collections/HopperCache.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Collections/NullableKeyDictionary.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Collections/ObjectCache.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Collections/ObjectCacheItem.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Collections/ObjectCacheSettings.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Collections/OrderedDictionary.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Collections/ValidatingCollection.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/CompletedAsyncResult.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/ComputerNameFormat.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/ActivityControl.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/DiagnosticEventProvider.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/DiagnosticTraceBase.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/DiagnosticTraceSource.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/DictionaryTraceRecord.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/EtwDiagnosticTrace.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/EtwProvider.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/EventDescriptor.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/EventLogCategory.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/EventLogEventId.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/EventLogger.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/EventTraceActivity.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/ITraceSourceStringProvider.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/PerformanceCounterNameAttribute.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/StringTraceRecord.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Diagnostics/TraceRecord.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/DiagnosticStrings.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/DuplicateDetector.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/ExceptionTrace.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/FastAsyncCallback.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/FatalException.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/FxCop.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Fx.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/HashHelper.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/IAsyncEventArgs.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/InputQueue.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/InternalBufferManager.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/IOThreadCancellationTokenSource.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/IOThreadScheduler.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/IOThreadTimer.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/MruCache.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/NameGenerator.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/PartialTrustHelpers.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/ReadOnlyDictionaryInternal.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/ReadOnlyKeyedCollection.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/ScheduleActionItemAsyncResult.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/SignalGate.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/SynchronizedPool.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/TaskExtensions.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/ThreadNeutralSemaphore.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/Ticks.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/TimeoutHelper.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/TraceChannel.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/TraceEventLevel.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/TraceEventOpcode.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/TraceLevelHelper.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/TracePayload.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/TypedAsyncResult.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/TypeHelper.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/UrlUtility.cs
+../../../external/referencesource/System.ServiceModel.Internals/System/Runtime/WaitCallbackActionItem.cs
+../../../external/referencesource/System.ServiceModel.Internals/TraceCore.Designer.cs
diff --git a/mcs/class/System.ServiceModel.Internals/monotouch_System.ServiceModel.Internals.dll.sources b/mcs/class/System.ServiceModel.Internals/monotouch_System.ServiceModel.Internals.dll.sources
new file mode 100644 (file)
index 0000000..903b4f6
--- /dev/null
@@ -0,0 +1 @@
+#include mobile_System.ServiceModel.Internals.dll.sources
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel.Internals/monotouch_tv_System.ServiceModel.Internals.dll.sources b/mcs/class/System.ServiceModel.Internals/monotouch_tv_System.ServiceModel.Internals.dll.sources
new file mode 100644 (file)
index 0000000..12c950c
--- /dev/null
@@ -0,0 +1 @@
+#include monotouch_System.ServiceModel.Internals.dll.sources
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel.Internals/xammac_System.ServiceModel.Internals.dll.sources b/mcs/class/System.ServiceModel.Internals/xammac_System.ServiceModel.Internals.dll.sources
new file mode 100644 (file)
index 0000000..12c950c
--- /dev/null
@@ -0,0 +1 @@
+#include monotouch_System.ServiceModel.Internals.dll.sources
\ No newline at end of file