This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 37273 - Exceptions caught in incorrect catch blocks on LLVM builds
Summary: Exceptions caught in incorrect catch blocks on LLVM builds
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler (show other bugs)
Version: XI 9.4 (iOS 9.2)
Hardware: PC Mac OS
: --- normal
Target Milestone: C6SR2
Assignee: Zoltan Varga
URL:
: 37744 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-12-23 23:51 UTC by Cody
Modified: 2016-03-03 16:37 UTC (History)
10 users (show)

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


Attachments

Description Cody 2015-12-23 23:51:12 UTC
### Description 

This is most likely a Mono bug, however I wanted to file it against the most external product for engineering to review 

The following sample demonstrates an issue where the incorrect catch block will handle an exception when LLVM is used

### Sample

https://www.dropbox.com/s/dj1pfv703ouu1dd/TestException.zip?dl=0

### Error Details

https://gist.github.com/CodyBeyer/7252666aa40bfe93d744

### Steps to Reproduce

1. Download Sample
2. Ensure LLVM is enabled, and device is targeted
3. Run on device
4. Review device log in Xcode

### Expected Results

Handled as demonstrated in the first block of linked gist

### Actual Results

Handled as demonstrated in 2nd block of linked gist

### Versions

=== Xamarin Studio ===

Version 5.10.2 (build 49)
Installation UUID: 898b546d-da31-47aa-aa48-67c373406277
Runtime:
	Mono 4.2.2 (explicit/7b87787)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402020010

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 6.0.1.5 (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.2 (9548)
Build 7C68

=== Xamarin.iOS ===

Version: 9.4.1.12 (Business Edition)
Hash: 78c6cd3
Branch: master
Build date: 2015-12-17 18:29:42-0500

=== Xamarin.Mac ===

Version: 2.4.1.5 (Business Edition)

=== Build Information ===

Release ID: 510020049
Git revision: deed4cd240ff3611c8742bbc62296e207f46173d
Build date: 2015-12-17 11:13:36-05
Xamarin addins: 8bd975e7b465f6fe812b64d736f3b7e8c1a79a3e
Build lane: monodevelop-lion-cycle6-c6sr1

=== Operating System ===

Mac OS X 10.11.2
Darwin beyerstudios.local 15.2.0 Darwin Kernel Version 15.2.0
    Fri Nov 13 19:56:56 PST 2015
    root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
Comment 1 chorsfield 2015-12-28 21:22:43 UTC
This regressed with 9.2.1.51 Xamarin.IOS. It was working fine on 9.1.0.31
This causes major logic issues in basic try \ catch code blocks within code.
Comment 2 Zoltan Varga 2016-01-02 02:49:00 UTC
Reduced testcase:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 private static Task ATask(Task taskFunction)
 {
	 return Task.Run(async () => {
			 try {
				 await taskFunction;
			 } catch (DivideByZeroException ex) {
				 Console.WriteLine ("FAIL: " + ex);
			 }
		 });
 }
							
	public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
	{
		try {
			Task t = new Task (delegate () { throw new Exception(); });
			t.Start ();
			Task task = ATask(t);
			task.Wait();
		} catch (Exception ex) {
			Console.WriteLine ("OK.");
		}
		return true;
         }
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Comment 3 Zoltan Varga 2016-01-02 03:12:04 UTC
Should be fixed by mono 81e1e072c89873243a6c4cc9263ddf2c8658f312.

This could be backported to a service release.
Comment 5 Brendan Zagaeski (Xamarin Support) 2016-01-07 18:14:34 UTC
## Regression status: regression in Cycle 6

I can confirm the result from Comment 1 using the test case from Comment 2: this bug is a regression between Cycle 5 SR 5 and Cycle 6.

BAD:  Xamarin.iOS 9.4.1.12 (78c6cd3)
BAD:  Xamarin.iOS 9.2.1.51 (3c0ec35)
GOOD: Xamarin.iOS 9.1.0.27 (1f068b4)
Comment 7 Zoltan Varga 2016-01-18 15:57:45 UTC
*** Bug 37744 has been marked as a duplicate of this bug. ***
Comment 8 Grigory (Playtika) 2016-01-18 16:00:47 UTC
When will it be public released ?
Comment 9 Brendan Zagaeski (Xamarin Support) 2016-01-18 18:35:36 UTC
The timeline for the "C6SR2" ("Cycle 6 – Service Release 2") target milestone of this bug is currently under planning. There should be more news about the timeline once the current Alpha "Service Release 1" is promoted to stable (tentatively within the next couple of weeks).

If more discussion on possible release dates is desired, please get in touch via a "Business & Enterprise Support" [1] email.

[1] https://xamarin.com/support
Comment 11 GouriKumari 2016-03-03 16:37:24 UTC
Based on comment #10, I am closing this bug as verified fixed.

Note You need to log in before you can comment on or make changes to this bug.