ImageCircle causes iOS null reference exception in ListView?

4 posts, 0 answers
  1. Russ
    Russ avatar
    19 posts
    Member since:
    Jan 2017

    Posted 02 Feb Link to this post

    I am using the RADListView and a [Circle Image plug-in ](https://github.com/jamesmontemagno/ImageCirclePlugin "Circle Image plug-in ") from @JamesMontemagno  , with the most recent version 1.8.1. Works great in Android and UWP.

    In iOS only, the first time I navigate from my home page to a ListView page it renders fine. When I hit back on the navigation breadcrumb to go back to my home page... I get a runtime error "System.NullReferenceException: Object reference not set to an instance of an object"

    If I use a regular Image control it works fine.

    Not sure if this is related to linker options, but here is what I have tried for linker options:

    I have tried Link SDK Assemblies only and none. I have added the Additional mtouch argument: --linkskip=ImageCircle.Forms.Plugin.iOS --linkskip=ImageCircle.Forms.Plugin.Abstractions 

    Any other ideas?

    Note: I posted on the Xamarin forums too...

    https://forums.xamarin.com/discussion/87828/imagecircle-causes-ios-null-reference-exception/p1?new=1
  2. Tsvyatko
    Admin
    Tsvyatko avatar
    857 posts

    Posted 06 Feb Link to this post

    Hi Russ,

    Thank you for contacting us! Would it be possible to share some additional information regarding the setup of the navigation as well as the layout of the page (xaml,cs) where listview resides.

    Also, if you are running the app on device in debug mode can you make sure that incremental build is disabled - http://docs.telerik.com/devtools/xamarin/troubleshooting/ios-app-issues-on-device-but-not-on-simulator

    Regards,
    Tsvyatko
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Russ
    Russ avatar
    19 posts
    Member since:
    Jan 2017

    Posted 07 Feb in reply to Tsvyatko Link to this post

    Using Navigation Page to start the app, then content pages are navigated to. Note the HeighRequest need to be set really high for the images to appear. All images are embedded resources. Here is the XAML:

     

              <telerikDataControls:RadListView HeightRequest="1500" x:Name="RADlistView"
                                               BackgroundColor="White" 
                SelectedItem="{Binding objSelectedTumor, Mode=TwoWay}" >
                <telerikDataControls:RadListView.ItemTemplate>
                  <DataTemplate>
                    <telerikListView:ListViewTemplateCell>
                      <telerikListView:ListViewTemplateCell.View>
                        <Grid Padding="10" RowSpacing="5" HorizontalOptions="Center" VerticalOptions="Center">
                          <Grid.RowDefinitions>
                            <RowDefinition Height="6*" />
                            <RowDefinition Height="*" />
                          </Grid.RowDefinitions>
                          <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />

                          </Grid.ColumnDefinitions>
                          <!--these options cause System.NullReferenceException: Object reference not set to an instance of an object in iOS.
                                          HorizontalOptions="Center"
                                          VerticalOptions="Center"-->
                          <controls:CircleImage Grid.Row="0"
                                                Source="{Binding thumb_file_image_name} Converter={StaticResource ImageConverter}"
                                                Aspect="AspectFit"
                                                IsVisible="{StaticResource showSectionAndroidWin}"
                                     
                      >
                            <controls:CircleImage.WidthRequest>
                              <OnPlatform x:TypeArguments="x:Double"
                                iOS="55"
                                Android="55"
                                WinPhone="75"
                          />
                            </controls:CircleImage.WidthRequest>
                            <controls:CircleImage.HeightRequest>
                              <OnPlatform x:TypeArguments="x:Double"
                                iOS="55"
                                Android="55"
                                WinPhone="75"
                          />
                            </controls:CircleImage.HeightRequest>
                          </controls:CircleImage>
                          <Image Grid.Row="0"
                                                Source="{Binding thumb_file_image_name} Converter={StaticResource ImageConverter}"
                                                Aspect="AspectFit"
                                                IsVisible="{StaticResource showSectioniOS}"
                      >
                            <Image.WidthRequest>
                              <OnPlatform x:TypeArguments="x:Double"
                                iOS="55"
                                Android="55"
                                WinPhone="75"
                          />
                            </Image.WidthRequest>
                            <Image.HeightRequest>
                              <OnPlatform x:TypeArguments="x:Double"
                                iOS="55"
                                Android="55"
                                WinPhone="75"
                          />
                            </Image.HeightRequest>
                          </Image>

                          <Grid Grid.Row="1"
                               Grid.Column="0"
                               RowSpacing="1"
                               VerticalOptions="Start"
                               HorizontalOptions="Center"
                      >
                            <Grid.RowDefinitions>
                              <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                              <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Label Grid.Row="0"
                                   Grid.Column="0"
                                   LineBreakMode="NoWrap"
                                   BackgroundColor="Transparent"
                                   HorizontalTextAlignment="Center"
                                   VerticalTextAlignment="Center"
                                   Text="{Binding name}"
                                   TextColor="#81AABC">
                              <Label.FontSize>
                                <OnPlatform x:TypeArguments="x:Double">
                                  <OnPlatform.WinPhone>
                                    <OnIdiom x:TypeArguments="x:Double">
                                      <OnIdiom.Phone>14</OnIdiom.Phone>
                                    </OnIdiom>
                                  </OnPlatform.WinPhone>
                                  <OnPlatform.Android>
                                    <OnIdiom Phone="10"
                                             Tablet="12"
                                             x:TypeArguments="x:Double" />
                                  </OnPlatform.Android>
                                  <OnPlatform.iOS>
                                    <OnIdiom Phone="10"
                                             Tablet="12"
                                             x:TypeArguments="x:Double" />
                                  </OnPlatform.iOS>
                                </OnPlatform>
                              </Label.FontSize>
                            </Label>
                          </Grid>
                        </Grid>
                      </telerikListView:ListViewTemplateCell.View>
                    </telerikListView:ListViewTemplateCell>
                  </DataTemplate>
                </telerikDataControls:RadListView.ItemTemplate>
                <telerikDataControls:RadListView.LayoutDefinition>
                  <telerikListView:ListViewGridLayout x:Name="gridLayout"
                                                      VerticalItemSpacing="5"
                                                      HorizontalItemSpacing="5"
                                                      SpanCount="5"
                                                      ItemLength="180" />
                </telerikDataControls:RadListView.LayoutDefinition>
              </telerikDataControls:RadListView>

  4. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    586 posts

    Posted 10 Feb Link to this post

    Hello Russ,

    Thank you for the information. I tried to reproduce the issue on our side but to no avail. Could you please check the sample project and modify it in order to reproduce the problem.

    I look forward to your reply.

    Regards,
    Rosy Topchiyska
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top