Bug 9628 - MonoTouch debug not building with ServiceStack.Text (AOT error)
Summary: MonoTouch debug not building with ServiceStack.Text (AOT error)
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-01-16 17:50 UTC by Dylan
Modified: 2013-07-28 17:46 UTC (History)
9 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Dylan 2013-01-16 17:50:05 UTC
I have just started using the ServiceStack.Text.MonoTouch.dll in my MonoTouch solution. Everything compiles and runs in the simulator, but as soon as I try to run a Debug build on the phone the compilation process dies with the following error: error MT3001: Could not AOT the assembly '.../ServiceStack.Text.MonoTouch.dll'

I have read this is due to the ServiceStack.Text dll being too large or something along those lines. So I tried in release mode and things work due to LLVM being on and the linker being turned to 'Link SDK assemblies only'.

This is problematic as I now am unable to debug on the device. In debug mode I have tried all the linker options, and LLVM is turned off. Is there any way around this?

MT 6.0.8 & latest version of ServiceStack dll's off Github.




Copying content files
Copying '/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/Images/icon@2x.png' to '/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/icon@2x.png'
Build complete -- 0 errors, 2 warnings

Compiling to native code
/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" -v --cache "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/obj/Debug/mtouch-cache" --nomanifest --nosign -dev "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app" -r "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel.BusinessLogic/bin/Debug/Travel.BusinessLogic.dll" -r "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel.Common/bin/Debug/Travel.Common.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/MonoTouch.Dialog-1.dll" -r "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Newtonsoft.Json.MonoTouch.dll" -debug -profiling -sdk "6.0" -targetver "5.0" --sgen --abi=armv7 "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.exe"
MonoTouch version 6.0.8 using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk
Copied /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.exe to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/Travel.exe
Copied /Developer/MonoTouch/usr/lib/mono/2.1/mscorlib.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/mscorlib.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/monotouch.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/System.Core.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/System.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Security.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/Mono.Security.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/System.Xml.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/MonoTouch.Dialog-1.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/MonoTouch.Dialog-1.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Json.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/System.Json.dll
Copied /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel.BusinessLogic/bin/Debug/Travel.BusinessLogic.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/Travel.BusinessLogic.dll
Copied /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel.Common/bin/Debug/Travel.Common.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/Travel.Common.dll
Copied /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/ServiceStack.Common.MonoTouch.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/ServiceStack.Common.MonoTouch.dll
Copied /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/ServiceStack.Interfaces.MonoTouch.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/ServiceStack.Interfaces.MonoTouch.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Runtime.Serialization.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/System.Runtime.Serialization.dll
Copied /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/ServiceStack.Text.MonoTouch.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/ServiceStack.Text.MonoTouch.dll
Copied /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Newtonsoft.Json.MonoTouch.dll to /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/Newtonsoft.Json.MonoTouch.dll
Linking assembly /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.exe into /Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app
MONO_PATH="/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app" /Developer/MonoTouch/usr/bin/arm-darwin-mono-sgen --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,soft-debug,no-direct-calls,iphone-abi,outfile=/var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/ServiceStack.Common.MonoTouch.dll.armv7.s "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/ServiceStack.Common.MonoTouch.dll"
MONO_PATH="/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app" /Developer/MonoTouch/usr/bin/arm-darwin-mono-sgen --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,no-direct-calls,iphone-abi,outfile=/var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/MonoTouch.Dialog-1.dll.armv7.s "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/MonoTouch.Dialog-1.dll"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  -miphoneos-version-min=5.0 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/ServiceStack.Common.MonoTouch.dll.armv7.s -o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/ServiceStack.Common.MonoTouch.dll.armv7.o
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  -miphoneos-version-min=5.0 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/MonoTouch.Dialog-1.dll.armv7.s -o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/MonoTouch.Dialog-1.dll.armv7.o
MONO_PATH="/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app" /Developer/MonoTouch/usr/bin/arm-darwin-mono-sgen --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,soft-debug,no-direct-calls,iphone-abi,outfile=/var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/Travel.BusinessLogic.dll.armv7.s "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/Travel.BusinessLogic.dll"
MONO_PATH="/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app" /Developer/MonoTouch/usr/bin/arm-darwin-mono-sgen --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,no-direct-calls,iphone-abi,outfile=/var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/System.Runtime.Serialization.dll.armv7.s "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/System.Runtime.Serialization.dll"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  -miphoneos-version-min=5.0 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/System.Runtime.Serialization.dll.armv7.s -o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/System.Runtime.Serialization.dll.armv7.o
MONO_PATH="/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app" /Developer/MonoTouch/usr/bin/arm-darwin-mono-sgen --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,soft-debug,no-direct-calls,iphone-abi,outfile=/var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/ServiceStack.Text.MonoTouch.dll.armv7.s "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/ServiceStack.Text.MonoTouch.dll"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  -miphoneos-version-min=5.0 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/Travel.BusinessLogic.dll.armv7.s -o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/Travel.BusinessLogic.dll.armv7.o
MONO_PATH="/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app" /Developer/MonoTouch/usr/bin/arm-darwin-mono-sgen --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,soft-debug,no-direct-calls,iphone-abi,outfile=/var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/Travel.Common.dll.armv7.s "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/Travel.Common.dll"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  -miphoneos-version-min=5.0 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/Travel.Common.dll.armv7.s -o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/Travel.Common.dll.armv7.o
MONO_PATH="/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app" /Developer/MonoTouch/usr/bin/arm-darwin-mono-sgen --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,no-direct-calls,iphone-abi,outfile=/var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/monotouch.dll.armv7.s "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/monotouch.dll"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  -miphoneos-version-min=5.0 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/monotouch.dll.armv7.s -o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/monotouch.dll.armv7.o
MONO_PATH="/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app" /Developer/MonoTouch/usr/bin/arm-darwin-mono-sgen --debug --aot=mtriple=armv7-darwin,full,static,asmonly,direct-icalls,soft-debug,no-direct-calls,iphone-abi,outfile=/var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/Newtonsoft.Json.MonoTouch.dll.armv7.s "/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/Newtonsoft.Json.MonoTouch.dll"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  -miphoneos-version-min=5.0 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/Newtonsoft.Json.MonoTouch.dll.armv7.s -o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/Newtonsoft.Json.MonoTouch.dll.armv7.o
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  -miphoneos-version-min=5.0 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/ServiceStack.Text.MonoTouch.dll.armv7.s -o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/ServiceStack.Text.MonoTouch.dll.armv7.o
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  -miphoneos-version-min=5.0 -arch armv7  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/ServiceStack.Text.MonoTouch.dll.armv7.s -o /var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/ServiceStack.Text.MonoTouch.dll.armv7.o
/var/folders/g2/j4prljqd2w58pfd2bf0hm9pc0000gn/T/tmp61682b2e.tmp/ServiceStack.Text.MonoTouch.dll.armv7.s:unknown:FATAL:Section too large, can't encode r_address (0x1063298) into 24-bits of scattered relocation entry

