Forms Previewer - 'An exception occurred while rendering the control'

DaveYDaveY david yardyUSUniversity ✭✭

With Visual Studio 2017 (latest rc) - after opening xaml previewer, I am presented with error in the designer 'an exception occurred while rendering the control'. This occurs while trying to view the Android view. I can however view the ios view when my mac build agent is available.

If I click the (!) icon i see a series of exception messages

i.e.
you must call xamarin.forms.init prior to using it
at xamarin.forms.device.get_info()

etc.

Answers

  • DaveYDaveY david yardy USUniversity ✭✭

    Note: this occurs on a brand new xaml forms project (master-detail) based on the template available within the product

  • ClintStLaurentClintStLaurent Clint StLaurent USUniversity ✭✭✭✭✭

    @DaveY

    There are countless threads about Previewer.

    It doesn't work. That's the bottom line.

  • zjxcrosszjxcross Jx Zhang CNMember

    Believe it or not, here is the ultimate (the only) way.

    First, install "Microsoft build tools 2015" from the official website. Then you should download the "Xamarin for visual studio" installer manually (current version is "Xamarin.VisualStudio_4.3.0.784"). Please pay attention, this is very important, you must install the "Xamarin for visual studio" again even though visual studio 2017 already contains it! Finally you should restart visual studio 2017, and the forms previewer will just works fine. I know it is magic, but you should follow the above steps.

    As for me, I start from a clean PC. After installing visual studio 2017, I cannot use the forms previewer anymore. Well everything works fine after I install the "Xamarin for visual studio" manually which has been contained in visual studio 2017.

    By the way, the forms previewer is not mature yet. I cannot use it to preview simple "activity indicator" control and "webview" control in android environment. Although when I use the prism package, I cannot reference the static resource defined in "App.xaml". I used to work with the Gorilla Player, but it doesn't support visual studio 2017. I really hope the Xamarin team can make the forms previewer better for out developers to use.

    Last words: do not forget to set the jdk 1.8 to 64 bit version.
    Have fun with development :-)

  • zjxcrosszjxcross Jx Zhang CNMember

    Believe it or not, here is the ultimate (the only) way.

    First, install "Microsoft build tools 2015" from the official website. Then you should download the "Xamarin for visual studio" installer manually (current version is "Xamarin.VisualStudio_4.3.0.784"). Please pay attention, this is very important, you must install the "Xamarin for visual studio" again even though visual studio 2017 already contains it! Finally you should restart visual studio 2017, and the forms previewer will just works fine. I know it is magic, but you should follow the above steps.

    As for me, I start from a clean PC. After installing visual studio 2017, I cannot use the forms previewer anymore. Well everything works fine after I install the "Xamarin for visual studio" manually which has been contained in visual studio 2017.

    By the way, the forms previewer is not mature yet. I cannot use it to preview simple "activity indicator" control and "webview" control in android environment. Although when I use the prism package, I cannot reference the static resource defined in "App.xaml". I used to work with the Gorilla Player, but it doesn't support visual studio 2017. I really hope the Xamarin team can make the forms previewer better for out developers to use.

    Last words: do not forget to set the jdk 1.8 to 64 bit version.
    Have fun with development :-)

Sign In or Register to comment.