Rg.Plugins.Popup icon indicating copy to clipboard operation
Rg.Plugins.Popup copied to clipboard

Error: : XamlC error XFC0000 : Cannot resolve type "PopupPage" when using xmlns:rg="http://rotorgames.com"

Open shweta1915 opened this issue 4 years ago • 14 comments

🐛 Bug Report

Getting the exception in the error window for each created view "Error: : XamlC error XFC0000 : Cannot resolve type "PopupPage""

Due to this reason application is not running from the app launcher. It keeps crashing.

Note: If the app connected to debugging mode then there is no issue.

image

Expected behavior

The app should not crash in any mode

Reproduction steps

  1. Install Xamarin.Forms latest stable library i.e. 4.8.0.1687
  2. Install Rg.Plugins.Popup i.e. 2.0.0 and above

Version: 2.0.0.9

Platform:

  • [x] :iphone: iOS 14.2
  • [x] :robot: Android 10
  • [ ] :checkered_flag: WPF
  • [ ] :earth_americas: UWP
  • [ ] :apple: MacOS
  • [ ] :tv: tvOS
  • [x] :monkey: Xamarin.Forms

shweta1915 avatar Dec 11 '20 11:12 shweta1915

Any update on this issue?

Here is one sample project which I have created to reproduce this issue. Seems like this issue is coming because of the latest stable release i.e. Xamarin.Forms 4.8.0.1687

Demo.zip

shweta1915 avatar Dec 16 '20 10:12 shweta1915

@shweta1915 thank you for the demo, I have provided a 'fixed' example Here

this is indeed unusual, it does seem that Xamarin.Forms 4.8.0.1687 is causing some issue.

I also noticed that if you convert the popup pages to use the older xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup" instead of the newer 'xmlns:rg="http://rotorgames.com"' The issue seems to go away

@dansiegel do you have any idea why this would be so? Would the latest Xamarin.Forms somehow be interfering with your xmlns definition? any use of http://rotorgames.com results in the XamlC error

LuckyDucko avatar Dec 16 '20 23:12 LuckyDucko

@LuckyDucko Thank you for the solution, it worked

shweta1915 avatar Dec 17 '20 03:12 shweta1915

This solution is temporally since you always have to do it by hand. I am using xamarin 5 and having same issue.

valentasm1 avatar Feb 14 '21 20:02 valentasm1

@valentasm1 ill reopen and change the title of the bug to better reflect the bug thats happening here

LuckyDucko avatar Feb 14 '21 22:02 LuckyDucko

this error does not let me work with the hot reload

rabileon avatar Mar 05 '21 04:03 rabileon

I was able to fix the XamlC error and hot reload problem by:

  1. importing the Rg.Plugins.Popup .csproj and referencing the project and its dll's
  2. putting the namespace ref's back to: xmlns:rg="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup" xmlns:rga="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"

tkefauver avatar Aug 09 '21 21:08 tkefauver

@tkefauver it's made me crazy for days, can you share it as a small sample code please?

Erdogan34 avatar Nov 04 '21 20:11 Erdogan34

Try this

<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage
    x:Class="Worker.Mobile.Views.Modals.GoogleMapsPinClickPopUpPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
    xmlns:controls="clr-namespace:Worker.Mobile.Views.Controls;assembly=Worker.Mobile"
    xmlns:d="http://xamarin.com/schemas/2014/forms/design"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:modals="clr-namespace:Worker.Mobile.ViewModels.Modals;assembly=Worker.Mobile"
    xmlns:models="clr-namespace:Worker.Mobile.Models;assembly=Worker.Mobile"
    xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
    xmlns:translations="clr-namespace:Worker.Mobile.Services.Translations;assembly=Worker.Mobile"
    x:DataType="modals:GoogleMapsPinClickPopUpViewModel"
    mc:Ignorable="d">
    <pages:PopupPage.Animation>
        <animations:ScaleAnimation
            DurationIn="400"
            DurationOut="300"
            EasingIn="SinOut"
            EasingOut="SinIn"
            HasBackgroundAnimation="True"
            PositionIn="Center"
            PositionOut="Center"
            ScaleIn="1.2"
            ScaleOut="0.8" />
    </pages:PopupPage.Animation>
    <!--  You can use any elements here which are extended from Xamarin.Forms.View  -->
    <Frame
        Margin="20,0,20,0"
        Padding="30"
        BackgroundColor="{StaticResource ColorWhite}"
        CornerRadius="30"
        HorizontalOptions="Center"
        VerticalOptions="Center">
        <StackLayout>
            <Label
                FontFamily="{StaticResource MuliSemiBold}"
                FontSize="Large"
                HorizontalOptions="Center"
                HorizontalTextAlignment="Center"
                Style="{StaticResource DefaultLabelStyle}"
                Text="{Binding Title}"
                TextColor="{StaticResource ColorBlack}" />
            <Grid
                Margin="0,15,0,0"
                ColumnDefinitions="*,*"
                HorizontalOptions="FillAndExpand"
                VerticalOptions="FillAndExpand">

                <Button
                    Grid.Column="0"
                    Command="{Binding CloseCommand}"
                    Style="{StaticResource ButtonWhiteBlackCorners}"
                    Text="{translations:Translator Key={x:Static models:M.GenericNo}}" />
                <Button
                    Grid.Column="1"
                    Command="{Binding OkCommand}"
                    Style="{StaticResource ButtonBlack}"
                    Text="{translations:Translator Key={x:Static models:M.GenericYes}}" />
            </Grid>
        </StackLayout>
    </Frame>
</pages:PopupPage>

valentasm1 avatar Nov 05 '21 06:11 valentasm1

It wasn't about the popup page, It resolved when I add the xmlns to the App.xaml.

Erdogan34 avatar Nov 05 '21 09:11 Erdogan34

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/custom-namespace-schemas#consuming-a-custom-namespace-schema

ysmoradi avatar Nov 14 '21 18:11 ysmoradi

I am using Prism with DryIoc (and not unity). Following a suggestion from another thread I replaced

xmlns:prism="http://prismlibrary.com"

with

xmlns:prism="clr-namespace:Prism.DryIoc;assembly=Prism.DryIoc.Forms"

in my App.xaml file and the error disappeared.

I had the same error with PopupPage from Rg.Plugins.Popup, so I also replaced

xmlns:pages="http://rotorgames.com"

with

xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"

and that error disappeared as well.

As these are two different libraries, acting similarly, it might be a general VS issue. But could also be the same error in two libraries.

The link from @ysmoradi says that using a custom namespace requires a direct reference to the assembly through C# code in order for VS to find it and not show this error. I haven't tried it but that might also be a possible solution.

vppetrov avatar Feb 08 '22 09:02 vppetrov

Quote - .."this is indeed unusual, it does seem that Xamarin.Forms 4.8.0.1687 is causing some issue."...

We are up to version 5.0.0.2515 of Xamarin.Forms.

Are you planning to resolve this issue as we cannot keep using alternative code and "tricks" to work around this surely ?

Krammig avatar Oct 05 '22 04:10 Krammig

@Krammig the alternative code is actually I believe the original code that was within Rg.

I no longer maintain Rg as I have been putting my limited time into Mopups, however its interesting that Prism has this issue as well, as @dansiegel was the one who originally introduced the xmlns:pages="http://rotorgames.com" addition to the repo.

I have always relied on using the older version of xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"

LuckyDucko avatar Oct 05 '22 22:10 LuckyDucko