Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 77050 articles
Browse latest View live

apk from Xamarin.Forms keeps crashing

$
0
0

Hi All,

Unfortunately when I load my apk onto a physical device, it crashes immediately. I have been playing around trying to figure out what is happening, and here are my observations:

1) If I set linking to 'none', it works. So clearly the problem has to do with the linking. However, this is clearly not a viable solution.

2) In debug mode, if I enable proguard and turn linking on, the app still works fine.

3) If I make a new blank Xamarin.Forms app, then follow the instructions to release the apk for Android, the same problem occurs (the app immediately crashes).

4) If I make a blank Xamarin.Android app, then follow the instructions, the apk works fine.

It is very difficult to troubleshoot without knowing why the App is crashing. Do you have any suggestions as to what is occurring, or how I can get a log file on my physical device to understand why the Xamarin.Forms version of the Android apk fails, when the Xamarin.Android version works fine?

Thanks,

Dustin


How to rate google play app in application?

$
0
0

I want to rate my application directly in my app how can i make this?
Device.OpenUri(new Uri("details?id=packagename"));
with this i open in browser but i want to rate directly inside of the app

Create a custom renderer for Frame with unique corner radius values [Xamarin.Forms]

$
0
0

I need really some help:
I have been searching about how can I create a custom renderer for a frame control that allows me to give every vertex a different radius but in every question posted in the forum people do not get into a "clear solution", I know how to create custom renderers in controls (only the basics of it) but when i create the custom renderer for frame i just didnt know how beacuse I tryed with android and the control is not being referenced correctly, I please need a solution for this, any help??

IsVisible Button

Adding Name in to a List

$
0
0

Hi,

I am working on Xamarin forms application ,
In one of the screen I have to show backend data in the form of List. (That is already done by me)
In the same screen I have to add the user entered data in the form of list below the backend data list.

Please help me with this.
Thank you

Java.Lang.IllegalArgumentException: No such service ComponentInfo{/com.SampleApp.AttendanceApp}

$
0
0

I am using Xamarin Android to build an app which should allow the app keep sending driver's location every 15 minutes so that I can keep track of their movement so I used JobScheduler to get this done. My project is very simple now, only contains 3 files:

MainActivity.cs
AttendancePage.cs (Content page, interact with UI button to start the service)
ServiceClass.cs
Methods in Main Activity.cs

`protected override void OnCreate(Bundle savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    scheduler = (JobScheduler)GetSystemService(JobSchedulerService);
    LoadApplication(new App());   //This line will then jump to AttendancePage.cs
}

public void ScheduleJob()
{
    ComponentName componentName = new ComponentName(this, Java.Lang.Class.FromType(typeof(ServiceClass)));
    JobInfo info = new JobInfo.Builder(123, componentName)
        .SetPersisted(true)
        .SetPeriodic(60000)
        .Build();

    int resultCode = scheduler.Schedule(info);  //The error show when hit this line.

    if (resultCode == JobScheduler.ResultSuccess)
    {
        Log.Info("Message", "Job Schedule!");
    }
    else
    {
        Log.Info("Message", "Job shceduling failed");
    }
}

public void CancelJob()
{
    scheduler.Cancel(123);
}`

AttendancePage.cs

public partial class AttendancePage : ContentPage
{
MainActivity main = new MainActivity();

public AttendancePage()
{
    InitializeComponent();
    Title = "Attendance App";           
}

//Button OnClickEvent
async void ScheduleJob(object s, EventArgs e)
{           
    main.ScheduleJob();              
}

//Button OnClickEvent
async void CancelJob(object s, EventArgs e)
{
    main.CancelJob();
}

}
ServiceClass.cs

[Service(Name = "com.SampleApp.AttendanceApp.ServiceClass", Permission = "android.permission.BIND_JOB_SERVICE")]
`public class ServiceClass : JobService
{
public ServiceClass()
{

}


public override bool OnStartJob(JobParameters jobParamsOnStart)
{
    doBackgroundWork(jobParamsOnStart);
    return true;
}

private void doBackgroundWork(JobParameters jobParam)
{
    //My code to send driver's location
    TestingPage.GetGPS();

    JobFinished(jobParam, false);
}

public override bool OnStopJob(JobParameters jobParamsOnStop)
{
    return false;
}

}`
I have added the service tag inside AndroidManifest.xml as well.

