PC Terraria crashes at startup and resolution change (Windows 10, Steam Version)

kampfi

Terrarian
Hello there,
Terraria crashes when I change the resolution of the game and only works at 800x600 in windowed mode.

When I change the resolution in the config.json Terraria crashes on startup (borderless windowed mode & window maximized).
When using the fullscreen mode the game shows my desktop instead at 800x600 resolution, the sound works and the windows task manager says Terraria is inactive.

My PC:
OS: Windows 10 Version 10.0.17134 Build 17134, 64bit
CPU: AMD Ryzen 5 2600X Six-Core Processor
GPU: GeForce GTX 1080
Monitor: 2560 x 1440 @144hz

The following errors occur:

7/10/2019 6:52:47 PM
System.InvalidOperationException: A previous Draw call threw an unhandled exception. See InnerException for details. ---> 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 Terraria.Main.DoDraw(GameTime gameTime)
at Terraria.Main.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Paint(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameWindow.OnPaint()
at Microsoft.Xna.Framework.WindowsGameWindow.mainForm_Paint(Object sender, PaintEventArgs e)
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)

7/10/2019 10:40:38 AM
System.InvalidOperationException: Begin must be called successfully before a Draw can be called.
at Microsoft.Xna.Framework.Graphics.SpriteBatch.InternalDraw(Texture2D texture, Vector4& destination, Boolean scaleDestination, Nullable`1& sourceRectangle, Color color, Single rotation, Vector2& origin, SpriteEffects effects, Single depth)
at ReLogic.Graphics.DynamicSpriteFont.InternalDraw(String text, SpriteBatch spriteBatch, Vector2 startPosition, Color color, Single rotation, Vector2 origin, Vector2& scale, SpriteEffects spriteEffects, Single depth)
at ReLogic.Graphics.DynamicSpriteFontExtensionMethods.DrawString(SpriteBatch spriteBatch, DynamicSpriteFont spriteFont, String text, Vector2 position, Color color, Single rotation, Vector2 origin, Single scale, SpriteEffects effects, Single layerDepth)
at Terraria.Main.DrawMenu(GameTime gameTime)
at Terraria.Main.DoDraw(GameTime gameTime)
at Terraria.Main.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)

------------------------------------------------------------------
I have tried the following:

- reinstalling game
- verifiing the steam cache
- reinstalling XNA
- installing .NET Framework 4.0 (does not work since I use WIN 10)
- looking up error messages in the Event Manager (no relevant errors)
- updating drivers
- started TerrariaServer.exe: (the server works without problems)


I am out of ideas. Can you help me?
 
When you tested out the fullscreen option did you also set your resolution to 2560x1440?

Also maybe I missed it, but did you try deleting the config.json and having Terraria generate a new one on launch?
 
Yes, when testing the fullscreen option I set the resolution to 2560x1440. When starting the game it changes the resolution to 800x600 and shows my desktop. I also cannot tab out of the "game window". Very strange behavior.
When deleting the config.json and starting the game it starts at 800x600(windowed) and works. But when I change the resolution or the windows mode it crashes.
 
What windowed resolutions work? Is it only 800 by 600 or do small resolutions like 1024 by 768 and etc work as well? Do you use multiple monitors or just the one listed?
 
When changing the resolution by any amount (lower or higher) it crashes. Only 800x600 works.
I have 2 monitors. One with 2560x1440 the other has 1920x1080.
 
If both are plugged in at the same time, try having only one plugged in first your main one then the other one, see which one has Terraria function and which ones don't.
 
I have tried it:

2560x1440 only: nothing works (crash)
1920x1080 only: fullscreen does not work, window borderless does work (@1920x1080)

does this help finding the root of the problem?
 
A couple more tests, If you set the resolution of your main monitor to 1920x1080 does the game launch on your main monitor? Then if you change the refresh rate of the monitor to 60 hz does it crash on 2560x1440? What about 1920x1080?
 
I have done the following tests with both monitors plugged in at the same time.

Test 1: Monitor1@1920x1080,144hz ;Monitor2@1920x1080,144hz ; borderless fullscreen@1920x1080 on monitor1: works
Test 2: Monitor1@1920x1080,144hz ;Monitor2@1920x1080,144hz ; fullscreen@1920x1080 on mmonitor1: crash
Test 3: Monitor1@2560x1440,60hz ;Monitor2@1920x1080,144hz ; borderless fullscreen@2560x1440 on monitor1: crash
Test 4: Monitor1@2560x1440,60hz ;Monitor2@1920x1080,144hz ; borderless fullscreen@1920x1080 on monitor1: crash
Test 5: Monitor1@2560x1440,60hz ;Monitor2@1920x1080,144hz ; fullscreen@2560x1440 on monitor1: crash
Test 6: Monitor1@2560x1440,144hz ;Monitor2@1920x1080,144hz ; deactivated GSync; borderless fullscreen@2560x1440 on monitor1: crash
 
Alright thank you for these tests. Someone with a similar issue regarding monitor resolutions higher than 1080p has claimed to have fixed their problem by enabling compatibility mode for Windows 7 and checking the Run as Administrator box. It might be worth trying on your 1440p monitor. Let me know if this solves your issue or if it persists.
 
Sorry, I forgot to add that when using those modes, you need to be in windowed or borderless window. Fullscreen will still crash with your setup even with those modes on. Did it not work for Windowed as well?
 
Alright with both monitors plugged in press Windows+P, this should open a shortcut that will allow you to duplicate the displays or only shown a certain monitor. For now you may need to play it on your 1920x1080 monitor. Alternatively you may need to lower your desktop resolution to play the game.

None of these are ideal work arounds and they certainly aren't fixes and I'm sorry about that. I am curious about the differences in our environments. I use a 1440p Monitor as well at 144Hz and have no issues. So I'm not sure why your game is disposing assets on startup and is unable to redraw them. You could try a much older driver to see if the game is simply having trouble accessing your graphics device at that resolution. Maybe it will work, maybe it won't. Another thing you may want to check, your config.json "Support4k" is set to true, right? It should be by default but it may be worth it to check.

From what I've found it isn't something the developers can fix because it's nativley XNA's fault in how it handles display and graphics devices.

Something else you might be able to try... There was a mod for terraria awhile back that allowed users to play Terraria ACROSS multiple monitors... It may help you play on your main monitor on it's native resolution. The main problem is there was only ever a test version for Terraria 1.3.4.4, where as Terraria's current version is 1.3.5.3. I've included the download here but honestly I have never used it, so I don't know if it will even work for Terraria's updated version or not.

It's a shame that the usual fixes for this error were not successful, that really bums me out. Do you know the model of your 2560x1600 monitor? I'd like to take a look at it's in depth specifications and see if I can find any clues as to why it might not be allowing XNA games to properly run.
 
Its a bummer to deactivate my main monitor for Terraria, but it seems like I dont have another choice right now.
The 1440p monitor is a DELL S2719DGF (maybe you can find helpful information here: 27" Dell S2719DGF - Specifications)

The "Support4k" option is indeed set to true.

I hope there is a solution when the update arrives. I am looking forward to play again. If the mod works I will post it.

Thank you for your help so far.
 
That's great news you got it figured out! I'll keep in mind certain Utility Software Managers can conflict with Terraria for anyone else that comes across this issue. Thank you for reporting back.
 
Back
Top Bottom