locked
MainPage.xaml throws an error while loading designer.

    Question

  • Hello,

    I am new to WIndows store app development.

    I am creating a sample windows store App using VC++ UAP using Visual Studio 2015 CTP5. 

    MainPage.xaml throws an error while loading the designer:

    "The element [Grid] could not be displayed because of a problem with WIndows..UI.Xaml.Control.Grid"

    Exception:

    NullReferenceException: Object reference not set to an instance of an object.
    
    at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsStoreXamlPlatform.get_ThemeResources()
       at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.ClrObjectInstanceBuilder.FindInstantiatedResource(IInstanceBuilderContext context, ViewNode viewNode, DocumentNode documentNode, DocumentNode keyNode)
       at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.ClrObjectInstanceBuilder.UpdatePropertyOrChildValue(IInstanceBuilderContext context, ViewNode viewNode, IProperty propertyKey, Int32 childIndex, DocumentNodeChangeAction action, DocumentNode valueNode, ViewNode& childViewNode, IInstanceBuilder& valueBuilder, Boolean& isNewInstance)
       at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.ClrObjectInstanceBuilder.UpdateProperty(IInstanceBuilderContext context, ViewNode viewNode, IProperty propertyKey, DocumentNode valueNode)
       at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.DependencyObjectInstanceBuilderBase`1.UpdateProperty(IInstanceBuilderContext context, ViewNode viewNode, IProperty propertyKey, DocumentNode valueNode)
       at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.InstanceBuilders.FrameworkElementInstanceBuilder.UpdateProperty(IInstanceBuilderContext context, ViewNode viewNode, IProperty propertyKey, DocumentNode valueNode)
       at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.ClrObjectInstanceBuilder.InstantiateProperties(IInstanceBuilderContext context, ViewNode viewNode, DocumentCompositeNode compositeNode)
       at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.ClrObjectInstanceBuilder.Initialize(IInstanceBuilderContext context, ViewNode viewNode, Boolean isNewInstance)
       at Microsoft.VisualStudio.DesignTools.Platform.InstanceBuilders.ViewNodeManager.InitializeInstance(IInstanceBuilder builder, ViewNode viewNode, Boolean isNewInstance)

    The default contents of MainPage.Xaml for windows 8.1 project is :

    <Page
        x:Class="HelloWorld.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:HelloWorld"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
    
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    
        </Grid>
    </Page>

    The windows Phone 8.1 project loads the MainPage.xaml correctly. What is wrong with MainPage.xaml of Windows 8.1 project ?

    Thanks,

    Kunal


    Wednesday, March 18, 2015 6:53 AM

Answers

  • There is nothing wrong with the code.

    >> using Visual Studio 2015 CTP5. 

    You're using a beta version of Visual Studio. Try using VS2013 instead. There's probably a bug.

    It could also be a problem with your Visual Studio install. Try repairing and/or reinstalling.

    Does taking out the Background property fix the issue? (i.e. just leave a completely empty grid)


    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.

    • Marked as answer by Kunal S Thursday, March 19, 2015 6:30 AM
    Wednesday, March 18, 2015 10:49 AM

All replies

  • There is nothing wrong with the code.

    >> using Visual Studio 2015 CTP5. 

    You're using a beta version of Visual Studio. Try using VS2013 instead. There's probably a bug.

    It could also be a problem with your Visual Studio install. Try repairing and/or reinstalling.

    Does taking out the Background property fix the issue? (i.e. just leave a completely empty grid)


    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.

    • Marked as answer by Kunal S Thursday, March 19, 2015 6:30 AM
    Wednesday, March 18, 2015 10:49 AM
  • Yes.. removing Background property fixed the issue.. 

    Will try repairing VS2015.

    Thanks,

    Kunal

    Thursday, March 19, 2015 6:29 AM
  • I'm curious - did repairing it fix the issue?  I just noticed the exact same thing so I'm assuming it has to be a bug in CTP6.
    Wednesday, April 01, 2015 7:32 PM
  • I get the same error with a C# project. Most annoying.
    Friday, April 10, 2015 10:36 PM
  • If you're using VS 2015 CTP6 on Windows 10 build 10049 the XAML designer is completely broken. It's a known bug with that build. Even VS2013 doesn't work for me on that build. The only solution I found was to go back to build 10041.

    Visit http://blog.grogansoft.com/ for Windows development fun.

    Saturday, April 11, 2015 12:07 AM