error MT3001: Could not AOT the assembly '/Users/dylanvdmerwe/Desktop/Projects/Travel App/trunk/Travel.MT/Travel/bin/iPhone/Debug/Travel.app/ServiceStack.Text.MonoTouch.dll'

---------------------- Done ----------------------
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-01-17 05:33:08 UTC
Please try to change your linker settings to "Link all assemblies" in the project's iPhone Build options to see if that fixes the issue.
Comment 2 Dylan 2013-01-17 06:32:04 UTC
As stated above, I have tried all of the linker options and all of them give me the AOT error. The only way I can get the project to build is in release mode with LLVM enabled. In release mode the linker is set to link sdk assemblies only and it works.
Comment 3 Dylan 2013-01-21 10:49:04 UTC
As much info as I can has been provided.
Comment 4 Sebastien Pouliot 2013-01-23 09:42:57 UTC
I think you're near the 24-bits limits in your release builds (LLVM builds are optimized so it might be able to fit more into that limit). OTOH debug builds generates more code and that might jumps over the limit, leading to the MT3001 errors.

Also (and unlike other cases) using "Link all" does not help very much with ServiceStack.Text. That because the assembly is MonoTouch-aware and [Preserve] everything it _may_ need (including every type of serializer even if your app only use of them). 

In general that's a good thing (you won't get a runtime exception for non-AOT'ed code) but it's a bit extreme in this case as it will make the AOT compiler generate a *LOT* of code that might not be needed (e.g. generic collections for sbyte, sbyte? ... even if 'unsigned byte' is not commonly used in .NET apps).
Comment 5 Dylan 2013-01-27 15:22:41 UTC
I understand, however this means that when using this ServiceStack dll you will not be able to debug your app on the device. This becomes hugely problematic. Is there nothing that can be done?
Comment 6 Zoltan Varga 2013-01-27 16:54:25 UTC
There is a RegisterForAot () method in JsConfig.cs, you can try removing some line from there, particularly the '?' types, i.e. RegisterElement<Poco, decimal?>. That will make the generated code smaller, and hopefully still allow your application to work.
Comment 7 Dylan 2013-01-30 08:30:28 UTC
I still find it weird that in Release mode it compiles but debug mode I get the AOT error on build. Surely there must be something we can do to enable debug builds in this circumstance?
Comment 8 Zoltan Varga 2013-01-30 10:44:57 UTC
The debug code is bigger than the release code, leading to this error.
Comment 9 Geoffrey Huntley 2013-02-17 21:55:11 UTC
Ran into this one as well, exactly re: exploding the 24-bit limit, working on release but not debug. This was resolved by compiling my own version of ServiceStack.Tex, removing registration of generic datatypes which are not used within my client/server projects.

