tModLoader Unknown Tmodloader Error (System.DllNotFoundException: Unable to load DLL 'libc')

draxus

Terrarian
Since Tmodloader updated past 0.11.3 I have had an unusual error happen every time I attempt to launch. I have been looking for anyone with the same error and seemed to find nothing on it (Maybe 2-3 days of on and off looking). I've seen similar such as the CSteamworks but this appears to be different.

1579232128360.png


Tmodloader was working before but after a reinstall of Terraria and Tmodloader I've been seeing this error without fail instantly after launch with Tmod installed.
Terraria Launches fine but once Tmod is install this is the result.

OS: Windows 10 Version: up to date (Including The update regarding the exploit)
GPU: Nvidia GTX 1080ti, Drivers up to date as of post
CPU: Intel 8700
Ram: 24gb
.netframworks all up to speed


Client Log:
[22:26:24] [1/INFO] [tML]: Starting tModLoader v0.11.5 Windows client
[22:26:24] [1/INFO] [tML]: Running on NetFramework 4.7.2
[22:26:24] [1/INFO] [tML]: Executable: C:\Applications\Games\LOL\steamapps\common\Terraria\Terraria.exe
[22:26:24] [1/INFO] [tML]: Working Directory: C:\Applications\Games\LOL\steamapps\common\Terraria
[22:26:24] [1/INFO] [tML]: Launch Parameters:
[22:26:24] [1/DEBUG] [tML]: Assembly Resolve: -> MonoMod.RuntimeDetour, Version=19.10.5.2, Culture=neutral, PublicKeyToken=null
[22:26:24] [1/DEBUG] [tML]: Assembly Resolve: MonoMod.RuntimeDetour, Version=19.10.5.2, Culture=neutral, PublicKeyToken=null -> MonoMod.Utils, Version=19.10.5.2, Culture=neutral, PublicKeyToken=null
[22:26:24] [1/DEBUG] [tML]: Assembly Resolve: MonoMod.RuntimeDetour, Version=19.10.5.2, Culture=neutral, PublicKeyToken=null -> Mono.Cecil, Version=0.10.4.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e
[22:26:24] [1/WARN] [tML]: tModLoader.RuntimeErrorSilentlyCaughtException
System.DllNotFoundException: Unable to load DLL 'MonoPosixHelper': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at MonoMod.RuntimeDetour.Platforms.DetourNativeMonoPosixPlatform.sysconf(SysconfName name, Errno defaultError)
at MonoMod.RuntimeDetour.DetourHelper.get_Native()
at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform._HookSelftest(MethodInfo from, MethodInfo to)
at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform..ctor()
at MonoMod.RuntimeDetour.DetourHelper.get_Runtime()
at MonoMod.RuntimeDetour.DetourHelper.Pin[T](T method)
at MonoMod.RuntimeDetour.Hook..ctor(MethodBase from, MethodInfo to, Object target, HookConfig& config)
at Terraria.ModLoader.Core.LoggingHooks.PrettifyStackTraceSources()
at Terraria.ModLoader.Logging.Init()
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
at Terraria.WindowsLaunch.Main(String[] args)

[22:26:24] [1/WARN] [tML]: tModLoader.RuntimeErrorSilentlyCaughtException
System.DllNotFoundException: Unable to load DLL 'libc': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform.mprotect(IntPtr start, IntPtr len, MmapProts prot)
at MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform.SetMemPerms(IntPtr start, UInt64 len, MmapProts prot)
at MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform.MakeWritable(IntPtr src, UInt32 size)
at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform._HookSelftest(MethodInfo from, MethodInfo to)
at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform..ctor()
at MonoMod.RuntimeDetour.DetourHelper.get_Runtime()
at MonoMod.RuntimeDetour.DetourHelper.Pin[T](T method)
at MonoMod.RuntimeDetour.Hook..ctor(MethodBase from, MethodInfo to, Object target, HookConfig& config)
at Terraria.ModLoader.Core.LoggingHooks.PrettifyStackTraceSources()
at Terraria.ModLoader.Logging.Init()
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
at Terraria.WindowsLaunch.Main(String[] args)


Any Insight would be appreciated.
 
A DDL file in your dotNet or Visual C++ Redistributable is missing. Try the following steps to reinstall the dependencies for Terraria:
  1. Go to Steam and right-click Terraria and click 'Properties'
  2. Click 'Local Files' tab and then click 'Browse Local Files'
  3. Click and run 'xnafx40_redist'. Click repair when prompted.
 
A DDL file in your dotNet or Visual C++ Redistributable is missing. Try the following steps to reinstall the dependencies for Terraria:
  1. Go to Steam and right-click Terraria and click 'Properties'
  2. Click 'Local Files' tab and then click 'Browse Local Files'
  3. Click and run 'xnafx40_redist'. Click repair when prompted.

dude i dont know how but i tried your fix and it doesnt work
but a very bizzare thing has happened
i can launch the game from a zip file and it works! , somehow...
but i would still like a proper fix...
 
