tModLoader

tModLoader

Terraria Ambience
Jiripoca 25 Jan, 2024 @ 7:25am
Crash when joining multiplayer world
I was playing modded terraria with a friend recently and we were facing an issue where they would, at seemingly random intervals, lose connection to my server. While this was an inconvenience, it wasn't a major problem since simply reconnecting was not a problem.

However, at some point it became impossible for them to join my server because their game would almost instantly crash when doing so. We were unsure of what was causing the issue and after some digging into the log files we came into the conclusion that it was likely a problem with Terraria Ambience, and as soon as we removed it, they were able to connect without any issue at all, and the random losses of connection also went away.

We ended up with 10+ log files and all of them ended in the following manner:

[21:15:25.075] [.NET ThreadPool Worker/INFO] [tML]: Unloading: WingSlotExtra (Wing Slot Extra) v1.3.6 [21:15:25.086] [.NET ThreadPool Worker/INFO] [tML]: Unloading: TouhouPets (东方小伙伴 - Adventure with cute partners) v1.1.2.3 [21:15:25.112] [.NET ThreadPool Worker/INFO] [tML]: Unloading: TerrariaAmbience (Terraria Ambience) v0.2.7.1 [21:15:25.112] [.NET ThreadPool Worker/DEBUG] [tML]: Unloading 0 IL hooks, 8 detours from TerrariaAmbience in Terraria Ambience [21:15:25.159] [Main Thread/WARN] [tML]: Silently Caught Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Xna.Framework.Audio.SoundEffect.Dispose() in D:\a\tModLoader\tModLoader\FNA\src\Audio\SoundEffect.cs:line 314 at ReLogic.Content.Asset`1.Dispose(Boolean disposing) in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\Asset.cs:line 95 at ReLogic.Content.Asset`1.Dispose() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\Asset.cs:line 105 at ReLogic.Content.AssetRepository.Dispose(Boolean disposing) in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 380 at ReLogic.Content.AssetRepository.Dispose() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 395 at ReLogic.Content.AssetRepository.<>c__DisplayClass6_0.<Invoke>b__0() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 79 at ReLogic.Content.AssetRepository.TransferCompletedAssets() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 186 at Terraria.ModLoader.ModContent.TransferCompletedAssets() in tModLoader\Terraria\ModLoader\ModContent.cs:line 598 at Terraria.Main.Draw_Inner(GameTime gameTime) in tModLoader\Terraria\Main.cs:line 52849 at Terraria.Main.Draw(GameTime gameTime) in tModLoader\Terraria\Main.cs:line 52830 at Microsoft.Xna.Framework.Game.Tick() in D:\a\tModLoader\tModLoader\FNA\src\Game.cs:line 562 at Microsoft.Xna.Framework.Game.RunLoop() in D:\a\tModLoader\tModLoader\FNA\src\Game.cs:line 878 at Microsoft.Xna.Framework.Game.Run() in D:\a\tModLoader\tModLoader\FNA\src\Game.cs:line 419 at Terraria.Program.RunGame() in tModLoader\Terraria\Program.cs:line 266 at Terraria.Program.LaunchGame_(Boolean isServer) in tModLoader\Terraria\Program.cs:line 240 at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs) in tModLoader\Terraria\Program.cs:line 213 at Terraria.MonoLaunch.Main_End(String[] args) in tModLoader\Terraria\MonoLaunch.cs:line 78 at Terraria.MonoLaunch.<>c__DisplayClass1_0.<Main>b__1() in tModLoader\Terraria\MonoLaunch.cs:line 64 at System.Threading.Thread.StartCallback() [21:15:25.160] [Main Thread/ERROR] [Terraria]: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Xna.Framework.Audio.SoundEffect.Dispose() in D:\a\tModLoader\tModLoader\FNA\src\Audio\SoundEffect.cs:line 314 at ReLogic.Content.Asset`1.Dispose(Boolean disposing) in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\Asset.cs:line 95 at ReLogic.Content.Asset`1.Dispose() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\Asset.cs:line 105 at ReLogic.Content.AssetRepository.Dispose(Boolean disposing) in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 380 at ReLogic.Content.AssetRepository.Dispose() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 395 at ReLogic.Content.AssetRepository.<>c__DisplayClass6_0.<Invoke>b__0() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 79 at ReLogic.Content.AssetRepository.TransferCompletedAssets() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 186 at Terraria.ModLoader.ModContent.TransferCompletedAssets() in tModLoader\Terraria\ModLoader\ModContent.cs:line 598 at Terraria.Main.Draw_Inner(GameTime gameTime) in tModLoader\Terraria\Main.cs:line 52853 at Terraria.Main.Draw(GameTime gameTime) in tModLoader\Terraria\Main.cs:line 52834 [21:15:25.253] [Main Thread/FATAL] [tML]: Main engine crash Tip: This is likely a mod's fault. Disable mods one by one and check if the issue persists System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Xna.Framework.Audio.SoundEffect.Dispose() in D:\a\tModLoader\tModLoader\FNA\src\Audio\SoundEffect.cs:line 314 at ReLogic.Content.Asset`1.Dispose(Boolean disposing) in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\Asset.cs:line 95 at ReLogic.Content.Asset`1.Dispose() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\Asset.cs:line 105 at ReLogic.Content.AssetRepository.Dispose(Boolean disposing) in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 380 at ReLogic.Content.AssetRepository.Dispose() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 395 at ReLogic.Content.AssetRepository.<>c__DisplayClass6_0.<Invoke>b__0() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 79 at ReLogic.Content.AssetRepository.TransferCompletedAssets() in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 186 at Terraria.ModLoader.ModContent.TransferCompletedAssets() in tModLoader\Terraria\ModLoader\ModContent.cs:line 598 at Terraria.Main.Draw_Inner(GameTime gameTime) in tModLoader\Terraria\Main.cs:line 52853 at Terraria.Main.Draw(GameTime gameTime) in tModLoader\Terraria\Main.cs:line 52834 at Microsoft.Xna.Framework.Game.Tick() in D:\a\tModLoader\tModLoader\FNA\src\Game.cs:line 562 at Microsoft.Xna.Framework.Game.RunLoop() in D:\a\tModLoader\tModLoader\FNA\src\Game.cs:line 878 at Microsoft.Xna.Framework.Game.Run() in D:\a\tModLoader\tModLoader\FNA\src\Game.cs:line 419 at Terraria.Program.RunGame() in tModLoader\Terraria\Program.cs:line 266 [21:15:25.257] [Main Thread/DEBUG] [TerrariaSteamClient]: Send: shutdown

Additionally, they were able to create a singleplayer world and join it without any issue, the problem showed up solely when trying to connect to a multiplayer server. We also face the issue reported by other people where reloading mods causes the game to crash, but we never minded that problem too much.

I am unsure if this is a problem with the mod itself or something in my world/server, however I really enjoy this mod and would like to be able to use it again in multiplayer in the future.