<service android:name=".ServiceClass" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true" />
I have no idea why the error is still there. The error is from the line scheduler.Schedule(JobInfo). Anyone has another possible solution? I am frustrated on solving this. Will the reason be I can't debug on the service but only can straight away run in release mode? Please help.

Build error when I install Microsoft.AspNetCore.SignalR.Client

$
0
0

I have to add SignaR to my application but when I build application I get bunch of errors

Ios app and from browser in ios13

$
0
0

Hi All,

in iOS v13. if the user go to my site on the phone,
it will be opened the first ios app and then app store with this app.
Any solution to resolve this issue?
my Javascript code is

window.onload = function() { // Deep link to your app goes here window.location= "xyzzz://r1/examp1"; setTimeout(function() { window.location = "http://itunes.com/r1/examp1"; }, 500); };

Note: issues is only on ios 13 and it is working in ios 12


Add Apple Account problem

$
0
0

I'm trying to bundle signing my iOS project with Automatic Provisioning schema. The problem is when I try to add Apple account in VS > Options > Xamarin > Apple Accounts, if I add a team to my Apple ID in Mac machine > Xcode > Preferences > Accounts > Manage Certificates, VS doesn't add my Apple ID and when I push Add button in VS (Apple Accounts) it waits forever with no error, without a team (in Xcode) VS adds my Apple ID normally but it's required to have a team when you are using Automatic Provisioning schema. My Apple ID is not registered as a Developer Account and as I know you can deploy you app on a iPhone (for testing) with provisioning profile without having a Developer Account.

Understanding sizes in Xamarin

$
0
0

I was reading about sizes in SkiaSharp, and stumbled upon the same topic in Xamarin.Forms that dig into it.
In this page Mr. Charles Petzold, states that, referring to sizes in Xamarin (like BoxView's Height):

These sizes are not pixels. Instead, they are device-independent units recognized independently by each platform.

Also states that:

while Windows developers used device-independent units (DIUs) based on 1/96 inch.

and:

In summary, a Xamarin.Forms programmer targeting phones and tablets can assume that all units of measurement are based on the following criterion:

160 units to the inch, equivalent to
64 units to the centimeter

I'm confused, in the second quote, DIU is 1/96 inch, but in the third quote it's 160/inch!

also since the size is not proportional and is not subjected to the device, shouldn't views look the same size in any display size? I mean when I see them side by side (for example, phone and tablet) they should have the same size defined in code.

if my conclusion is true then why these emulators don't show the same size (assuming they have the same size ratio to their actual counterparts, and I didn't resize the windows):

<BoxView Margin="0" WidthRequest="20" HeightRequest="64" BackgroundColor="Black"
                 VerticalOptions="Center"
                 HorizontalOptions="Fill"/>

Prism and Navigation

$
0
0

Hello Guys, I'm having a problem when navigating with Prism.
If I create a NavigationPage and simply call _navigationService.NavigateAsync("nameOfTheNavigationPage"), I'm getting an unhandled exception: "System.InvalidOperationException: Sequence contains no elements".

If I create this Page as a ContentPage, I don't get this error.

Does somebody know a better way of doing this?

In App.xaml.cs, I start the application with NavigationService.NavigateAsync("LoginPage"); but LoginPage is not a NavigationPage.

Problem with jumpy page size on Android when using ToolbarItems with images

$
0
0

If I add images to the ToolBarItems on my main page then during app start-up on an Android device the page is initially shown at a smaller size (360 x 464) then resized to fill the device (360 x 512). This gives a jarring UI experience particularly if the page is "heavy" for example it contains a Map control. I can reproduce the problem in the Master Detail boiler plate project by just adding an image to the toolbar item on the ItemsPage:

    <ContentPage.ToolbarItems>
            <ToolbarItem x:Name="addToolBarItem" **IconImageSource = "ic_list_white_24dp.png"** Clicked="AddItem_Clicked"/>
    </ContentPage.ToolbarItems>

and adding the relevant images to my drawables in Android.

I can see the resize by overriding SizeAllocated on the ItemsPage:

        protected override void OnSizeAllocated(double width, double height)
        {
            base.OnSizeAllocated(width, height);

            System.Diagnostics.Debug.WriteLine($">>>>>>>> SIZE ALLOCATED: {width} x {height}");
        }

If I take the image off and use Text then the resize doesn't occur.

I've upgraded to the latest version of Xamarin.Forms - 4.4.0.991477

The only way I can avoid this problem is to delay setting the IconImageSource until LayoutChildren runs for the first time:

        protected override void LayoutChildren(double x, double y, double width, double height)
        {
            base.LayoutChildren(x, y, width, height);

            // Yukky workaround...

            if (addToolBarItem.IconImageSource == null)
            {
                addToolBarItem.IconImageSource = "ic_list_white_24dp.png";
            }
        }

grid, picture buttons

$
0
0

I have set up a grid so far put up 6 picture buttons 2 next to each other, the picture buttons are then clickable. but when I add more, only the pictures get smaller. wish to have 2 next to each other in the same image size as it is but that should be able to swipe down to look at several image buttons in the same size. anyone who has any suggestions? At the same time, I also try to get text over before the picture buttons. The code I have used you can see below as well as a picture of how I want it.

<?xml version="1.0" encoding="utf-8" ?>

<ContentPage.ToolbarItems>
    <ToolbarItem 
                 Icon="plus.png"
                 Priority="0"
                 Order="Default"
                 Clicked="Todo"/>

    <ToolbarItem 
                 Icon="Home.png"
                 Priority="0"
                 Order="Default"
                 Clicked="Hjem"/>

</ContentPage.ToolbarItems>

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition/>
    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>

    <!--<Label Text="Friends forever"
                   Style="{StaticResource TextTitle}" HorizontalOptions="Center" VerticalOptions="Center"/>-->

    <ImageButton Source="Friends_forever.png"
                 Grid.Row="0"
                 Grid.Column="0"
                HorizontalOptions="Center"
                VerticalOptions="CenterAndExpand"
                         WidthRequest="250" HeightRequest="250"
                Clicked="Friends_forever" />

    <!--<Label Text="Hamptons Holiday"
                   Style="{StaticResource TextTitle}" HorizontalOptions="Center" VerticalOptions="Center"/>-->

    <ImageButton Source="Hamptons_holiday.png"
                 Grid.Row="0"
                 Grid.Column="1"
                HorizontalOptions="Center"
                VerticalOptions="CenterAndExpand"
                         WidthRequest="250" HeightRequest="250"
                Clicked="Hamptons_holiday" />

    <!--<Label Text="Morocco Love"
                   Style="{StaticResource TextTitle}" HorizontalOptions="Center" VerticalOptions="Center"/>-->

    <ImageButton Source="Morocco_love.png"
                 Grid.Row="1"
                 Grid.Column="0"
                HorizontalOptions="Center"
                VerticalOptions="CenterAndExpand"
                         WidthRequest="250" HeightRequest="250"
                Clicked="Morocco_love" />

    <!--<Label Text="Row by Row"
                   Style="{StaticResource TextTitle}" HorizontalOptions="Center" VerticalOptions="Center"/>-->

    <ImageButton Source="Row_by_row.png" 
                 Grid.Row="1"
                 Grid.Column="1"
                HorizontalOptions="Center"
                VerticalOptions="CenterAndExpand"
                         WidthRequest="250" HeightRequest="250"
                Clicked="Row_by_row" />

    <!--<Label Text="Sonora Sunrise Sweater"
                   Style="{StaticResource TextTitle}" HorizontalOptions="Center" VerticalOptions="Center"/>-->

    <ImageButton Source="Sonora_sunrise_sweater.png" 
                 Grid.Row="2"
                 Grid.Column="0"
                HorizontalOptions="Center"
                VerticalOptions="CenterAndExpand"
                         WidthRequest="250" HeightRequest="250"
                Clicked="Sonora_sunrise_sweater" />

    <!--<Label Text="Sweet Heather"
                   Style="{StaticResource TextTitle}" HorizontalOptions="Center" VerticalOptions="Center"/>-->

    <ImageButton Source="Sweet_heather.png" 
                 Grid.Row="2"
                 Grid.Column="1"
                HorizontalOptions="Center"
                VerticalOptions="CenterAndExpand"
                         WidthRequest="250" HeightRequest="250"
                Clicked="Sweet_heather" />

    <!--<Label Text="Sweet Heather"
                   Style="{StaticResource TextTitle}" HorizontalOptions="Center" VerticalOptions="Center"/>-->

    <ImageButton Source="Cloudscape.png" 
                 Grid.Row="2"
                 Grid.Column="1"
                HorizontalOptions="Center"
                VerticalOptions="CenterAndExpand"
                         WidthRequest="250" HeightRequest="250"
                Clicked="Cloudscape" />
</Grid>

Adjust Width of Master on MasterDetailPage

$
0
0

I am using the MasterDetailPage for the NavigationDrawer on Android. Implementing the functionality has gone perfectly, however the width is too large and i would like to adjust it.

I have tried to set the WidthRequest for the ListView CellTemplate, ListView, and the Master Property of the MasterDetailPage all to the same value, and i can see that the cells are at the right width but the slide out part is still too big.

public MainPage(Action loginFaliedCallback) { MenuPage menu = new MenuPage { Title = "Menu", WidthRequest = 250 }; menu.Menu.ItemSelected += (s, e) => NavigateTo(e.SelectedItem as MenuItem); Master = menu; Master.WidthRequest = 250; }
Any information would be greatly appreciated. Thanks in advance.

Xamarin.Forms GTK compile for ARM

$
0
0

Anyone know how to compile Xamarin.Forms GTK # application for Raspberry pi running Raspbian?
I'm developing under Visual Studio with Windows 10 and cannot compile it to ARM platform.


sorry please delete that thread

I want to have Scrollview be at the center element, after binding elements

$
0
0

Hi, I have an issue, I loads some data to my scroll view, about 20, and I want to get this scroll view be on its middle element on load, any suggestions ?

This is my scrollview

<ScrollView HorizontalScrollBarVisibility="Never" Grid.Row="2" x:Name="calender" Orientation="Horizontal"> <StackLayout BackgroundColor="Blue" BindableLayout.ItemsSource="{Binding CalendarDates}" Orientation="Horizontal"> <BindableLayout.ItemTemplate> <DataTemplate> <Grid> <Label x:Name="date" Text="{Binding Date}"></Label> <Button x:Name="dateButton" TextColor="White" BackgroundColor="Blue" Text="{Binding DateOfMonth}" Command="{Binding BindingContext.GetMeetingFromDayCommand, Source={x:Reference Name=calendarPage}}" CommandParameter="{Binding Source={x:Reference date}, Path=Text}"> </Button> </Grid> </DataTemplate> </BindableLayout.ItemTemplate> </StackLayout> </ScrollView>

Code behind :

public CalendarPage()
{
InitializeComponent();
BindingContext = new CalendarViewModel(calender);

    }

    private void LeftButton_Clicked(object sender, EventArgs e)
    {
        if (calender.ScrollX > 150)
            calender.ScrollToAsync(calender.ScrollX - 150, 0, true);
        else
            calender.ScrollToAsync(0, 0, true);
    }

    private void RightButton_Clicked(object sender, EventArgs e)
    {
        if (calender.ScrollX < calender.ContentSize.Width - calender.Width - 150)
            calender.ScrollToAsync(calender.ScrollX + 150, 0, true);
        else
            calender.ScrollToAsync(calender.ContentSize.Width - calender.Width, 0, true);
    }

I Need to bind data from a inner list to view in listview grouping?

$
0
0

// Model

public class StudyParameterGroupModel :  List<StudyParameterGroupOptionsModel> 
{
    public string GroupDisplayText { get; set; }
    public List<StudyParameterGroupOptionsModel> DiseaseOptions { get; set; } 
}

public class StudyParameterGroupOptionsModel
{
    public string ParameterDisplayText { get; set; }
    public int SubDiseaseId { get; set; }
    public bool IsSelected { get; set; }
}

// Mapping data from rest response

public List<StudyParameterGroupModel> _studyParameterGroupList;
    public List<StudyParameterGroupModel> StudyParameterGroupList
    {
        get
        {
            return _studyParameterGroupList;
        }
        set
        {
            _studyParameterGroupList = value;
            OnPropertyChanged("StudyParameterGroupList");
        }
    }

IRestResponse<List<StudyParameterGroupDTO>> responseDto = client.Execute<List<StudyParameterGroupDTO>>(request);

if (response.StatusCode == HttpStatusCode.OK)
{
       StudyParameterGroupList  = responseDto.Data.Select(resp => new StudyParameterGroupModel()

            GroupDisplayText = resp.DisplayText,
            DiseaseOptions = resp.Options
                                 .Select(opt => new StudyParameterGroupOptionsModel()
                                 {
                                     ParameterDisplayText = opt.DisplayText,
                                    SubDiseaseId = opt.SubDiseaseId,
                                 }).ToList(),
        }).ToList();
}

