2525#if ! __IOS__
2626using System . Reflection . Emit ;
2727using FastMember = ServiceStack . Text . FastMember ;
28+ #elif __IOS10__
29+ using Preserve = Foundation . PreserveAttribute ;
30+ #else
31+ using Preserve = MonoTouch . Foundation . PreserveAttribute ;
2832#endif
2933
3034namespace ServiceStack
@@ -39,7 +43,7 @@ public Net40PclExport()
3943 this . DirSep = Path . DirectorySeparatorChar ;
4044 this . AltDirSep = Path . DirectorySeparatorChar == '/' ? '\\ ' : '/' ;
4145 this . RegexOptions = RegexOptions . Compiled ;
42- this . InvariantComparison = StringComparison . InvariantCulture ;
46+ this . InvariantComparison = StringComparison . InvariantCulture ;
4347 this . InvariantComparisonIgnoreCase = StringComparison . InvariantCultureIgnoreCase ;
4448 this . InvariantComparer = StringComparer . InvariantCulture ;
4549 this . InvariantComparerIgnoreCase = StringComparer . InvariantCultureIgnoreCase ;
@@ -123,7 +127,7 @@ public override void WriteLine(string format, params object[] args)
123127
124128 public override void AddCompression ( WebRequest webReq )
125129 {
126- var httpReq = ( HttpWebRequest ) webReq ;
130+ var httpReq = ( HttpWebRequest ) webReq ;
127131 httpReq . Headers . Add ( HttpRequestHeader . AcceptEncoding , "gzip,deflate" ) ;
128132 httpReq . AutomaticDecompression = DecompressionMethods . GZip | DecompressionMethods . Deflate ;
129133 }
@@ -295,7 +299,7 @@ internal static void SetField<TValue>(ref TValue field, TValue newValue)
295299 {
296300 field = newValue ;
297301 }
298-
302+
299303 public override PropertySetterDelegate GetFieldSetterFn ( FieldInfo fieldInfo )
300304 {
301305 if ( ! SupportsExpression )
@@ -341,7 +345,7 @@ public override PropertyGetterDelegate GetFieldGetterFn(FieldInfo fieldInfo)
341345
342346 var fieldGetterFn = Expression . Lambda < PropertyGetterDelegate >
343347 (
344- oExprCallFieldGetFn ,
348+ oExprCallFieldGetFn ,
345349 oInstanceParam
346350 )
347351 . Compile ( ) ;
@@ -434,7 +438,7 @@ public override ParseStringDelegate GetJsReaderParseMethod<TSerializer>(Type typ
434438 return DeserializeDynamic < TSerializer > . Parse ;
435439 }
436440#endif
437- return null ;
441+ return null ;
438442 }
439443
440444 public override XmlSerializer NewXmlSerializer ( )
@@ -472,7 +476,7 @@ public override LicenseKey VerifyLicenseKeyText(string licenseKeyText)
472476 public override void VerifyInAssembly ( Type accessType , ICollection < string > assemblyNames )
473477 {
474478 //might get merged/mangled on alt platforms
475- if ( assemblyNames . Contains ( accessType . Assembly . ManifestModule . Name ) )
479+ if ( assemblyNames . Contains ( accessType . Assembly . ManifestModule . Name ) )
476480 return ;
477481
478482 try
@@ -618,7 +622,7 @@ private static DynamicMethod CreateDynamicSetMethod(MemberInfo memberInfo)
618622 }
619623
620624#if __IOS__
621- [ MonoTouch . Foundation . Preserve ( AllMembers = true ) ]
625+ [ Preserve ( AllMembers = true ) ]
622626 internal class Poco
623627 {
624628 public string Dummy { get ; set ; }
@@ -654,12 +658,12 @@ public override void ResetStream(Stream stream)
654658 /// Provide hint to IOS AOT compiler to pre-compile generic classes for all your DTOs.
655659 /// Just needs to be called once in a static constructor.
656660 /// </summary>
657- [ MonoTouch . Foundation . Preserve ]
661+ [ Preserve ]
658662 public static void InitForAot ( )
659663 {
660664 }
661665
662- [ MonoTouch . Foundation . Preserve ]
666+ [ Preserve ]
663667 public override void RegisterForAot ( )
664668 {
665669 RegisterTypeForAot < Poco > ( ) ;
@@ -708,20 +712,20 @@ public override void RegisterForAot()
708712 RegisterTypeForAot < Guid ? > ( ) ;
709713 }
710714
711- [ MonoTouch . Foundation . Preserve ]
715+ [ Preserve ]
712716 public static void RegisterTypeForAot < T > ( )
713717 {
714718 AotConfig . RegisterSerializers < T > ( ) ;
715719 }
716720
717- [ MonoTouch . Foundation . Preserve ]
721+ [ Preserve ]
718722 public static void RegisterQueryStringWriter ( )
719723 {
720724 var i = 0 ;
721725 if ( QueryStringWriter < Poco > . WriteFn ( ) != null ) i ++ ;
722726 }
723727
724- [ MonoTouch . Foundation . Preserve ]
728+ [ Preserve ]
725729 public static int RegisterElement < T , TElement > ( )
726730 {
727731 var i = 0 ;
@@ -734,7 +738,7 @@ public static int RegisterElement<T, TElement>()
734738 ///<summary>
735739 /// Class contains Ahead-of-Time (AOT) explicit class declarations which is used only to workaround "-aot-only" exceptions occured on device only.
736740 /// </summary>
737- [ MonoTouch . Foundation . Preserve ( AllMembers = true ) ]
741+ [ Preserve ( AllMembers = true ) ]
738742 internal class AotConfig
739743 {
740744 internal static JsReader < JsonTypeSerializer > jsonReader ;
0 commit comments