XNA Essentials

Game Programming for Xbox 360, PC + Windows Phone

NAVIGATION - SEARCH

SkyboxReader inheritence

Hello Chad,


 


Although I can get my code to build, I get the following error when trying to run the game:


Error    1    'XELibrary.SkyboxReader' does not implement inherited abstract member 'Microsoft.Xna.Framework.Content.ContentTypeReader<XELibrary.Skybox>.Read(Microsoft.Xna.Framework.Content.ContentReader, XELibrary.Skybox)'    C:\Users\Tomer\Documents\Visual Studio 2008\Projects\Load3DObject - Copy\XELibrary\SkyboxReader.cs    13    18    XELibrary


the error goes away when I change the class to abstract. however I get another error but in the main game's LoadContent method on the following statement:


skybox = Content.Load<Skybox>(@"Skyboxes\skybox");


Microsoft.Xna.Framework.Content.ContentLoadException was unhandled
  Message="Error loading \"Skyboxes\\skybox\". Cannot instantiate ContentTypeReader XELibrary.SkyboxReader, XELibrary, Version=1.0.0.0, Culture=neutral."
  Source="Microsoft.Xna.Framework"
  StackTrace:
       at Microsoft.Xna.Framework.Content.ContentTypeReaderManager.InstantiateTypeReader(String readerTypeName, ContentReader contentReader, ContentTypeReader& reader)
       at Microsoft.Xna.Framework.Content.ContentTypeReaderManager.GetTypeReader(String readerTypeName, ContentReader contentReader, List`1& newTypeReaders)
       at Microsoft.Xna.Framework.Content.ContentTypeReaderManager.ReadTypeManifest(Int32 typeCount, ContentReader contentReader)
       at Microsoft.Xna.Framework.Content.ContentReader.ReadHeader()
       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)
       at Load3DObject.Game1.LoadContent() in C:\Users\Tomer\Documents\Visual Studio 2008\Projects\Load3DObject - Copy\Load3DObject\Game1.cs:line 84
       at Microsoft.Xna.Framework.Game.Initialize()
       at Load3DObject.Game1.Initialize() in C:\Users\Tomer\Documents\Visual Studio 2008\Projects\Load3DObject - Copy\Load3DObject\Game1.cs:line 67
       at Microsoft.Xna.Framework.Game.Run()
       at Load3DObject.Program.Main(String[] args) in C:\Users\Tomer\Documents\Visual Studio 2008\Projects\Load3DObject - Copy\Load3DObject\Program.cs:line 14
  InnerException: System.MissingMethodException
       Message="Cannot create an abstract class."
       Source="mscorlib"
       StackTrace:
            at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
            at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
            at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
            at System.Activator.CreateInstance(Type type, Boolean nonPublic)
            at System.Activator.CreateInstance(Type type)
            at Microsoft.Xna.Framework.Content.ContentTypeReaderManager.InstantiateTypeReader(String readerTypeName, ContentReader contentReader, ContentTypeReader& reader)
       InnerException:


I've compiled everything in 3.1 (if it give you any clues)


Thanks,


Tomer

tomernatorII - Thursday, November 19, 2009 @ 11:44 PM

Re: SkyboxReader inheritence

Sounds like 3.0 is still referenced.  Look at the accepted answer in this thread and let me know if that doesn't fix your problem:


http://xnaessentials.com/forums/t/37.aspx


Do suggestion 3 and hopefully that will solve your problem.


Hope this helps!


Chad

Chad Carter - Saturday, November 21, 2009 @ 6:20 PM