// XAML

 ~<ListView x:Name="list" 
                        ItemsSource="{Binding StudyParameterGroupList, Mode=TwoWay}" 
                        IsGroupingEnabled="True"
                        GroupDisplayBinding="{Binding GroupName}"
                        HasUnevenRows="True">

                        <ListView.GroupHeaderTemplate>
                            <DataTemplate>
                                <ViewCell Height="25">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <Label Grid.Row="0" Text="{Binding GroupDisplayText }" 
                                             FontSize="Medium"
                                             FontFamily="{StaticResource RegularFont}"
                                             TextColor="White" VerticalOptions="Center"/>
                                        <Label VerticalTextAlignment="Start" VerticalOptions="Start" 
                                               HorizontalOptions="Start" Grid.Column="1" Text="*"
                                               TextColor="Red"
                                               FontSize="Medium"
                                               FontFamily="{StaticResource RegularFont}" />
                                    </Grid>
                                </ViewCell>
                            </DataTemplate>

                        </ListView.GroupHeaderTemplate>
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <telerikPrimitives:RadCheckBox x:Name="checkbox" Grid.Row="0" IsChecked="{Binding IsSelected, Mode=TwoWay}" />
                                    <Label Text="{Binding Parameter, Mode=TwoWay}"
                                                           VerticalTextAlignment="Center" VerticalOptions="Center" HorizontalOptions="Center" Grid.Column="1"
                                                           FontSize="Medium"
                                                           FontFamily="{StaticResource RegularFont}"/>
                                </Grid>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>~

