[RESOLVED] ContentManager.Load ArgumentException (on .xnb files from XNA 3.1)

I’m converting a desktop application from XNA 3.1 to MonoGame.Framework for WindowsDX (teambuilder v3.7.0.994), targetting .Net 4.5.2, for Windows but NOT UWP, developing on Windows 10 Pro on a Surface Pro (2017 model).

App uses a number of .xnb files; so far any call (from VB) like myContentManager.Load(Of SpriteFont)("HUDFont") or myContentManager.Load(Of Texture2D)("Textures\dot8x8") results in an exception similar to this:

System.ArgumentException occurred
  HResult=-2147024809
  Message=elementCount is not the right size, elementCount * sizeof(T) is 8192, but data size is 32768.
Parameter name: elementCount
  ParamName=elementCount
  Source=MonoGame.Framework
  StackTrace:
	   at Microsoft.Xna.Framework.Graphics.Texture2D.ValidateParams[T](Int32 level, Int32 arraySlice, Nullable`1 rect, T[] data, Int32 startIndex, Int32 elementCount, Rectangle& checkedRect)
	   at Microsoft.Xna.Framework.Content.Texture2DReader.Read(ContentReader reader, Texture2D existingInstance)
	   at Microsoft.Xna.Framework.Content.ContentTypeReader`1.Read(ContentReader input, Object existingInstance)
	   at Microsoft.Xna.Framework.Content.ContentReader.InnerReadObject[T](T existingInstance)
	   at Microsoft.Xna.Framework.Content.SpriteFontReader.Read(ContentReader input, SpriteFont existingInstance)
	   at Microsoft.Xna.Framework.Content.ContentTypeReader`1.Read(ContentReader input, Object existingInstance)
	   at Microsoft.Xna.Framework.Content.ContentReader.InnerReadObject[T](T existingInstance)
	   at Microsoft.Xna.Framework.Content.ContentReader.ReadObject[T]()
	   at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
	   at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
	   at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)

or on (VB code) myContentManager.Load(Of Model)("Models\XYZAxis")

  System.IndexOutOfRangeException occurred
  HResult=-2146233080
  Message=Index was outside the bounds of the array.
  Source=MonoGame.Framework
  StackTrace:
	   at Microsoft.Xna.Framework.Graphics.VertexDeclaration.Data..ctor(Int32 vertexStride, VertexElement[] elements)
	   at Microsoft.Xna.Framework.Graphics.VertexDeclaration.GetOrCreate(Int32 vertexStride, VertexElement[] elements)
	   at Microsoft.Xna.Framework.Content.VertexDeclarationReader.Read(ContentReader reader, VertexDeclaration existingInstance)
	   at Microsoft.Xna.Framework.Content.ContentTypeReader`1.Read(ContentReader input, Object existingInstance)
	   at Microsoft.Xna.Framework.Content.ContentReader.InnerReadObject[T](T existingInstance)
	   at Microsoft.Xna.Framework.Content.ModelReader.Read(ContentReader reader, Model existingInstance)
	   at Microsoft.Xna.Framework.Content.ContentTypeReader`1.Read(ContentReader input, Object existingInstance)
	   at Microsoft.Xna.Framework.Content.ContentReader.InnerReadObject[T](T existingInstance)
	   at Microsoft.Xna.Framework.Content.ContentReader.ReadObject[T]()
	   at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
	   at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
	   at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)

Are there known reasons why old .xnb’s would fail?

I may not have source assets for some of these; are there any utilities in XNA or MonoGame or elsewhere for viewing details of an .xnb, or for converting .xnbs to something else?

We support XNA 4 xnb files, not XNA 3.x. The xnb format likely changed between XNA 3 and 4.

I would strongly suggest rebuilding the content using our content build pipeline, which may be difficult if you no longer have the source assets.

Ah, that makes sense - thanks.

[RESOLVED] Need XNA 4 - compatible .xnb files.

Just a heads up that Effects built for XNA won’t work in MG and need to be rebuilt with MonoGames content pipeline.