diff --git a/src/ServiceStack.Text/JsConfig.cs b/src/ServiceStack.Text/JsConfig.cs
index 1bbf1eb..ecf1966 100644
--- a/src/ServiceStack.Text/JsConfig.cs
+++ b/src/ServiceStack.Text/JsConfig.cs
@@ -487,30 +487,16 @@ public static void RegisterForAot()
             RegisterElement<Poco, string>();
 
             RegisterElement<Poco, bool>();
-            RegisterElement<Poco, char>();
-            RegisterElement<Poco, byte>();
-            RegisterElement<Poco, sbyte>();
-            RegisterElement<Poco, short>();
-            RegisterElement<Poco, ushort>();
             RegisterElement<Poco, int>();
-            RegisterElement<Poco, uint>();
 
                        RegisterElement<Poco, long>();
-            RegisterElement<Poco, ulong>();
             RegisterElement<Poco, float>();
             RegisterElement<Poco, double>();
             RegisterElement<Poco, decimal>();
 
             RegisterElement<Poco, bool?>();
-            RegisterElement<Poco, char?>();
-            RegisterElement<Poco, byte?>();
-            RegisterElement<Poco, sbyte?>();
-            RegisterElement<Poco, short?>();
-            RegisterElement<Poco, ushort?>();
             RegisterElement<Poco, int?>();
-            RegisterElement<Poco, uint?>();
             RegisterElement<Poco, long?>();
-            RegisterElement<Poco, ulong?>();
             RegisterElement<Poco, float?>();
             RegisterElement<Poco, double?>();
             RegisterElement<Poco, decimal?>();
Comment 10 baramuse 2013-02-22 03:15:43 UTC
Same thing here. works on release and not debut even with "Link all". As long as "enable debugging" is ticked, it won't AOT-compile.
I tried Geoffrey Huntley 's solution by disabling the unused types registration, and eve tried not to register jsv and csv serializers but with no luck, still can't compile in debug.
I'd reaaally want to use servicestack.text in monotouch as it's mandatory to be able to reuse servicemodels classes with the servicestack json client...

qdiff --git a/src/ServiceStack.Text/JsConfig.cs b/src/ServiceStack.Text/JsConfig.cs
index 1bbf1eb..1cdbf57 100644
--- a/src/ServiceStack.Text/JsConfig.cs
+++ b/src/ServiceStack.Text/JsConfig.cs
@@ -487,28 +487,28 @@ public static void RegisterForAot()
             RegisterElement<Poco, string>();
 
             RegisterElement<Poco, bool>();
-            RegisterElement<Poco, char>();
-            RegisterElement<Poco, byte>();
-            RegisterElement<Poco, sbyte>();
             RegisterElement<Poco, short>();
-            RegisterElement<Poco, ushort>();
             RegisterElement<Poco, int>();
-            RegisterElement<Poco, uint>();
 
 	RegisterElement<Poco, long>();
-            RegisterElement<Poco, ulong>();
             RegisterElement<Poco, float>();
             RegisterElement<Poco, double>();
             RegisterElement<Poco, decimal>();
 
             RegisterElement<Poco, bool?>();
