Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8480365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:16:31+00:00 2026-06-10T19:16:31+00:00

The whole error message is here: There was an error while deserializing intermediate XML.

  • 0

The whole error message is here:

There was an error while deserializing intermediate XML. Cannot find type
"WindowsGame1.Tile".

I’m making an XNA game, and right now I’m trying to load in a tile-based level from an xml file. Right now, my xml file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<XnaContent>
  <Asset Type="WindowsGame1.Tile">
    <Tile>
      <X>0</X>
      <Y>0</Y>
      <ImageName>grass-tile</ImageName>
    </Tile>
  </Asset>
</XnaContent>

And my C# file looks like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace WindowsGame1
{
    public class Tile
    {
        public int x;
        public int y;
        public string imageName;

        public int X
        {
            get { return x; }
            set { x = value; }
        }

        public int Y
        {
            get { return y; }
            set { y = value; }
        }
        public string ImageName
        {
            get { return imageName; }
            set { imageName = value; }
        }
    }
}

I have a class that uses the XPath libraries to parse the xml file and make Tile’s out of it, but it’s all commented out right now because the xml stuff doesn’t work anyways. In my Game1 class I tried importing:

using WindowsGame1.Tile;

and referencing:

Tile tile;

This tile class, as per a suggestion I found while trying to find a solution to this, but I’m still getting the same error, and my game won’t build. Anyone know what I need to change to get this XML stuff working?

Here’s what the code that should be parsing the XML should look like, though at the moment, it’s all commented out until I can get it to compile.

namespace WindowsGame1
{
    class ActionScreen : GameScreen
    {
        public ActionScreen(Game game, SpriteBatch spriteBatch, String file,  AnimatedSprite sprite)
            : base(game, spriteBatch)
        {
            this.file = file;
            this.sprite = sprite;
            initializeTiles();
        }

        private void initializeTiles()
        {
            XPathDocument doc = new XPathDocument(file);
            XPathNavigator nav = doc.CreateNavigator();
            XPathNodeIterator iter = nav.Select("tile");

            while (iter.MoveNext())
            {
                int x, y;
                string fileName;

                x = int.Parse(iter.Current.GetAttribute("X", ""));
                y = int.Parse(iter.Current.GetAttribute("Y", ""));
                fileName = iter.Current.GetAttribute("ImageName", "");

                Console.WriteLine(x + " " + y + " " + fileName);
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:16:33+00:00Added an answer on June 10, 2026 at 7:16 pm

    It looks like you’re trying to use the XNA content pipeline to build the XML file as content – so my answer will skip all the XPath stuff you metioned – you don’t need it.

    The “deserializing” that the error is referring to is when the content pipeline is trying to convert your XML into an object instance. It then takes that object and writes it out to an XNB file. Later on, when your game runs it will load that XNB file back into an object instance.

    An instance of which object? Well, in your case, a WindowsGame1.Tile object. How does the content pipeline know what a WindowsGame1.Tile object is? It doesn’t – not unless you tell it about it – hence the error message.


    How do you fix this?

    You need to reference the assembly that contains the type WindowsGame1.Tile from your content pipeline project.

    You can’t reference your game project directly – because that would create a circular dependency (your game project already depends on the content project).

    Therefore you must put the type WindowsGame1.Tile into a separate assembly (create a new “Game Library Project”) that you reference from both your game project and your content project (right click the content project, add reference, add project reference).

    Then you can load your tile in-game via the content manager:

    Tile myTile = Content.Load<Tile>("assetName");
    

    If you get another error about the format of your XML (I think I spy an error, but I haven’t checked), you can figure out what it is supposed to be by creating a dummy instance of your Tile type, then use IntermediateSerializer.Serialize to generate the appropriate XML. Here is an example of how to do this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got this error message while trying to load view: The model item passed into
Got this error message while trying to configure an entitydatasource in the designer: My
Ran into this error message while trying to select some records off a table.
Once in a while i get the error message Bitmap size exceeds VM budget.
While deploying my application, I got the error message: Thread 1:Program received signal: EXC_BAD_ACCESS.
While attempting to link with QT 4.5 release, I run into this error message
Getting 'Dispatcher has no subscribers' error while trying to post message to a channel
I'm getting the following error message in Chrome and firefox while trying to implement
While learning Scalaz 6 , I'm trying to write type-safe readers returning validations. Here
I occasionally get this error message on a Tridion 2011 SP1 development machine: There

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.