Xamarin.forms: Orange "MockView" showed while previewing any page or control in Android mode

Created on 6 Apr 2020  路  34Comments  路  Source: xamarin/Xamarin.Forms

Description

Starting with either a recent Visual Studio upgrade or a recent Xamarin.Forms version (unsure which), any time I preview a page or user control with "Android" selected, all I see is an orange screen which says "MockView" in the middle. There are Java stack traces in the AndroidDesigner log when the designer is first opened.

Steps to Reproduce

  1. Create a new Xamarin.Forms project targeting Android
  2. Open MainPage.xaml
  3. Previewer will go through its initialization phase, and after "Setting up renderer" finishes, an orange screen labeled "MockView" will display instead of the page

Expected Behavior

Pages and controls will preview correctly in the XAML Previewer.

Actual Behavior

See screenshot below

Basic Information

I have tested this on a brand new fresh Xamarin.Forms project immediately prior to posting this bug report. I also uninstalled and reinstalled the Xamarin component in the Visual Studio installer prior to testing, and ensured that Visual Studio and all components are up-to-date.

  • Version with issue: Xamarin Designer 16.5.0.470
  • Last known good version: Unsure
  • IDE: Visual Studio 2019 16.5.2
  • Platform Target Frameworks:

    • Android: API 28

  • Nuget Packages: Xamarin.Forms 4.5.0.530, Xamarin.Essentials 1.5.2
  • Affected Devices: None (development-time only)

Screenshots

image

Logs

https://gist.github.com/briman0094/b3b4992421f511f8e7c4d319d7b169b9

Reproduction Link

Any new Xamarin.Forms project, no changes made from the "new project" template whatsoever.

VS bug #1093604

forms-previewer high impact unverified

Most helpful comment

Closed? I have the same issue, please update if it's been fixed on the next release.

All 34 comments

doesn't support androidx project?

I have the same exact problem in:
IDE: Visual Studio 16.5.4
Xamarin.Forms 4.5.0.617
Xamarin.Essentials 1.5.2
JDK 14 is installed
Latest android build tools installed

Exact same versions as previous comment, but MockView appears for me after a XAML exception has taken place, restarting, then it appears. It disappeared when I launched VS again this morning.

Same situation. Restart doesn't help. No exceptions.

Same situation. Restart doesn't help. No exceptions.

We have the same problem. The XAML Previewer is basically useless for Android, while it works fine for the iOS page.
The weird part is that it seems to be dependent on the solution, where preview of the same simple page (just a label and a button or something similar, no custom controls) works in one solution but not the other. Cleaning/Rebuilding/Debug mode does NOT help.

Visual Studio version: Windows, 16.5.4

Same problem here with Visual Studio for Windows, Version 16.5.4... All XAML previews just show a centered "MockView" text centered over a orangish color. Clean-rebuild solution does not work.

Same Problem. Nothing helps.

I have the same problem, after update of Visual Studio 16.5.4
If I create a new project the Xamarin Forms Previewer works correctly.

Throwing it in there that I'm having this issue too, I suspect it is also after an update, since I used to be able to use it without issue.

The issue persists even on a fresh install of Windows, VS2019 and new project, so I can only assume that something broke in an update somewhere..

Closed? I have the same issue, please update if it's been fixed on the next release.

Why is this closed?

The problem persists even in version:
VS: 16.6.0 and even in preview 16.7.1
Xamarin forms: 4.6.0.800

Please reopen and fix this issue!

Same for me. VS 16.6 with Xamarin forms 4.6.0.800 and still Mockview for each xaml page.
BTW: I'm using windows 7 - could this be the problem? Is win 10 required?

Same for me. VS 16.6 with Xamarin forms 4.6.0.800 and still Mockview for each xaml page.
BTW: I'm using windows 7 - could this be the problem? Is win 10 required?

I am using windows 10 with all the updates installed,
I don't think that OS is the issue..

Definitely not the OS.
Also have VS 16.6 with latest updates and windows 10.

I do suspect its Android X update, as it was working fine before the upgrade.

I got the same issue. Nothing helps. Does MS going to fix it?

Looks like it's fixed now, run your Visual Studio Installer to check for updates.

Looks like it's fixed now, run your Visual Studio Installer to check for updates.

Sir,
At the time of your comment, the latest VS version is 16.6.0 and the latest preview version is 16.7.0

Both are mentioned in the comments above by at least two different people as having the issue still..

Have you confirmed that the issue disappeared at your machine?
If so, then please share with us the version you're using and any detail that may help us get it working at our machines as well.

Thanks in advance.

For me. updating VS to the latest (16.6.0), setting the Android Manifest -> Target Android Version to 10.0 (API level 29), and having Xamarin Forms nuget at or over 4.5 allowed the MockView screen to go away. (I think it's the android target version that helped for me)

But it is replaced with a different screen, that actually displays the errors. If the page has no controls in it at all, it works fine.

I'm unable to copy the error, but it complains about control renderers.
image

Microsoft Visual Studio Community 2019
Version 16.6.0
VisualStudio.16.Release/16.6.0+30114.105
Xamarin 16.6.000.1055 (d16-6@2873694)
Xamarin Designer 16.6.0.318 (remotes/origin/d16-6@66afc5421)
Xamarin Templates 16.6.40 (1f1466f)
Xamarin.Android SDK 10.3.1.0 (d16-6/3fe860a)

No problem with this config at the moment.

My original project that prompted me to create the issue in the first place seems to be resolved as of 16.6.1; I just updated today and I can see the previewer again.

I updated to:16.6.1 now and the issue still persists..

I updated to:16.6.1 now and the issue still persists..

same here

Visual studio version: 16.6.2
Xamarin.Forms version: 4.7.0.968
Xamarin.Essentials version: 1.5.3.2

Still the issue persists, mock view in the previewer..

Microsoft Visual Studio Community 2019
Version 16.6.4
The problem persists

Microsoft Visual Studio Community 2019
Version 16.7.0

The problem is solved finally! Thanks..

Microsoft Visual Studio Community 2019
Version 16.7.1
The problem persists

Microsoft Visual Studio Community 2019
Version 16.7.2
The problem persists

Microsoft Visual Studio Community 2019, problem still exists
I fixed it by updating with the installer, I guess repair will work the same

My two computers have the same problem too... This problem even persists in newest version of VS...

My two computers have the same problem too... This problem even persists in newest version of VS...

@102464 have you tried using the repair function from the VS-installer?

Not yet... I'll try

Did anyone resolve this? I did a reinstall still have the same problem.

Was this page helpful?
0 / 5 - 0 ratings