-            RegisterElement<Poco, char?>();
-            RegisterElement<Poco, byte?>();
-            RegisterElement<Poco, sbyte?>();
             RegisterElement<Poco, short?>();
-            RegisterElement<Poco, ushort?>();
             RegisterElement<Poco, int?>();
-            RegisterElement<Poco, uint?>();
             RegisterElement<Poco, long?>();
             RegisterElement<Poco, ulong?>();
             RegisterElement<Poco, float?>();
@@ -520,12 +520,12 @@ public static void RegisterForAot()
 			RegisterTypeForAot<DayOfWeek>(); // used by DateTime
 
 			// register built in structs
-			RegisterTypeForAot<Guid>();
 			RegisterTypeForAot<TimeSpan>();
 			RegisterTypeForAot<DateTime>();
 			RegisterTypeForAot<DateTime?>();
 			RegisterTypeForAot<TimeSpan?>();
-			RegisterTypeForAot<Guid?>();
         }
 
 		[MonoTouch.Foundation.Preserve]
@@ -559,19 +559,19 @@ internal class AotConfig
 		{
 			internal static JsReader<JsonTypeSerializer> jsonReader;
 			internal static JsWriter<JsonTypeSerializer> jsonWriter;
-			internal static JsReader<JsvTypeSerializer> jsvReader;
-			internal static JsWriter<JsvTypeSerializer> jsvWriter;
 			internal static JsonTypeSerializer jsonSerializer;
-			internal static JsvTypeSerializer jsvSerializer;
 
 			static AotConfig()
 			{
 				jsonSerializer = new JsonTypeSerializer();
-				jsvSerializer = new JsvTypeSerializer();
 				jsonReader = new JsReader<JsonTypeSerializer>();
 				jsonWriter = new JsWriter<JsonTypeSerializer>();
-				jsvReader = new JsReader<JsvTypeSerializer>();
-				jsvWriter = new JsWriter<JsvTypeSerializer>();
 			}
 
 			internal static int RegisterSerializers<T>()
@@ -583,11 +583,11 @@ internal static int RegisterSerializers<T>()
 				if (jsonReader.GetParseFn<T>() != null) i++;
 				if (jsonWriter.GetWriteFn<T>() != null) i++;
 
-				i += Register<T, JsvTypeSerializer>();
-				if (jsvSerializer.GetParseFn<T>() != null) i++;
-				if (jsvSerializer.GetWriteFn<T>() != null) i++;
-				if (jsvReader.GetParseFn<T>() != null) i++;
-				if (jsvWriter.GetWriteFn<T>() != null) i++;
 
 
 				//RegisterCsvSerializer<T>();
@@ -595,13 +595,13 @@ internal static int RegisterSerializers<T>()
 				return i;
 			}
 
-			internal static void RegisterCsvSerializer<T>()
-			{
-				CsvSerializer<T>.WriteFn();
-				CsvSerializer<T>.WriteObject(null, null);
-				CsvWriter<T>.Write(null, default(IEnumerable<T>));
-				CsvWriter<T>.WriteRow(null, default(T));
-			}
 
 			public static ParseStringDelegate GetParseFn(Type type)
 			{
Comment 11 Dylan 2013-07-08 09:29:00 UTC
Would the alpha versions of MT help with this issue?
Comment 12 Sebastien Pouliot 2013-07-08 10:06:21 UTC
Alpha ? no: The current (6.9.x) alpha's goal is to target ios7. IOW it's identical to the beta release (no change to the AOT compiler).

The 6.3.x beta _might_ help. The "generic shared value-type" feature of 6.3.x means there's less need to "help" the AOT compiler with code like comment #9 and #10.

Removing that unneeded code (there's gonna be trial and error to do so) will allow:

(a) the (managed) linker (Link all) to remove more code (as there won't be any reference anymore to some types); and

(b) the AOT compiler to compile less code (less input, less output);

At some point you should get below the threshold where it will be possible to produce a debug build.
Comment 13 Dylan 2013-07-28 17:17:43 UTC
Looks as though the latest Xamarin.iOS 6.4 version allows the ServiceStack dll's to build in debug mode without any AOT errors.
Comment 14 Zoltan Varga 2013-07-28 17:46:49 UTC
-> fixed.