Application Crashing with No exception getting caught

ApurvaGoyalApurvaGoyal USMember ✭✭
edited April 2015 in Xamarin.Forms

I am very near to publishing the app-however some testing has exposed some very critical crashing. I have a main menu from where user can navigate to screen A. When user navigates to screen A and hit back button on top left to go to main menu again. I can repeat this process 3-4 times and app crashes. This is really critical as I have seen this with all screens. I have even tried placing try catches everywhere but none of the catch blocks are hit.

One common thing I have noticed with this crash is that ScreenA has a listview with a custom layout that includes both images (from url and included resources) and text. Any screen with a listview with just built in textview cell doesnt crash. Also this custom layout includes lots of stack layouts. Here is the code-

public class wpCatalogItemCellStyle2:ViewCell
private Image _image;
public wpCatalogItemCellStyle2 ()
View = GetLayout ();

    protected override void OnBindingContextChanged ()
        base.OnBindingContextChanged ();
        if (_image != null)
            _image.Source = new UriImageSource () {
            Uri=new Uri((this.BindingContext as ItemOrder).ImageUri),
            CacheValidity=new TimeSpan(1,0,0)

    private StackLayout GetLayout(){
        try {
            var parentLayout = new StackLayout{ Padding=5};
            var grid = GetGrid ();
            parentLayout.Children.Add (grid);
            return parentLayout;
        } catch (Exception ex) {
            string s = ex.Message;
            return null;


    private Grid GetGrid(){
        Grid grid = new Grid {

                new ColumnDefinition{Width=GridLength.Auto},
                new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                new ColumnDefinition{Width=GridLength.Auto}
                new RowDefinition{Height=GridLength.Auto}


        grid.Children.Add (GetImageAndRecepieLayout(), 0, 0);
        grid.Children.Add (GetItemDetailsLayout(), 1, 0);
        grid.Children.Add (GetPriceAndButtonLayout(), 2, 0);

        return grid;

    private StackLayout GetImageAndRecepieLayout(){
        var layout = new StackLayout (){ Spacing = 5, VerticalOptions=LayoutOptions.FillAndExpand };
        _image = new Image
            HorizontalOptions = LayoutOptions.Start,
        _image.WidthRequest = 70;
        _image.HeightRequest = 70;
        _image.Aspect = Aspect.AspectFit;
        _image.VerticalOptions = LayoutOptions.Center;

        var tapGestureRecognizer = new TapGestureRecognizer();
        tapGestureRecognizer.Tapped += (s, e) => {
            // handle the tap
            //send message to open big image window
            ItemOrder order=(s as Image).BindingContext as ItemOrder;
            IFullImageUriProvider imageUrlProvider=Resolver.Resolve<IFullImageUriProvider>();
            MessagingCenter.Send<ShowFullImageViewMessage> (new ShowFullImageViewMessage(order.ImageUri), "showfullimage");
        layout.Children.Add (_image);

        #region Recepie
        var recepieLabel = new ExtendedLabel (){ Text = Constants.ViewRecipeText,IsUnderline=true, VerticalOptions=LayoutOptions.EndAndExpand };
        recepieLabel.SetBinding (ExtendedLabel.IsVisibleProperty, new Binding ("IsRecepieAvailable", BindingMode.TwoWay));
        recepieLabel.Font=Font.SystemFontOfSize (11);
        var recepieGestureRecognizer = new TapGestureRecognizer();
        recepieGestureRecognizer.Tapped += (s, e) => {
            // handle the tap
            //send message to open big image window

        layout.Children.Add (recepieLabel);

        return layout;

I am using Xamarin.Forms.Labs MVVM to navigate to view models. Also I am testing this on Samsung Galaxy S3 and am using Xamarin.Forms 1.4.0. Here is the

This is really critical for us for releasing this business app. Any help on this will be really very helpful.




Sign In or Register to comment.