0

I have a Windows phone 8 Silverlight App that I'm trying to convert to Windows Universal Apps. I used a free tool from this website http://www.mobilize.net/silverlight which helps with the transition but I've encountered a weird error.

I've already searched through other posts and everyone seem to get this to work.. but those solutions aren't working for me... let me explain.

I have lots of Pages in my project and they all show the same error, different from the App.xaml.cs page.

In App.xaml.cs enter image description here

In Main.xaml.cs enter image description here

This is a link to another post with some solutions BlankPage constructor cannot initialize components

Now I checked my App.xaml and MainPage.xaml and they are correct according to the solution for everyone elese.

This is App.xaml first line:

<Application x:Class="StayMobileWP81.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="using:System" xmlns:local="using:StayMobileWP81">

And this is MainPage.xaml first line:

<Page x:Class="StayMobileWP81.Main" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" p2:SystemTray.BackgroundColor="#AF252B" p2:SystemTray.ForegroundColor="White" xmlns:p1="using:Microsoft.Phone.Shell" xmlns:p2="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">

Both .cs files I use namespace StayMobileWP81.

Still having this error... And I tried to change Entrypoint in the Package.appxmanifest to point to "StayMobileWP81.App" and still nothing... It's currently pointing to Main.xaml

I also saw in another post that I had to change Build Action property to Page for InitializeComponet to work but, in my case, they were already set to Page in Main.xaml and ApplicationDefinition in App.xaml.

Does anyone know what am I missing here?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
rickrvo
  • 543
  • 3
  • 17
  • Delete the `obj` folder and rebuild the project. Also check to make sure your namespaces match for the pages, their code behind and their generated code. – Nkosi May 12 '16 at 04:37
  • I've deleted all obj folders and the error is the same when I recompile. the generated code you are referring is the files in the obj folder? the obj folder has lots of *.g.cs files with size of 0kb. only 2 .cache files have information in them (both related to resolve assembly) . – rickrvo May 16 '16 at 18:13
  • The `.g.cs` files are typically generated from Xaml. Try doing a clean. If that doesn't work, delete the bin & obj directories in your solution, then do a full rebuild. – Nkosi May 16 '16 at 18:29
  • I already did that. The build fails since I have lots of lines to go through due to the conversion from WP8 silverlight... I've managed to make one simple page to not show this InitializeConponent error. but the next day when I opened up the project again it showed the error again.... Could this be a Visual Studio 2015 bug? – rickrvo May 19 '16 at 21:34
  • It definitely looks that way. – Nkosi May 19 '16 at 21:35
  • 1
    Damn this sucks... I'll keep cleaning up the other errors and hope to see if at any time this is fixed. I'll update this post when I find something. thanks Nkosi – rickrvo May 19 '16 at 21:42
  • Glad to help. I'm curious about how you get this resolved. I'm staying on VS2013 because of issues like this till they get them resolved. – Nkosi May 19 '16 at 22:04
  • Yeah.. but to use Mobilize.Net to convert the project from silverlight to universal I had to update to VS2015 otherwise it doesn't work. – rickrvo May 20 '16 at 19:33

0 Answers0