Data is in the StudyParameterGroupList, but not appearing in view.

Could not load file or assembly System.Private.corelib.

$
0
0
Hi,

Using visual studio 2019 I went to create a new xamarin forms application. Selected android, iOS and uwp empty project and clicked create.

Once ready built the project but receive error

Loading assembly ... System.io.isolatedstorage.dll failed. System.io.filenotfoundexception: could not load file or assembly 'system.private.corelib, version 4.0.0.0, culture=neutral,publickeytoken=7cec85d7bea7798e'

Updated Microsoft.netcore.universalwindowsplatform to 6.2.9 and xamarin.forms to v4.4.0.991477 without any luck.

Googled error message, followed advice cleaned project, closed ide, deleted bin and obj folders, restarted ide and built project but same error.

Please can someone advise.

Much appreciated.

Mystery nullReferenceException occurs after upgrade from Xamarin.Forms from 4.1 to 4.2+

$
0
0

After upgrading my app from Xamarin.Forms 4.1.0.709244 to 4.2.0.709249 (or any package version newer), code that was working previously without fail now no longer works and crashes, but only under one specific circumstance.

My app receives push notifications via the OneSignal package, and the expected behavior is:

  1. A notification arrives and is opened
  2. The notification opened handler saves the payload to App class parameters and sets Application.Current.MainPage = new MainPage();
  3. Logic inside the MainPage initializer parses the payload to determine what page the user needs to be navigated to, and creates a Page object for that new page.
  4. Detail page is set to the new page

