Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Xamarin.Forms Previewer doesn't work since I use PCLAppConfig #22

Open
Juansero29 opened this issue Apr 24, 2019 · 2 comments
Open

Comments

@Juansero29
Copy link

When trying to render any page (even a newly created page with only a label inside) and using the PCLAppConfig NuGet, the Xamarin.Forms Previewer fails to render the controls since it tries to search for the App.config file and it doesn't find it.

As seen in the image below, I get a System.IO.FileNotFoundException when opening the Xamarin.Forms Previewer. This has the same behavior on any page and seems to come from the PCLAppConfig.FileSystemStream.AndroidAppConfigPathExtractor.get_Path() method called by PCLAppConfig.FileSystemStream.PortableStream.CreateAppConfigStream() method.

xamarin previewer pclconfig

I do have the App.config file in both my Android and iOS projects but still it refuses to render my pages and controls.

I think the problem can be fixed by adding a design mode condition in the PCLAppConfig.FileSystemStream.PortableStream.CreateAppConfigStream() method so that it returns if we're in design mode and doesn't try to search for the file . You can use DesignMode.IsDesignModeEnable and use it as shown on this XAML Previewer page to make the Xamarin.Forms Previewer work again.

As a hint, you can open any XAML file in the Xamarin.Forms Previewer by right clicking the file, choose "Open with..." and then choosing "Xamarin.Forms Previewer". You can also set it as default if wanted to make some tests.

A fix would be really appreciated since me and my team would want to test the new capabilities of VS2019 to render pages and controls via the previewer. Thanks!

@soroshsabz
Copy link
Contributor

ITNOA

@mrbrl did you can take some workaround about this problem?

thanks a lot :)

@soroshsabz
Copy link
Contributor

@Juansero29 Did you try new version of this package? Did you problem still exist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants