locked
Xaml Internal Error error WMC9999: Object reference not set to an instance of an object.

    Question

  • Hello, I'm tying to set up my DirectX with XAML.

    I've followed this documentation:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh825871.aspx

    http://blogs.msdn.com/b/windowsappdev/archive/2012/03/15/combining-xaml-and-directx.aspx

    http://207.46.22.237/en-us/library/windows/apps/hh780561.aspx


    My app is composed with a static lib where I put all the platform dependent code (application initialization, directX initialization, sound, ...), and then I've the game itself as startup project linked against the static lib.

    My games was not using any XAML file before this, but now in order to accomplish the DirectX-XAML interloop documentation, I had to create  a XAML file inside the static library (which I'm not sure about if that's ok).

    I've setup the following XAML:

    SwapChain.xaml:

    <Page
        x:Class="SwapChain.SwapChainClass"
        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"
        d:DesignWidth="1366"
        d:DesignHeight="768">
    
        <SwapChainBackgroundPanel x:Name="DXSwapChainPanel">
        </SwapChainBackgroundPanel>
    
        
    </Page>

    SwapChainClass.xaml.h:

    #pragma once
    
    #include "SwapChainClass.g.h"
    
    namespace SwapChain
    {
        public ref class SwapChainClass sealed
        {
        public:
            SwapChainClass();
    
            Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ GetSwapChainBackgroundPanel() { return DXSwapChainPanel; };
    
        protected:
            
    
        private:
        };
    }

    SwapChainClass.xaml.cpp:

    #include "SwapChainClass.xaml.h"
    
    using namespace SwapChain;
    
    
    SwapChainClass::SwapChainClass()
    {
        InitializeComponent();
    }


    I think the code is pretty straight forward, but I get the following error in the compiler:

    1>C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v11.0\Microsoft.Windows.UI.Xaml.Common.targets(240,9): Xaml Internal Error error WMC9999: Object reference not set to an instance of an object.

    If I double click on the error VS opens "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v11.0\Microsoft.Windows.UI.Xaml.Common.Targets" file and highlight this line:

    <CompileXaml
                LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
                Language="$(Language)"
                RootNamespace="$(RootNamespace)"
                XamlPages="@(Page)"
                XamlApplications="@(ApplicationDefinition)"
                PriIndexName="$(PriIndexName)"
                ProjectName="$(MsBuildProjectName)"
                IsPass1="False"
                CodeGenerationControlFlags="$(XamlCodeGenerationControlFlags)"
                ClIncludeFiles="@(ClInclude)"
                LocalAssembly="$(LocalAssembly)"
                ProjectPath="$(MSBuildProjectFullPath)"
                OutputPath="$(IntermediateOutputPath)"
                OutputType="$(OutputType)"
                TargetPlatformWinMDLocation="$(TargetPlatformWinMDLocation)"
                ReferenceAssemblyPaths="@(ReferenceAssemblyPaths)"
                ReferenceAssemblies ="@(ReferencePath)"
                ShareAppDomains="$(XamlShareAppDomains)"
                ForceSharedAppDomainShutdown="False"
                CompileMode="RealBuildPass2"
                XAMLFingerprint="$(XAMLFingerprint)"
                VCInstallDir="$(VCInstallDir_110)"
                >

    I'm not using the latest Visual Studio 2012 build (Microsoft Visual Studio Ultimate 2012 RC v: 11.0.50522.1) maybe this is causing troubles?

    Thank you for your help!


    • Edited by Hugetto Tuesday, October 2, 2012 4:04 PM
    Tuesday, October 2, 2012 3:56 PM

All replies

  • Hi,

    I would suggest you to upload your Visual Studio to RTM.
    We can download the new sample codes here
    XAML DirectX 3D shooting game sample
    http://code.msdn.microsoft.com/windowsapps/Metro-style-DirectX-18f98448

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, October 3, 2012 2:52 AM
  • Ok, I'll upgrade my Visual Studio and my Windows to RTM

    Wednesday, October 3, 2012 4:24 PM
  • Hi again, I've uploaded my computer to Windows8 RTM and Visual Studio 2012 RTM but the same issue showed up.

    I'm trying to get rid of the DirectX way of starting the app (main() function) and use the App.xaml, but when I add the xaml to my static lib, the error appear.

    Is there any example about how to do that?

    Can I add .xaml files on a static library?

    Thank you!

    Thursday, October 4, 2012 10:11 AM
  • Any help would be great! :D

    Thank you!

    Wednesday, October 24, 2012 1:57 PM
  • Is that static lib is a WinRT component, how are you referencing that static lib?
    Wednesday, October 24, 2012 7:30 PM