CreateImageResources task has failed

Ranorex Spy, Recorder, and Studio.
ElSticky
Posts: 34
Joined: Tue Sep 17, 2013 1:45 pm

CreateImageResources task has failed

Post by ElSticky » Thu Mar 19, 2015 1:07 pm

I'm getting a warning when building my test solution with following message:
The "CreateImageResources" task failed unexpectedly.
System.Xml.XmlException: '', hexadecimal value 0x1E, is an invalid character. Line 4054, position 285.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Char[] data, Int32 length, Int32 invCharPos)
at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at Ranorex.Core.Repository.ElementRepository.RepositoryXmlReader..ctor(String repoFilePath)
at Ranorex.Core.Repository.ElementRepository.UpdateImageResource(String repoFilePath, String outputDirectory)
at Ranorex.MSBuildTasks.CreateImageResources.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) (MSB4018) - C:\Program Files (x86)\MSBuild\Ranorex5\Ranorex.MSBuild.Targets:1
I think because of this the images (.rximgres file) made to recognize some elements do not are not recreated/refreshed anymore. Does someone know how to solve this? Double clicking the message redirects to the following file but I don't know what's wrong:

Code: Select all

 <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <UsingTask
        TaskName="Ranorex.MSBuildTasks.GetRxSearchPaths" 
        AssemblyFile="$(MSBuildExtensionsPath)\Ranorex5\Ranorex.MSBuildTasks.exe"/>
    <UsingTask
        TaskName="Ranorex.MSBuildTasks.CreateImageResources"
        AssemblyFile="$(MSBuildExtensionsPath)\Ranorex5\Ranorex.MSBuildTasks.exe"/>

    <PropertyGroup>
        <InitRxSearchPathsDependsOn>$(ResolveAssemblyReferencesDependsOn)</InitRxSearchPathsDependsOn>
        <ResolveAssemblyReferencesDependsOn>InitRxSearchPaths</ResolveAssemblyReferencesDependsOn>
        <BuildDependsOn>CreateImageResources;$(BuildDependsOn)</BuildDependsOn>
        <CleanDependsOn>$(CleanDependsOn);RemoveImageResources</CleanDependsOn>
    </PropertyGroup>

    <Target Name="InitRxSearchPaths" DependsOnTargets ="$(InitRxSearchPathsDependsOn)">
        <GetRxSearchPaths SearchPaths="$(AssemblySearchPaths)">
            <Output TaskParameter="SearchPaths" PropertyName="AssemblySearchPaths"/>
        </GetRxSearchPaths>
    </Target>

    <Target Name="RemoveImageResources">
        <ItemGroup>
            <Content Remove="RepositoryImages\*.rximgres"/>
        </ItemGroup>
        <RemoveDir Directories="$(OutDir)RepositoryImages" ContinueOnError="true"/>
        <RemoveDir Directories="RepositoryImages" ContinueOnError="true"/>
    </Target>

    <ItemGroup>
        <Content Include="RepositoryImages\*.rximgres" >
            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
    </ItemGroup>

    <Target Name="CreateImageResources">
        <ItemGroup>
            <AllItems Include="@(None);@(Content)" Condition="'%(Extension)'=='.rxrec' or '%(Extension)'=='.rxrep'"/>
        </ItemGroup>
        <RemoveDuplicates Inputs="@(AllItems)">
            <Output TaskParameter="Filtered" ItemName="FilteredItems"/>
        </RemoveDuplicates>
        <CreateImageResources FileItems="@(FilteredItems)"
                              OutputDirectory="$(MSBuildProjectDirectory)"
                              ContinueOnError="true"/>
        <ItemGroup>
            <Content Include="RepositoryImages\*.rximgres" >
                <CopyToOutputDirectory>Always</CopyToOutputDirectory>
            </Content>
        </ItemGroup>
    </Target>
</Project>

ElSticky
Posts: 34
Joined: Tue Sep 17, 2013 1:45 pm

Re: CreateImageResources task has failed

Post by ElSticky » Fri Apr 03, 2015 1:43 pm

It seemed there was a problem with one of the items in my Repository. I started deleting items one by one to see which one was wrong (by copying the repository in a new project first, as the warning immediately appeared there too I knew it should be something with the repository).

The warning still remains on another line in the project but the problem to that my rximgres file wasn't created anymore was solved so it's not really a problem anymore