Usando Inflate con un padre nulo... Xamarin

I am having problems building my Android project using Xamarin. It seems to fail the build when it reaches my ViewModel for some odd reason.

Aquí está la salida

06-12 11:45:00.748 D/Mono    ( 3984): Searching for '_monodroid_gref_dec'.
06-12 11:45:00.758 D/Mono    ( 3984): Probing '_monodroid_gref_dec'.
06-12 11:45:00.758 D/Mono    ( 3984): Found as '_monodroid_gref_dec'.
06-12 11:45:00.768 D/Mono    ( 3984): DllImport searching in: '__Internal' ('(null)').
06-12 11:45:00.768 D/Mono    ( 3984): Searching for '_monodroid_gref_log_delete'.
06-12 11:45:00.778 D/Mono    ( 3984): Probing '_monodroid_gref_log_delete'.
06-12 11:45:00.778 D/Mono    ( 3984): Found as '_monodroid_gref_log_delete'.
06-12 11:45:01.397 D/Mono    ( 3984): Assembly Ref addref SynchramedViewer.Droid[0x1d54f8] -> Cirrious.CrossCore.Droid[0x18f8e8]: 4
[0:] 
mvx:Diagnostic: 13.50 Attempting to load new ViewModel from Intent with Extras
06-12 11:45:01.528 I/mono-stdout( 3984): mvx:Diagnostic: 13.50 Attempting to load new ViewModel from Intent with Extras
[0:] mvx:Diagnostic: 13.50 Attempting to load new ViewModel from Intent with Extras
06-12 11:45:01.868 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:01.948 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
Resolved pending breakpoint at 'c:\Source\Synchramed\SynchramedViewer\SynchramedViewer.Core\ViewModels\OverviewViewModel.cs:12,1' to void SynchramedViewer.Core.ViewModels.OverviewViewModel..ctor (SynchramedViewer.Core.IOverviewService overviewService) [0x00008].
Resolved pending breakpoint at 'c:\Source\Synchramed\SynchramedViewer\SynchramedViewer.Core\ViewModels\OverviewViewModel.cs:11,1' to void SynchramedViewer.Core.ViewModels.OverviewViewModel..ctor (SynchramedViewer.Core.IOverviewService overviewService) [0x00007].
06-12 11:45:02.358 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:02.397 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:02.858 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:02.898 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:03.367 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:03.407 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:03.868 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:03.898 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:04.377 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:04.407 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:04.888 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:04.918 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:05.388 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:05.417 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:05.898 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:05.918 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:06.398 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:06.498 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:06.897 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:06.927 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:07.408 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:07.437 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:07.918 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:07.947 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:08.428 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:08.448 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:08.937 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:08.977 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
[0:] 
mvx:Warning: 21.37 using Inflate with a null parent viewGroup is discouraged - see https://github.com/MvvmCross/MvvmCross/issues/507
06-12 11:45:09.408 I/mono-stdout( 3984): mvx:Warning: 21.37 using Inflate with a null parent viewGroup is discouraged - see https://github.com/MvvmCross/MvvmCross/issues/507
[0:] mvx:Warning: 21.37 using Inflate with a null parent viewGroup is discouraged - see https://github.com/MvvmCross/MvvmCross/issues/507
06-12 11:45:09.438 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:09.498 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:09.947 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:09.977 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:10.468 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:10.498 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:10.958 I/dalvikvm( 3984): threadid=3: reacting to signal 3
06-12 11:45:10.998 I/dalvikvm( 3984): Wrote stack traces to '/data/anr/traces.txt'
06-12 11:45:11.327 D/Mono    ( 3984): Remapped public key token of retargetable assembly System from 7cec85d7bea7798e to b77a5c561934e089
06-12 11:45:11.327 D/Mono    ( 3984): The request to load the retargetable assembly System v2.0.5.0 was remapped to System v2.0.0.0
06-12 11:45:11.347 D/Mono    ( 3984): Unloading image System.dll [0xf67590].
06-12 11:45:11.347 D/Mono    ( 3984): Image addref System[0xf615e0] -> System.dll[0x6dac70]: 10
06-12 11:45:11.357 D/Mono    ( 3984): Assembly Ref addref Cirrious.CrossCore[0x1eb4b8] -> System[0x6ce4d0]: 9
06-12 11:45:11.918 D/dalvikvm( 3984): GREF has increased to 201

I see in the output there is this mvx:Warning: 21.37 using Inflate with a null parent viewGroup is discouraged - see https://github.com/MvvmCross/MvvmCross/issues/507

So I visited that link but couldn't find anything useful then I stumbled upon this - MvvmCross: MvxListView con error de plantilla

So which all my controls and layouts have layout_width

It seems to break in my ViewModel constructor when I debug the app on the Day30 variable.

private readonly IOverviewService _overviewService;
    public OverviewViewModel (IOverviewService overviewService)
    {
        TurnOver = 100.00;
        Day30 = 20.00;
        Day60 = 30.00;
        Day90 = 90.00;
        Day120 = 120.00;
        Per30 = 1;
        Per60 = 2;
        Per90 = 3;
        Per120 = 4;
        Total = 400.00;
        PerTotal = 200.00;
        NoOfVisits = 3;
        string a = "sdlfkj";
        //this = overviewService.GetOverviewReport (this);
    }

¿Alguien tiene alguna idea de por qué está sucediendo esto?

I don't think it has anything to do with MvvmCross

