Bug 3904 - [MethodImpl(MethodImplOptions.Synchronized)] causes hard crash on AppStore Distribution build.
Summary: [MethodImpl(MethodImplOptions.Synchronized)] causes hard crash on AppStore Di...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-03-15 00:25 UTC by David N. Junod
Modified: 2013-01-29 16:01 UTC (History)
4 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 David N. Junod 2012-03-15 00:25:13 UTC
Using [MethodImpl(MethodImplOptions.Synchronized)] causes a hard crash on AppStore Distribution build.

		private static Location mInstance = null;
		
		[MethodImpl(MethodImplOptions.Synchronized)]
		public static Location getInstance() {
			if (mInstance == null)
				mInstance = new Location();
			return mInstance;
		}

Use LLVM optimizing compiler, ARMv6 + ARMv7

Commenting out the Synchronized attribute allows the code to run.
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-03-15 04:41:54 UTC
Do you have a crash report for this? And it only happens with a distribution build (i.e. can you enable the same project options (llvm/armv6/7, etc) for a debug build to see if it crashes too?)
Comment 2 Sebastien Pouliot 2012-03-15 08:13:25 UTC
https://bugzilla.novell.com/show_bug.cgi?id=562272

not sure about the current status, c.c. Zoltan
Comment 3 Zoltan Varga 2012-03-15 09:33:00 UTC
It should be supported.
Comment 4 David N. Junod 2012-03-17 14:50:55 UTC
LLVM optimizing compiler, ARMv6 + ARMv7 is not compatible with Debug (can't do both).
Comment 5 Sebastien Pouliot 2012-03-18 19:12:57 UTC
Zoltan, I added a test case (based on the above) in git (linksdk project) that crash when LLVM is enabled and works without it.

master: 6cc946acf3b1dac883d42206d486a791124e04a8
Comment 6 Zoltan Varga 2012-03-19 00:01:36 UTC
This happens because the synchronized method and its wrapper share a plt entry, so the wrapper ends up calling itself recursively, leading to a crash.
Comment 7 Zoltan Varga 2012-03-19 00:51:47 UTC
This has been fixed in master, however it depends on infrastructure code which is not present in 2.10, so it would be a bit complex to backport it to mt.
Comment 8 Zoltan Varga 2013-01-29 16:01:03 UTC
-> backported to mobile-master.