locked
"Object reference not set to an instance of an object" for Microsoft.Windows.UI.Xaml.Common.targets

    Question

  • I cannot not build a portable library for universal apps due to the following error:

    Error	133	Object reference not set to an instance of an object.	C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\8.1\Microsoft.Windows.UI.Xaml.Common.targets	327	9	ClassLibraryUniversal

    Line 327 column 9 is the  CompileXaml as following:

    <CompileXaml
                    LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
                    Language="$(Language)"
                    RootNamespace="$(RootNamespace)"
                    XamlPages="@(Page)"
                    XamlApplications="@(ApplicationDefinition)"
                    SdkXamlPages="@(SdkXamlItems)"
                    PriIndexName="$(PriIndexName)"
                    ProjectName="$(MsBuildProjectName)"
                    IsPass1="False"
                    DisableXbfGeneration="$(DisableXbfGeneration)"
                    CodeGenerationControlFlags="$(XamlCodeGenerationControlFlags)"
                    ClIncludeFiles="@(ClInclude)"
                    CIncludeDirectories="$(XamlCppIncludeDirectories)"
                    LocalAssembly="$(LocalAssembly)"
                    ProjectPath="$(MSBuildProjectFullPath)"
                    OutputPath="$(XamlGeneratedOutputPath)"
                    OutputType="$(OutputType)"
                    ReferenceAssemblyPaths="@(ReferenceAssemblyPaths)"
                    ReferenceAssemblies="@(XamlReferencesToCompile)"
                    ForceSharedStateShutdown="False"
                    CompileMode="RealBuildPass2"
                    XAMLFingerprint="$(XAMLFingerprint)"
                    FingerprintIgnorePaths="$(XAMLFingerprintIgnorePaths)"
                    VCInstallDir="$(VCInstallDir)"
                    SavedStateFile="$(XamlSavedStateFilePath)"
                    RootsLog="$(XamlRootsLog)"
                    SuppressWarnings="$(SuppressXamlWarnings)"
                    >
                <Output Condition=" '$(ManagedAssembly)'!='false' " ItemName="Compile"   TaskParameter="GeneratedCodeFiles" />
                <Output Condition=" '$(ManagedAssembly)'=='false' " ItemName="XamlGFiles" TaskParameter="GeneratedCodeFiles" />
    
                <!--
          FileWrites is used in Microsoft.Common.Targets for "Clean" build 
          -->
                <Output ItemName="FileWrites" TaskParameter="GeneratedCodeFiles" />
                <Output ItemName="FileWrites" TaskParameter="GeneratedXamlFiles" />
                <Output ItemName="FileWrites" TaskParameter="GeneratedXbfFiles" />
                <Output ItemName="_GeneratedCodeFiles" TaskParameter="GeneratedCodeFiles" />
                <Output ItemName="_GeneratedXamlFiles" TaskParameter="GeneratedXamlFiles" />
                <Output ItemName="_GeneratedXbfFiles" TaskParameter="GeneratedXbfFiles" />
            </CompileXaml>

    I noticed that Microsoft.Windows.UI.Xaml.Common.targets was modified on 2014-03-12.  Can I delete this file and somehow recreate it?  This files is supposed to be untouched. 

    Could anyone shed some light on this?


    Hong


    Wednesday, June 4, 2014 4:26 PM

Answers

  • Thanks for the tip, Jeff. I was just about to report back regarding this.

    Since this problem paralyzed an ongoing project, so I had no choice but resolving it first.  To put a very long storyshort, I found the culprit is the following:

    <TextBlock FontSize="15" Foreground="Red" TextWrapping="Wrap"
                               Text="{Binding (WinRTXAMLToolkitExtensions:FieldValidationExtensions.PatternErrorMessage), ElementName=tbEmail}"
                               Visibility="{Binding (WinRTXAMLToolkitExtensions:FieldValidationExtensions.ValidationMessageVisibility), ElementName=tbEmail}"></TextBlock>

    This is invalid.  I was in the processing of porting code from another library, the problem occurred before I had the chance to fix this code.  It is strange that the aforementioned error was the only error when the portable library was built, so I did not get any clue from the building that the above code was invalid.  However, after straightening out everything, I put the invalid code back to ensure it is reproducible, and I got Error 133 AND  errors regarding the invalid XAML code.

    The way I tracked down the culprit is that I excluded all files from the library project, then added them back one at a time until the error appeared.

    I guess that one lesson here is that sometimes you cannot take the building error messages literally. 



    Hong

    Thursday, June 5, 2014 2:11 PM

All replies

  • An update may have touched this file.

    My guess is that you have some other issue.  Has this ever built before?


    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Thursday, June 5, 2014 12:40 PM
    Moderator
  • Thanks for the tip, Jeff. I was just about to report back regarding this.

    Since this problem paralyzed an ongoing project, so I had no choice but resolving it first.  To put a very long storyshort, I found the culprit is the following:

    <TextBlock FontSize="15" Foreground="Red" TextWrapping="Wrap"
                               Text="{Binding (WinRTXAMLToolkitExtensions:FieldValidationExtensions.PatternErrorMessage), ElementName=tbEmail}"
                               Visibility="{Binding (WinRTXAMLToolkitExtensions:FieldValidationExtensions.ValidationMessageVisibility), ElementName=tbEmail}"></TextBlock>

    This is invalid.  I was in the processing of porting code from another library, the problem occurred before I had the chance to fix this code.  It is strange that the aforementioned error was the only error when the portable library was built, so I did not get any clue from the building that the above code was invalid.  However, after straightening out everything, I put the invalid code back to ensure it is reproducible, and I got Error 133 AND  errors regarding the invalid XAML code.

    The way I tracked down the culprit is that I excluded all files from the library project, then added them back one at a time until the error appeared.

    I guess that one lesson here is that sometimes you cannot take the building error messages literally. 



    Hong

    Thursday, June 5, 2014 2:11 PM
  • Excellent you resolved this and I am sure your notes will help others if they bump into something similar.  Thanks for sharing!

    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)


    Thursday, June 5, 2014 2:19 PM
    Moderator