SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Error when loading PNG content during early initialisation

Pathoschild opened this issue ยท 1 comments

commented

If you use the content API added by #257 to load a PNG from your mod folder when the game is still loading (e.g. in your Entry method), the game crashes with this error:

An error occured in the overridden draw loop: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Texture2D'.
   at Microsoft.Xna.Framework.Helpers.CheckDisposed(Object obj, IntPtr pComPtr)
   at Microsoft.Xna.Framework.Graphics.TextureCollection.set_Item(Int32 index, Texture value)
   at Microsoft.Xna.Framework.Graphics.SpriteBatch.RenderBatch(Texture2D texture, SpriteInfo[] sprites, Int32 offset, Int32 count)
   at Microsoft.Xna.Framework.Graphics.SpriteBatch.Flush()
   at Microsoft.Xna.Framework.Graphics.SpriteBatch.End()
   at StardewModdingAPI.Framework.SGame.Draw(GameTime gameTime) in D:\source\_Stardew\SMAPI\src\StardewModdingAPI\Framework\SGame.cs:line 928
[
commented

Fixed in develop for the next SMAPI release.