Under 4.1, this worked as expected. Clicking on the notification, the user would be taken to the corresponding page in the app under all scenarios. After upgrading to 4.2+, this scenario fails if the app is not currently running, but works as expected if the app is running and either in foreground or in background.

When it fails, instead of the app loading and then the user being taken to the correct page, the app loads but then just sits at the default main page (as if Detail hadn't been set using the info from the notification payload). As well, at this point if you tap on the hamburger icon the navigation menu displays briefly and the app immediately crashes with a null reference exception seen below:

Xamarin Exception Stack:
System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0002b] in <596751900f1f46919eb25349c2e7053a>:0
  at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00025] in <596751900f1f46919eb25349c2e7053a>:0
  at Android.Views.ViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00009] in <21b22bf2aca24508938d2117f4c11761>:0
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.28(intptr,intptr,bool,int,int,int,int)

As this scenario only occurs when the app is closed and started via the notification action, I cannot use the Visual Studio debugger to identify exactly where the exception is occurring. I used Microsoft AppCenter to add a number of events that would track progress through the various methods and then report where in the logic flow the crash occurred, but all expected steps are progressing to completion. The step to set the Detail page to be the new page is being called, and the isPresentedChanged handler that is called when the hamburger icon is tapped is also running to completion.

I have reviewed the release notes for 4.2 here and while there are a few fixes related to layout of page that might be related to the crash, I get the feeling the crash is more a symptom of the change to the Detail page not happening correctly than a problem I need to solve outright. I have found a few similar-sounding errors reported to the Xamarin team, but they are all closed out as resolved and are not exactly the same problem. See here, here, here, here, and here for those.

