Bug 44588 - Xamarin.Forms Previewer Not functioning in VS2015
Summary: Xamarin.Forms Previewer Not functioning in VS2015
Status: RESOLVED DUPLICATE of bug 47188
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Designer Integration ()
Version: 4.2.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: 4.3.0 (C9)
Assignee: Adrian Alonso
URL:
Depends on:
Blocks:
 
Reported: 2016-09-21 17:31 UTC by NTSK
Modified: 2017-01-06 12:31 UTC (History)
9 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Visual Studio 2015 logs for Xamarin Previewer (3.54 KB, application/zip)
2016-09-21 18:37 UTC, NTSK
Details
List of installed products inside VS 2015 (5.33 KB, text/plain)
2016-10-07 15:13 UTC, NTSK
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 47188

Description NTSK 2016-09-21 17:31:52 UTC
Xamarin.Forms Previewer doesn't show a live Android render of any XAML file in Windows Visual Studio 2015. 

No error message is displayed - I just see "Android Phone" in the center of the Previewer display.

I've tested on Xamarin Studio on my Mac - I can get iOS to work on there, but Android gives me the message "XamarinFormsTooOldException", despite Xamarin.Forms being the most recent prerelease on the project (and iOS works, so this seems odd).

I've tried creating a blank project, & the same behavior persists. Let me know if there's a logfile or any other info I can retrieve to assist, thanks!
Comment 1 Alan McGovern 2016-09-21 17:43:45 UTC
Can you click on Help -> Zip Xamarin Logs, or something like that,  and attach those here? That'll help us figure it out.

Thanks!
Comment 2 NTSK 2016-09-21 18:24:15 UTC
Will do - give me a min (I see errors but they aren't being generated live while I'm experiencing issues, just inspecting the logs myself for a min..)
Comment 3 NTSK 2016-09-21 18:35:44 UTC
OK - wasn't getting any new exceptions until I re-built the solution (after closing/reopening VS). 

Attached are the logs you are looking for - the only interesting thing I see is the "Unexpected exception trying to swap text buffers". 

I also find it interesting that the Mono Android process totally ignores my Xamarin setting for the actual Android SDK location (E:\Android\sdk) & just tries to find it via the registry first..
Comment 4 NTSK 2016-09-21 18:37:11 UTC
Created attachment 17649 [details]
Visual Studio 2015 logs for Xamarin Previewer
Comment 5 Alan McGovern 2016-09-21 18:39:25 UTC
VS guys: Any idea why this would fail? The previewer can't function if it doesn't know what file is active:

Xamarin.VisualStudio.Forms.Previewer.PreviewerToolWindow Error: 0 : [2016-09-21 11:29:17.9815] Unexpected exception trying to swap text buffers for the Xamarin.Forms previewer
System.Collections.Generic.KeyNotFoundException: key
   at Microsoft.VisualStudio.Utilities.PropertyCollection.GetProperty(Object key)
   at Microsoft.VisualStudio.Text.ITextBufferExtensions.GetFilePath(ITextBuffer textBuffer) in C:\data\lanes\3513\c4382f51\source\xamarinvs\src\Features\VisualStudio.Forms.Previewer\ITextBufferExtensions.cs:line 75
   at Xamarin.VisualStudio.Forms.Previewer.PreviewerToolWindow.<>c__DisplayClass42_0.<ActiveDocumentChanged>b__0(ITextView t) in C:\data\lanes\3513\c4382f51\source\xamarinvs\src\Features\VisualStudio.Forms.Previewer\PreviewerToolWindow.cs:line 290
Comment 6 NTSK 2016-09-29 21:10:42 UTC
Any ideas here? Am I the only one experiencing this? 

If so, I'm be tempted to reinstall VS 2015 or whatever is necessary, but if it's honest-to-goodness bug then it wouldn't be worth it. 

The Previewer would be a fantastic addition for my purposes of multiplatform development - React Native essentially gets that for free with JS only updates, but I prefer the Xamarin platform & MS support..
Comment 7 Adrian Alonso 2016-09-29 22:28:12 UTC
Could you please confirm if you get the same result by opening the xaml file unfolded by the Blank Xaml App (Portable) included in the PCL project?

And also please could you attach the Installed Products information (Help -> About Microsoft Visual Studio and then click the "Copy Info" button). Thanks! Adrian
Comment 8 NTSK 2016-10-07 15:11:31 UTC
Sorry about the delay -

Yes, the behavior was the same (Blank Xaml App (Xamarin.Forms Portable) ). Same error message: 

Xamarin.VisualStudio.Forms.Previewer.PreviewerToolWindow Error: 0 : [2016-10-07 08:07:14.4622] Unexpected exception trying to swap text buffers for the Xamarin.Forms previewer
System.Collections.Generic.KeyNotFoundException: key
   at Microsoft.VisualStudio.Utilities.PropertyCollection.GetProperty(Object key)
   at Microsoft.VisualStudio.Text.ITextBufferExtensions.GetFilePath(ITextBuffer textBuffer) in c:\Users\builder\data\lanes\3822\3b7df6f5\source\xamarinvs\src\Features\VisualStudio.Forms.Previewer\ITextBufferExtensions.cs:line 75
   at Xamarin.VisualStudio.Forms.Previewer.PreviewerToolWindow.<>c__DisplayClass42_0.<ActiveDocumentChanged>b__0(ITextView t) in c:\Users\builder\data\lanes\3822\3b7df6f5\source\xamarinvs\src\Features\VisualStudio.Forms.Previewer\PreviewerToolWindow.cs:line 290

I'm attaching the Installed Products as InstallProducts.txt.

In the meantime I will try disabling extensions/plugins & see if the behavior changes..
Comment 9 NTSK 2016-10-07 15:13:42 UTC
Created attachment 17934 [details]
List of installed products inside VS 2015

Main 3rd party extensions in use:
-Resharper
-Reflector
-Chutzpah
-Add new File

The rest I can probably do without. (though most look like defaults)
Comment 10 NTSK 2016-10-14 21:46:48 UTC
I also disabled these extensions & the behavior persists - does this work for you guys?
Comment 11 Neil 2016-12-25 00:49:38 UTC
This bug is extremely annoying! We don't want to buy a Mac to preview an Android app!
Comment 12 Adrian Alonso 2016-12-30 12:58:33 UTC
@NTSK: we have been doing many fixes/improvements in the Previewer integration. Could you please give it a try and let us know if it works as expected now?

@abhirao1: I understand the issue but I think we should open a different bug for it. I will talk with the designer guys and see if we can do something to resolve this situation in the next release cycle. Thanks.

https://bugzilla.xamarin.com/show_bug.cgi?id=51158
Comment 13 Adrian Alonso 2016-12-30 14:23:29 UTC
@abhirao1: I just checked and we're currently supporting the preview of the Android files without having an active connection to the Mac.

I thought you were talking about that issue. But probably you were talking about that you don't want to switch to the mac in order to use the Previewer.

Anyway we will review how we can improve the experience in VS and also the error handling.

Are you getting the same error the user NTSK is commenting in the first comment? As a general workaround that usually works, you could try to ensure the project is built and reopen the current .xaml file. Please let us know the errors that you're getting so we can try to reproduce them and also try to provide some workaround for you.

Thanks,
Adrian
Comment 14 Alan McGovern 2017-01-06 12:31:01 UTC
The only issue i can see in this is a duplicate of bug #47188

*** This bug has been marked as a duplicate of bug 47188 ***