question

RichardLeonard-7951 avatar image
0 Votes"
RichardLeonard-7951 asked RichardLeonard-7951 commented

ItemSelectedEventArgsConverter not found in schema

I am using ItemSelectedEventArgsConverter on one page in my application. Everything works ok when using the iPhone emulator but when I push the build to test on a physical iPhone when i hit the page in question I get an error "Type xct: ItemSelectedEventArgsConverter not found in xmlns http://xamarin.com/schema"

 <?xml version="1.0" encoding="UTF-8"?>
 <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
              xmlns:local="clr-namespace:CertsAssured.Resources;assembly=CertsAssured"
              xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
              x:Class="CertsAssured.View.AssetSearchResultPage"
              Visual="Material"
              x:Name="AssetSearchResults">
     <ContentPage.Padding>
         <OnPlatform x:TypeArguments="Thickness"
                 iOS="0, 20, 0, 0" />
     </ContentPage.Padding>
     <ContentPage.Resources>
         <ResourceDictionary>
             <local:StringToColourConverter x:Key="StringToColourConverter">
             </local:StringToColourConverter>
             <xct:ItemSelectedEventArgsConverter x:Key="ItemSelectedEventArgsConverter" />
         </ResourceDictionary>
     </ContentPage.Resources>
     <ContentPage.Content>
         <StackLayout Orientation="Vertical" Padding="10">
             <ListView ItemsSource="{ Binding Assets }"
                       HasUnevenRows="True">
                 <ListView.Behaviors>
                     <xct:EventToCommandBehavior
                         EventName="ItemSelected"
                         Command="{ Binding AssetSelectedCommand }"
                         EventArgsConverter="{StaticResource ItemSelectedEventArgsConverter}" />
                 </ListView.Behaviors>
                 <ListView.ItemTemplate>
                     <DataTemplate>
 ......

Any ideas what could be causing this, I have "Link Framework SDKs Only" as Linker behaviour.

Thanks

dotnet-xamarin
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

when I push the build to test on a physical iPhone when i hit the page in question I get an error

Hi, RichardLeonard. I created a basic demo to test the function on a physical iPhone, it works as excepted. Did you test the functino on a physical device directly? Or release the project for test? If you face the issue in release mode, try to preserve the related class or use linkskip to skip the assembly.

Similar issue case: https://github.com/xamarin/XamarinCommunityToolkit/issues/818

Related doc: https://docs.microsoft.com/en-us/xamarin/ios/deploy-test/linker?tabs=windows#preserving-code

0 Votes 0 ·

I reverted my linker settings to the following at it worked ok:

98888-screenshot-2021-05-23-at-230251.png



Is there any advice as to what the Release configuration settings should be?

0 Votes 0 ·

Linker is used in relase mode, the three main options are offered are described below:

  • Don't Link disables the linking, which will make sure that no assemblies are modified.

  • Link SDK assemblies only the linker will leave your assemblies untouched, and will reduce the size of the SDK assemblies

  • Link all assemblies links everything, the linker can use the whole set of its optimizations to make the application as small as possible.

You could select the option based on your requirement. Check the doc:
https://docs.microsoft.com/en-us/xamarin/ios/deploy-test/linker?tabs=windows#linker-behavior

0 Votes 0 ·

I have tried different Linker settings and nothing will work, when I choose "Don't link" it won't compile and when I choose "Link All" it crashes as soon as I try to open the app.

I have even tried adding a "new ItemSelectedEventArgsConverter();" within the view constructor to try and force it. If I remove reference to the xmlns:xct="http://xamarin.com/schemas/2020/toolkit" in my view and run the app it passes over the "new ItemSelectedEventArgsConverter();" without issue.

Also tried adding the [Preserve] annotation on the View class although the code isn't in there but still nothing.

I tried to mirror the settings from a vanilla Xamarin Forms application for the configuration, setting the supported architecture to ARM64 but again when it tries to open the app on the device it crashes instantly.

Anyone have any ideas as I am totally lost

0 Votes 0 ·

I could not reproduce the issue on my side. What's the version of the Xamarin.Forms and XamarinCommunityToolkit package? Please update both to the lastest stable version on the shared project and platform project. You could also try to test the official sample to check if it could work.

0 Votes 0 ·
Show more comments

0 Answers