NotificationServices.cs (Service extension for OneSignal; Code now fails regardless of which userNotificationType is passed):

public class NotificationServices
{
    public static void HandleNotificationOpened(OSNotificationOpenedResult result)
    {
        string notificationActionId = "HandleMessage";

        OSNotificationPayload payload = result.notification.payload;
        string message = payload.body;
        App.NotificationActionId = notificationActionId;
        App.NotificationData = payload.additionalData;
        Application.Current.MainPage = new MainPage();
    }

    public static Page GetPageFromNotificationData()
    {
        Page ReturnPage;
        ApiServices _apiServices = new ApiServices();  //service to make REST calls to backend system
        user_notification_type userNotificationType = user_notification_type.None;
        int fromUserId = 0;
        int assocId = 0;
        int msgId = 0;
        if (App.NotificationData != null)
        {
            if (App.NotificationData.ContainsKey("assocId"))
            {
                Int32.TryParse(Convert.ToString(App.NotificationData["assocId"]), out assocId);
            }
            if (App.NotificationData.ContainsKey("fromUserId"))
            {
                Int32.TryParse(Convert.ToString(App.NotificationData["fromUserId"]), out fromUserId);
            }
            if (App.NotificationData.ContainsKey("msgId"))
            {
                Int32.TryParse(Convert.ToString(App.NotificationData["msgId"]), out msgId);
            }
            if (App.NotificationData.ContainsKey("userNotificationType"))
            {
                int unInt = 0;
                Int32.TryParse(Convert.ToString(App.NotificationData["userNotificationType"]), out unInt);
                userNotificationType = (user_notification_type)unInt;
            }
        }
        switch (userNotificationType)
        {
            case user_notification_type.ChatMessage:
                TeamBasic tm = new TeamBasic();
                tm.OwnerID = fromUserId;
                tm.OwnerName = _apiServices.GetUserName(fromUserId).Result;
                ReturnPage = new ChatPage(tm);
                break;
            case user_notification_type.None:
                ReturnPage = default(Page);
                break;
            default:
                UserNotification unItem = new UserNotification();
                var unList = _apiServices.GetUserNotifications(assocId, msgId+1, 1).Result;
                unItem = unList[0];
                UserNotificationDetailViewModel undVm = new UserNotificationDetailViewModel(unItem);
                ReturnPage = new UserNotificationDetailPage(undVm);
                break;
        }

        return ReturnPage;
    }
}

Mainpage.xaml.cs:

