Bug 43637 - [Custom controls] Custom control exception in ctor crash process on API level 23
Summary: [Custom controls] Custom control exception in ctor crash process on API level 23
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Designer (show other bugs)
Version: 6.1.0 (C8)
Hardware: PC Mac OS
: High major
Target Milestone: (C8)
Assignee: Jérémie Laval
Depends on:
Reported: 2016-08-22 22:31 UTC by Jérémie Laval
Modified: 2016-08-25 17:12 UTC (History)
3 users (show)

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


Description Jérémie Laval 2016-08-22 22:31:17 UTC
If a custom control throws an exception in its constructor the rendering process crashes with a NullPointerException when rendering on Android API level 23 (and 24).

Expected: the custom control exception should be caught and a red mock view displayed instead. http://screencast.com/t/RGDn3DE90ec8
Comment 1 xamarin-release-manager 2016-08-22 22:43:09 UTC
Fixed in version (master)

Author: J??r??mie Laval
Commit: 223703b4652f4bdd40ac2d46814139964f87cfde (xamarin/md-addins)
Included in Commit: 7b59eb69bf4b518c00db3521ab3b5b4166046583 (mono/monodevelop)
Comment 2 Jérémie Laval 2016-08-23 12:34:32 UTC
Repro steps:

- Create new Android project
- Create new custom view
- Fill `Initialize` method with a `throw new Exception ("foo")`
- Compile project
- Open Main.axml in designer
- Drop element in layout

+ restart Xamarin Studio and open the solution and layout with the faulty custom control already in it.
Comment 4 Jatin 2016-08-24 11:47:30 UTC
I have checked this issue with the latest Cycle 8 builds:

And I have observed that the issue still exist, as after adding the custom view in the designer, when close and re-open the android designer, exception appears.

Below are the steps I followed:

1. Create new Android project
2. Create new custom view
3. Fill "Initialize" method with a "throw new Exception ("foo");"
4. Compile project
5. Open Main.axml in designer
6. Drop CustomView element in layout
7. Close the Main.axml
8. Again open Main.axml

Re-opning this issue w.r.t Cycle 8. Once the fix is merged in Cycle 8, I will verify and close this issue.
Comment 5 Jérémie Laval 2016-08-25 15:46:14 UTC
This has been backported to cycle8.

md-addins: 77f78f130d4fa544a10101c6dc1cd88997cc5cbc
Included in monodevelop: 2b65e9bec34bade4893b7a28b5cfd5836db6e4db
Comment 6 Sunil Kumar 2016-08-25 17:12:12 UTC
I have checked this issue with latest C8 XS and observed that now this issue  is working fine and showing the expected behavior. Now custom control mock view is displaying when rendering the designer on Android API level 23 (and below also) and the custom control exception is showing in IDE log.

Screencast: http://www.screencast.com/t/cDPOxHf7Gw

Hence closing this issue. 

Environment info:

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