dude i dont know how but i tried your fix and it doesnt work
but a very bizzare thing has happened
i can launch the game from a zip file and it works! , somehow...
but i would still like a proper fix...
What do you mean by "launch from zip file". Which zip file?
 
I have the same issue as you and the weird thing is that it just happened. I had a two-month break from terraria and when I decided to come back it didn't work. I thought it might be because I had an outdated tmodloader version but after an update, it still wasn't working, the same thing after a reinstall.
 
I have the same issue as you and the weird thing is that it just happened. I had a two-month break from terraria and when I decided to come back it didn't work. I thought it might be because I had an outdated tmodloader version but after an update, it still wasn't working, the same thing after a reinstall.
It would be helpful if you could generate some fusion logs, so we can figure out where .NET is looking for this thing.
Here's some on info on enabling this: How to enable assembly bind failure logging (Fusion) in .NET
 
I have the same issue as you and the weird thing is that it just happened. I had a two-month break from terraria and when I decided to come back it didn't work. I thought it might be because I had an outdated tmodloader version but after an update, it still wasn't working, the same thing after a reinstall.

dude i bought from gog and it came in a zip file
also i installed visual studio 2019 and the error message has gone away
but when i took a look in the resource monitor the .exe is getting terminated before even getting launched
all in all i can still play if i run it from the zip file i just cant extract it and play which is a minor inconvenience but its one of those things i would really like to know the answer to...
 
Just be careful with editing your registry, if you don't know exactly what you're doing. Be sure to make backups or a system restore point...
I was really careful and I do have some... results? I've done exactly as the most popular answer from the link you gave me said and I don't know what to post. 2 folders just created themselves named Default and NativeImage both have a folder Terraria.exe and Update.exe inside of them.
 
I was really careful and I do have some... results? I've done exactly as the most popular answer from the link you gave me said and I don't know what to post. 2 folders just created themselves named Default and NativeImage both have a folder Terraria.exe and Update.exe inside of them.
And what files do you have in these folders?
 
And what files do you have in these folders?
All of them are HTML. There is a lot of them. Here are some names :MonoMod.RuntimeDetour, Version=19.12.19.1, Culture=neutral, PublicKeyToken=null,
System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
 
Upon further research, it looks like this might be a different problem relating to MonoMod. On my computer terraria is not looking for "libc" at all, and I suspect it's not even supposed to at all. Looking at this part of MonoMod, the libc helper is supposed to be a fallback, and shouldn't be loaded, if a windows platform is properly detected.

This is the part that detects the platform:
Terraria uses the .NET framework build of this code, so the bottom section applies. I guess this could be a case where "RuntimeInformation.IsOSPlatform is lying"... Though the issue mentioned there is talking about linux and .NET Core, so not really the same thing.

I wonder what platform this code finds on your PC, and why... Could you run this little test program for me? (binary attached)
C#:
using System;
using System.Reflection;

namespace PlatformTester
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            PropertyInfo p_Platform = typeof(Environment).GetProperty("Platform", BindingFlags.NonPublic | BindingFlags.Static);

            if (p_Platform != null)
            {
                Console.WriteLine("Platform property found!");
                Console.WriteLine(p_Platform.GetValue(null, new object[0]).ToString());
            }
            else
            {
                // For .NET and newer Mono, use the usual value.
                Console.WriteLine("Platform property not found...");
            }

            Console.WriteLine("Non hacky way resulted: " + Environment.OSVersion.Platform.ToString());

            Console.ReadKey();
        }
    }
}
For me this says:
Platform property not found...
Non hacky way resulted: Win32NT
 

Attachments

  • PlatformTester.zip
    2.3 KB · Views: 100
Last edited:
Upon further research, it looks like this might be a different problem relating to MonoMod. On my computer terraria is not looking for "libc" at all, and I suspect it's not even supposed to at all. Looking at this part of MonoMod, the libc helper is supposed to be a fallback, and shouldn't be loaded, if a windows platform is properly detected.

This is the part that detects the platform:
Terraria uses the .NET framework build of this code, so the bottom section applies. I guess this could be a case where "RuntimeInformation.IsOSPlatform is lying"... Though the issue mentioned there is talking about linux and .NET Core, so not really the same thing.

I wonder what platform this code finds on your PC, and why... Could you run this little test program for me? (binary attached)
C#:
using System;
using System.Reflection;

namespace PlatformTester
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            PropertyInfo p_Platform = typeof(Environment).GetProperty("Platform", BindingFlags.NonPublic | BindingFlags.Static);

            if (p_Platform != null)
            {
                Console.WriteLine("Platform property found!");
                Console.WriteLine(p_Platform.GetValue(null, new object[0]).ToString());
            }
            else
            {
                // For .NET and newer Mono, use the usual value.
                Console.WriteLine("Platform property not found...");
            }

            Console.WriteLine("Non hacky way resulted: " + Environment.OSVersion.Platform.ToString());

            Console.ReadKey();
        }
    }
}
For me this says:
Platform property not found...
Non hacky way resulted: Win32NT
For me it also says: Platform property not found
Non hacky way resulted: Win32NT
 
Back
Top Bottom