public partial class MainPage : MasterDetailPage
{
    private IHubServices _hubServices;
    Dictionary<int, NavigationPage> MenuPages = new Dictionary<int, NavigationPage>();
    public MainPage()
    {
        InitializeComponent();

        _hubServices = DependencyService.Get<IHubServices>(); //signalR
        _hubServices.Connect();
        _hubServices.ClearPageCache += ClearPageCache;

        MasterBehavior = MasterBehavior.Popover;
        NavigationPage navPage = (NavigationPage)Detail;

        ConnectionState cs = _hubServices.GetConnectionState().Result;
        if (cs == ConnectionState.Connected)
        {
            var pg = NotificationServices.GetPageFromNotificationData();  //call to get page as specified per notification

            Detail = new NavigationPage(pg); //this is where the Detail page should be getting updated but is acting like it isn't when the app is started by the act of opening the notification
            MenuPages.Add((int)MenuItemType.LogOut, (NavigationPage)Detail);
        }
        else
        {
            App.CheckForNotificationRedirect = true;
            MenuPages.Add((int)MenuItemType.About, (NavigationPage)Detail);
        }

        IsPresentedChanged += (sender, args) =>
        {
            try {
                //anything
            }
            catch (Exception ex) 
            {
                //anything
            }
            //it is after this has completed executing that the app is crashing.  No exception ever occurs in the try/catch
        };  
    }
}

Full dump as provided by App Center:

Xamarin Exception Stack:
System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0002b] in <596751900f1f46919eb25349c2e7053a>:0
  at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00025] in <596751900f1f46919eb25349c2e7053a>:0
  at Android.Views.ViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00009] in <21b22bf2aca24508938d2117f4c11761>:0
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.28(intptr,intptr,bool,int,int,int,int)

Thread 2:
0   dalvik.system.VMStack.getThreadStackTrace(VMStack.java:-2)
1   java.lang.Thread.getStackTrace(Thread.java:1538)
2   java.lang.Thread.getAllStackTraces(Thread.java:1588)
3   com.microsoft.appcenter.crashes.Crashes.saveUncaughtException(Crashes.java:1093)
4   com.microsoft.appcenter.crashes.WrapperSdkExceptionManager.saveWrapperException(WrapperSdkExceptionManager.java:58)
5   crc643f46942d9dd1fff9.PlatformRenderer.n_onLayout(PlatformRenderer.java:-2)
6   crc643f46942d9dd1fff9.PlatformRenderer.onLayout(PlatformRenderer.java:55)
7   android.view.View.layout(View.java:20740)
8   android.view.ViewGroup.layout(ViewGroup.java:6268)
9   android.widget.RelativeLayout.onLayout(RelativeLayout.java:1084)
10  android.view.View.layout(View.java:20740)
11  android.view.ViewGroup.layout(ViewGroup.java:6268)
12  android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
13  android.widget.FrameLayout.onLayout(FrameLayout.java:261)
14  android.view.View.layout(View.java:20740)
15  android.view.ViewGroup.layout(ViewGroup.java:6268)
16  android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
17  android.widget.FrameLayout.onLayout(FrameLayout.java:261)
18  android.view.View.layout(View.java:20740)
19  android.view.ViewGroup.layout(ViewGroup.java:6268)
20  android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
21  android.widget.FrameLayout.onLayout(FrameLayout.java:261)
22  android.view.View.layout(View.java:20740)
23  android.view.ViewGroup.layout(ViewGroup.java:6268)
24  android.widget.LinearLayout.setChildFrame(LinearLayout.java:1812)
25  android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656)
26  android.widget.LinearLayout.onLayout(LinearLayout.java:1565)
27  android.view.View.layout(View.java:20740)
28  android.view.ViewGroup.layout(ViewGroup.java:6268)
29  android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
30  android.widget.FrameLayout.onLayout(FrameLayout.java:261)
31  com.android.internal.policy.DecorView.onLayout(DecorView.java:794)
32  android.view.View.layout(View.java:20740)
33  android.view.ViewGroup.layout(ViewGroup.java:6268)
34  android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2970)
Viewing all 77050 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>