Editar

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout9">
        <TextView
            android:text="Ex Vat"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvExVat" />
        <TextView
            android:text="Turnover"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/tvTurnOver" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout1">
        <TextView
            android:text="Today"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvTurnOverToday" />
        <TextView
            android:text="MTD"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/vTurnOverMtd" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout2">
        <TextView
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/vTurnOverTodayVal"
            local:MvxBind="Text TurnOver" />
        <TextView
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/vTurnOverMtdVal"
            local:MvxBind="Text TurnOver" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout10">
        <TextView
            android:text="Inc Vat"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvIncVat" />
        <TextView
            android:text="Cash Collected"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCashCollected" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout3">
        <TextView
            android:text="Today"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCashCollectedToday" />
        <TextView
            android:text="MTD"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCashCollectedMtd" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout4">
        <TextView
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCashCollectedTodayVal" />
        <TextView
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCashCollectedMtdVal" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout11">
        <TextView
            android:text="Net Collectable Book"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCollectable" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout5">
        <TextView
            android:text="30"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCollectable30" />
        <TextView
            android:text="Small Text"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCollectable30Val" />
        <TextView
            android:text="Small Text"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCollectable30Per" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout6">
        <TextView
            android:text="60"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/ttvCollectable60" />
        <TextView
            android:text="Small Text"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/ttvCollectable60Val" />
        <TextView
            android:text="Small Text"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCollectable60Per" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout7">
        <TextView
            android:text="90"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCollectable90" />
        <TextView
            android:text="Small Text"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCollectable90Val" />
        <TextView
            android:text="Small Text"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCollectable90Per" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout8">
        <TextView
            android:text="120"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCollectable120" />
        <TextView
            android:text="Small Text"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/tvCollectable120Val" />
        <TextView
            android:text="Small Text"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/ttvCollectable120Per" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout12" />
</LinearLayout>

Full ViewModel

using Cirrious.MvvmCross.ViewModels;
using System.Collections.Generic;

namespace SynchramedViewer.Core.ViewModels
{
    public class OverviewViewModel 
        : MvxViewModel
    {
        private readonly IOverviewService _overviewService;
        public OverviewViewModel (IOverviewService overviewService)
        {
            TurnOver = 100.00;
            Day30 = 20.00;
            Day60 = 30.00;
            Day90 = 90.00;
            Day120 = 120.00;
            Per30 = 1;
            Per60 = 2;
            Per90 = 3;
            Per120 = 4;
            Total = 400.00;
            PerTotal = 200.00;
            NoOfVisits = 3;
            string a = "sdlfkj";
            //this = overviewService.GetOverviewReport (this);
        }

        //Billed by the doctors
        private double _turnOver;
        public double TurnOver
        { 
            get { return _turnOver; }
            set { _turnOver = value; RaisePropertyChanged(() => TurnOver); }
        }

        //Cash collected
        private double _day30;
        public double Day30 
        {
            get { return _day30; }
            set { _day30 = value; RaisePropertyChanged(() => Day30); }
        }

        private double _day60;
        public double Day60 
        {
            get { return _day60; }
            set { _day60 = value; RaisePropertyChanged(() => Day60); }
        }

        private double _day90;
        public double Day90 
        {
            get { return _day90; }
            set { _day90 = value; RaisePropertyChanged(() => Day90); }
        }

        private double _day120;
        public double Day120 
        {
            get { return _day120; }
            set { _day120 = value; RaisePropertyChanged(() => Day120); }
        }

        private double _total;
        public double Total 
        {
            get { return _total; }
            set { _total = value; RaisePropertyChanged(() => Total); }
        }
        //Cash collected shown as a percentage
        private double _per30;
        public double Per30 
        {
            get { return _per30; }
            set { _per30 = value; RaisePropertyChanged(() => Per30); }
        }

        private double _per60;
        public double Per60 
        {
            get { return _per60; }
            set { _per60 = value; RaisePropertyChanged(() => Per60); }
        }

        private double _per90;
        public double Per90 
        {
            get { return _per90; }
            set { _per90 = value; RaisePropertyChanged(() => Per90); }
        }

        private double _per120;
        public double Per120 
        {
            get { return _per120; }
            set { _per120 = value; RaisePropertyChanged(() => Per120); }
        }

        private double _perTotal;
        public double PerTotal 
        {
            get { return _perTotal; }
            set { _perTotal = value; RaisePropertyChanged(() => PerTotal); }
        }

        //Number of patients visited
        private double _noOfVisits;
        public double NoOfVisits
        { 
            get { return _noOfVisits; }
            set { _noOfVisits = value; RaisePropertyChanged(() => NoOfVisits); }
        }

        public OverviewViewModel GetData()
        {
            return _overviewService.GetOverviewReport ();
        }

    }       
}

So to add some more details to this question.

It seems to enter the constructor of the ViewModel and then will break. When I try to view my Layout I see the value of TurnOver is = 0 which in fact it should = 100.00.

I commented out the code inside the ViewModel constructor and it seems do exactly the same thing as above where the value of TurnOver is = 0.

preguntado el 12 de junio de 14 a las 10:06

please add your layout,view and viewmodel -

Ignora el using Inflate with a null parent viewGroup message. Is there more info you can add to the question about what "breaks" or "fails"? It's not obvious to me what is going wrong from your question (ie it's not obvious what you are or aren't seeing). Does whatever is going wrong still happen when you remove all the code from the constructor? If you can edit the question to add more detail about what is failing, we can try to help :) -

I have included the layout and viewmodel. -

I added some more details about the constructor and extra details -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.