25
25
#if ! __IOS__
26
26
using System . Reflection . Emit ;
27
27
using FastMember = ServiceStack . Text . FastMember ;
28
+ #elif __IOS10__
29
+ using Preserve = Foundation . PreserveAttribute ;
30
+ #else
31
+ using Preserve = MonoTouch . Foundation . PreserveAttribute ;
28
32
#endif
29
33
30
34
namespace ServiceStack
@@ -39,7 +43,7 @@ public Net40PclExport()
39
43
this . DirSep = Path . DirectorySeparatorChar ;
40
44
this . AltDirSep = Path . DirectorySeparatorChar == '/' ? '\\ ' : '/' ;
41
45
this . RegexOptions = RegexOptions . Compiled ;
42
- this . InvariantComparison = StringComparison . InvariantCulture ;
46
+ this . InvariantComparison = StringComparison . InvariantCulture ;
43
47
this . InvariantComparisonIgnoreCase = StringComparison . InvariantCultureIgnoreCase ;
44
48
this . InvariantComparer = StringComparer . InvariantCulture ;
45
49
this . InvariantComparerIgnoreCase = StringComparer . InvariantCultureIgnoreCase ;
@@ -123,7 +127,7 @@ public override void WriteLine(string format, params object[] args)
123
127
124
128
public override void AddCompression ( WebRequest webReq )
125
129
{
126
- var httpReq = ( HttpWebRequest ) webReq ;
130
+ var httpReq = ( HttpWebRequest ) webReq ;
127
131
httpReq . Headers . Add ( HttpRequestHeader . AcceptEncoding , "gzip,deflate" ) ;
128
132
httpReq . AutomaticDecompression = DecompressionMethods . GZip | DecompressionMethods . Deflate ;
129
133
}
@@ -295,7 +299,7 @@ internal static void SetField<TValue>(ref TValue field, TValue newValue)
295
299
{
296
300
field = newValue ;
297
301
}
298
-
302
+
299
303
public override PropertySetterDelegate GetFieldSetterFn ( FieldInfo fieldInfo )
300
304
{
301
305
if ( ! SupportsExpression )
@@ -341,7 +345,7 @@ public override PropertyGetterDelegate GetFieldGetterFn(FieldInfo fieldInfo)
341
345
342
346
var fieldGetterFn = Expression . Lambda < PropertyGetterDelegate >
343
347
(
344
- oExprCallFieldGetFn ,
348
+ oExprCallFieldGetFn ,
345
349
oInstanceParam
346
350
)
347
351
. Compile ( ) ;
@@ -434,7 +438,7 @@ public override ParseStringDelegate GetJsReaderParseMethod<TSerializer>(Type typ
434
438
return DeserializeDynamic < TSerializer > . Parse ;
435
439
}
436
440
#endif
437
- return null ;
441
+ return null ;
438
442
}
439
443
440
444
public override XmlSerializer NewXmlSerializer ( )
@@ -472,7 +476,7 @@ public override LicenseKey VerifyLicenseKeyText(string licenseKeyText)
472
476
public override void VerifyInAssembly ( Type accessType , ICollection < string > assemblyNames )
473
477
{
474
478
//might get merged/mangled on alt platforms
475
- if ( assemblyNames . Contains ( accessType . Assembly . ManifestModule . Name ) )
479
+ if ( assemblyNames . Contains ( accessType . Assembly . ManifestModule . Name ) )
476
480
return ;
477
481
478
482
try
@@ -618,7 +622,7 @@ private static DynamicMethod CreateDynamicSetMethod(MemberInfo memberInfo)
618
622
}
619
623
620
624
#if __IOS__
621
- [ MonoTouch . Foundation . Preserve ( AllMembers = true ) ]
625
+ [ Preserve ( AllMembers = true ) ]
622
626
internal class Poco
623
627
{
624
628
public string Dummy { get ; set ; }
@@ -654,12 +658,12 @@ public override void ResetStream(Stream stream)
654
658
/// Provide hint to IOS AOT compiler to pre-compile generic classes for all your DTOs.
655
659
/// Just needs to be called once in a static constructor.
656
660
/// </summary>
657
- [ MonoTouch . Foundation . Preserve ]
661
+ [ Preserve ]
658
662
public static void InitForAot ( )
659
663
{
660
664
}
661
665
662
- [ MonoTouch . Foundation . Preserve ]
666
+ [ Preserve ]
663
667
public override void RegisterForAot ( )
664
668
{
665
669
RegisterTypeForAot < Poco > ( ) ;
@@ -708,20 +712,20 @@ public override void RegisterForAot()
708
712
RegisterTypeForAot < Guid ? > ( ) ;
709
713
}
710
714
711
- [ MonoTouch . Foundation . Preserve ]
715
+ [ Preserve ]
712
716
public static void RegisterTypeForAot < T > ( )
713
717
{
714
718
AotConfig . RegisterSerializers < T > ( ) ;
715
719
}
716
720
717
- [ MonoTouch . Foundation . Preserve ]
721
+ [ Preserve ]
718
722
public static void RegisterQueryStringWriter ( )
719
723
{
720
724
var i = 0 ;
721
725
if ( QueryStringWriter < Poco > . WriteFn ( ) != null ) i ++ ;
722
726
}
723
727
724
- [ MonoTouch . Foundation . Preserve ]
728
+ [ Preserve ]
725
729
public static int RegisterElement < T , TElement > ( )
726
730
{
727
731
var i = 0 ;
@@ -734,7 +738,7 @@ public static int RegisterElement<T, TElement>()
734
738
///<summary>
735
739
/// Class contains Ahead-of-Time (AOT) explicit class declarations which is used only to workaround "-aot-only" exceptions occured on device only.
736
740
/// </summary>
737
- [ MonoTouch . Foundation . Preserve ( AllMembers = true ) ]
741
+ [ Preserve ( AllMembers = true ) ]
738
742
internal class AotConfig
739
743
{
740
744
internal static JsReader < JsonTypeSerializer > jsonReader ;
0 commit comments