Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xml pipeline reading past end of xnb file #6215

Open
MrMajorThorburn opened this issue Feb 26, 2018 · 4 comments
Open

xml pipeline reading past end of xnb file #6215

MrMajorThorburn opened this issue Feb 26, 2018 · 4 comments
Labels
ContentPipeline Content processing issues Help Wanted
Milestone

Comments

@MrMajorThorburn
Copy link

What version of MonoGame does the bug occur on:

  • MonoGame 3.7

What operating system are you using:

  • Windows

What MonoGame platform are you using:

  • DesktopGL
@harry-cpp
Copy link
Member

Can you please provide more detail on what the error is and how it can be reproduced?

@MrMajorThorburn
Copy link
Author

I am trying to migrate the original XNA RPG kit to monogame and have been working on getting the pipeline and MGCB tools sorted out as they both had problems with the xml.
Having completed that activity I resumed my migration only to find that the pipleline itself has problems.
The first instance of the error occurs in the content load of the Map002.xnb file.
the pipeline dies in the InnerReader routine where it reads past the end of file and get completely confused trying to process what its read. I am able to reproduce it in VS debug mode and track the failure to the point where the object id is not within the xml. I believe it thinks it has a SpriteTexture.
The area in the xml file is the PlayerNpc segment.
I can provide screen shots of what I have seen if that is of any help at all.
I have not spent any time since the failure as it seemed to me to be outside of my original scope of 'fixing' the pipeline and MGCB tools.
I would be happy to spend some time trying to sort this out.
One thing I did notice looking through the code while in the debugger there does not seem to be any check on the read position comparing it to the file length.

@tomspilman
Copy link
Member

https://blogs.msdn.microsoft.com/charlie/2009/09/27/the-xna-role-playing-game-starter-kit/

@MrMajorThorburn - Is this the XNA RPG Kit you are talking about?

I see a Map002.xml which seems to be processed as passthru...

image

That seems to load into the RolePlayingGameData.Map object.

I don't see anything obvious in the Map002.xml PlayerNpcEntries section that could be causing issues.

We will need to setup a unit test to discover the bug then whittle down the XML file and data class to just part that causes the crash. We can then go and fix it.

If anyone has the time to dig in here that would help.

@tomspilman tomspilman added this to the 3.8 Release milestone Mar 9, 2018
@MrMajorThorburn
Copy link
Author

If the PlayerNpcEntry is removed the error occurs in the next map. If I change the mapposition that allow it to work so can 'work round' but would prefer to resolve this issue.
I am ok with continuing the investigation.
I have not setup a test case in Git before so need a hint or three.
I did setup some tests to help identify the solutions to problem in the pipeline so think I can setup a test where this problem occurs earlier in the game but I don't think that would be a good test case as you would still need most of the class files in order to create the MGCB.
Are there some test cases specifically for xml that I could look at to see if I can figure this out?

@Jjagg Jjagg added the ContentPipeline Content processing issues label Dec 10, 2018
@harry-cpp harry-cpp modified the milestones: 3.8 Release, 3.9 Release Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ContentPipeline Content processing issues Help Wanted
Projects
None yet
Development

No branches or pull requests

4 participants