Created attachment 91 [details]
Interlocked.Exchange<T> crashes app on device (I have iPod4)
others Interlocked.XXX worked
- create windows-based app for iPhone
- add variables to AppDelegate
string str = null;
- insert first line of code in AppDelegate.FinishedLaunching
Interlocked.Exchange( ref str, "one" );
Confirmed. It happens with, or without, the linker being enabled.
Not sure why the AOT compiler is not able to detect and compile a string version of this call.
Reducing the severity to Normal since you can use the non-generic overload that accept System.Object to pass string instances as a workaround.
That same issue has hit other people (before 18.104.22.168)
It looks like AOT is well aware of the generic type to use:
imac:Keychain sebastienpouliot$ MONO_PATH=/Users/sebastienpouliot/git/monotouch-samples/Keychain/Keychain/bin/iPhone/Debug/Keychain.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --debug --aot=full,static,asmonly,soft-debug,iphone-abi,outfile=Keychain.exe.6.s -v -v "/Users/sebastienpouliot/git/monotouch-samples/Keychain/Keychain/bin/iPhone/Debug/Keychain.app/Keychain.exe" | grep Interlock
call R202 <- [System.Threading.Interlocked:Exchange<string> (string&,string)] [arm_r0 <- R203] [arm_r1 <- R204] [arm_v5 <- R201] clobbers: c
So I wonder if this could be a (undocumented) AOT (or full-AOT) restriction wrt internal calls:
[ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
public extern static T Exchange<T> (ref T location1, T value) where T:class;
Fixed by 79b99d358b1321759ea3a42f22eaf141aecf0e79 on the mono 2.10 branch.
Thanks Zoltan! I'll test the fix and include it into monotouch.
Thanks for the test case!