Rg.plugins.popup: An exception occurred while rendering the control

Created on 25 Jul 2018  Â·  13Comments  Â·  Source: rotorgames/Rg.Plugins.Popup

Hello,
I create new project with Prism Quickstart template and I can't preview using Visual Studio Community for Mac.
This is a error:
error_zamarin
It doesn't work on Android as on iOS. The plugin is correctly initialized. This code is in AppDelegate.cs:

   public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
        {
            Rg.Plugins.Popup.Popup.Init();

            global::Xamarin.Forms.Forms.Init();
            global::FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
            global::FFImageLoading.ImageService.Instance.Initialize(new FFImageLoading.Config.Configuration()
            {
                Logger = new Accesos.Services.DebugLogger()
            });

            // Code for starting up the Xamarin Test Cloud Agent
#if DEBUG
            Xamarin.Calabash.Start();
#endif
            LoadApplication(new App(new iOSInitializer()));

            return base.FinishedLaunching(uiApplication, launchOptions);
        }

and this code is in MainActivity.cs

 public class MainActivity : FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.SetFlags("FastRenderers_Experimental");
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            global::FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer: true);
            global::FFImageLoading.ImageService.Instance.Initialize(new FFImageLoading.Config.Configuration()
            {
                Logger = new Accesos.Services.DebugLogger()
            });

            LoadApplication(new App(new AndroidInitializer()));
        }
    }

I using Visual Studio Community for Mac 7.5.4 (build 3) and Xamarin Forms 3.1.0.637273.
What could be the problem? Thanks a lot

bug confirmed

Most helpful comment

Figured out a workaround if you're using prism. Add this prop to your App.xaml.cs:
public bool IsDesignTime => PlatformInitializer == null;
Then in RegisterTypes method bypass RegisterPopupNavigationService at design-time:
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
if (!IsDesignTime)
{
containerRegistry.RegisterPopupNavigationService();
}

This workaround has stopped the issue for me. Thanks.

All 13 comments

Same problem here.
Visual Studio for Mac 7.6.11, Xamarin.Forms 3.1.0.637273., Rg.Plugins.Popup 1.1.4.168

I'm also experiencing this issue on Visual Studio for Mac 7.7 (build 1868), Xamarin.Forms 3.4.0.1008975, Rg.Plugins.Popup 1.1.5.180.

@pablogupi Does it happen only in Xamarin Preview? Does it work on a device or an emulator?

Yes, only in the Designer Preview. On a device or in the emulator the app runs fine.

@karimElJed I confirmed this issue and I was going to fix it soon.

I'm still experiencing this issue – Visual Studio for Mac 7.8 (build 1624), Xamarin.Forms 3.5.0.169047, Rg.Plugins.Popup 1.1.5.188.

@felipesouto I had a look on this issue but I still don't fix it. I hope I will do it in the next release.

Guys. Could you test the last version of the plugin in Development NuGet with the last version of Previewer?

I tested it and it worked fine. I think the Xamarin team has fixed this issue. Please give me actual feedback. Thanks.

Hi, I'm experiencing this issue also. How can we get the latest version of Previewer in Visual Studio 2017 to test this?
Visual Studio 2017 - 15.9.12
Xamarin.Forms - 3.6.0.344457
Rg.Plugins.Popup - 1.1.5.188
Prism.Plugins.Popup - 2.2.0.293

Hi all, I'm seeing this in VS 2019 for Mac. The previewer works but warning always appears. However a college using VS2017 Windows is saying the previewer is not loading.
Thanks

Figured out a workaround if you're using prism. Add this prop to your App.xaml.cs:
public bool IsDesignTime => PlatformInitializer == null;
Then in RegisterTypes method bypass RegisterPopupNavigationService at design-time:
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
if (!IsDesignTime)
{
containerRegistry.RegisterPopupNavigationService();
}

containerRegistry.RegisterSingleton<ILoggingService, AppCenterLoggingService>();

Figured out a workaround if you're using prism. Add this prop to your App.xaml.cs:
public bool IsDesignTime => PlatformInitializer == null;
Then in RegisterTypes method bypass RegisterPopupNavigationService at design-time:
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
if (!IsDesignTime)
{
containerRegistry.RegisterPopupNavigationService();
}

This workaround has stopped the issue for me. Thanks.

I tested it with the last version of XF and VS4Mac and I didn't get this issue.

I'll close it but don't be afraid to reopen it again if you still get this issues guys.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IaamRich picture IaamRich  Â·  6Comments

luis-barreira picture luis-barreira  Â·  5Comments

DevendraMaran picture DevendraMaran  Â·  4Comments

VladislavAntonyuk picture VladislavAntonyuk  Â·  3Comments

TosinM picture TosinM  Â·  5Comments