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

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
same here, same response
also i have a thing that might be helpful
i stopped playing like 2 months ago and installed several programs in the meantime
one i particularly remember that took the most tweaking and required the most dependencies was houdini 18.
maybe that has something to do with it?
 
same here, same response
also i have a thing that might be helpful
i stopped playing like 2 months ago and installed several programs in the meantime
one i particularly remember that took the most tweaking and required the most dependencies was houdini 18.
maybe that has something to do with it?
It's possible you maybe ended up installing a version of .NET that managed to break MonoMod. I'm pretty sure this has something to do with platform detection. I made a second test that uses the actual library.

C#:
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
using System;

namespace platformTestTwo
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Console.WriteLine("Detected platform: " + PlatformHelper.Current.ToString());
            Console.WriteLine("Library suffix is " + PlatformHelper.LibrarySuffix);
            Console.WriteLine("Testing for windows: " + PlatformHelper.Is(Platform.Windows));

            Console.WriteLine("The loaded native detour platform is " + DetourHelper.Native.GetType().ToString());

            try
            {
                Console.WriteLine("Attempting detour...");
                NativeDetour detour = new NativeDetour(new Action(DetourFrom), new Action(DetourTo));
                DetourFrom();
            }
            catch (Exception e)
            {
                e.LogDetailed();
            }

            Console.ReadKey();
        }

        private static void DetourFrom()
        {
            Console.WriteLine("Hello, from the method the should have been detoured!");
        }

        private static void DetourTo()
        {
            Console.WriteLine("Hello, from the detour target!");
        }
    }
}

This will no doubt show something... Unless there is some problem, that is very specific to terraria.
 

Attachments

  • platformTestTwo.zip
    247.9 KB · Views: 107
It's possible you maybe ended up installing a version of .NET that managed to break MonoMod. I'm pretty sure this has something to do with platform detection. I made a second test that uses the actual library.

C#:
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
using System;

namespace platformTestTwo
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Console.WriteLine("Detected platform: " + PlatformHelper.Current.ToString());
            Console.WriteLine("Library suffix is " + PlatformHelper.LibrarySuffix);
            Console.WriteLine("Testing for windows: " + PlatformHelper.Is(Platform.Windows));

            Console.WriteLine("The loaded native detour platform is " + DetourHelper.Native.GetType().ToString());

            try
            {
                Console.WriteLine("Attempting detour...");
                NativeDetour detour = new NativeDetour(new Action(DetourFrom), new Action(DetourTo));
                DetourFrom();
            }
            catch (Exception e)
            {
                e.LogDetailed();
            }

            Console.ReadKey();
        }

        private static void DetourFrom()
        {
            Console.WriteLine("Hello, from the method the should have been detoured!");
        }

        private static void DetourTo()
        {
            Console.WriteLine("Hello, from the detour target!");
        }
    }
}

This will no doubt show something... Unless there is some problem, that is very specific to terraria.
Detected platform: Bits64, iOS
Library suffix is dylib
Testing for windows: False
The loaded native detour platform is MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform
Attempting detour...
--------------------------------
Detailed exception log:
--------------------------------
System.DllNotFoundException: Nie można załadować biblioteki DLL 'libc': Nie można odnaleźć określonego modułu. (Wyjątek od HRESULT: 0x8007007E)
w MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform.mprotect(IntPtr start, IntPtr len, MmapProts prot)
w MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform.SetMemPerms(IntPtr start, UInt64 len, MmapProts prot)
w MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform.MakeWritable(IntPtr src, UInt32 size)
w MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform._HookSelftest(MethodInfo from, MethodInfo to)
w MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform..ctor()
w MonoMod.RuntimeDetour.DetourHelper.get_Runtime()
w MonoMod.RuntimeDetour.NativeDetour..ctor(MethodBase from, MethodBase to)
w MonoMod.RuntimeDetour.NativeDetour..ctor(Delegate from, Delegate to)
w platformTestTwo.Program.Main(String[] args)
TypeLoadException.TypeName:
Quick translation:
Nie można załadować biblioteki=Can't load library
Nie można odnaleźć określonego modułu= Can't find the right module
Wyjątek=Exception
I know you'll probably guess it from context but i'm putting it here anyway.
 
Soooo I'm really bored and want to play some modded terraira before 1.4 and I don't know when will the Tmodloader update drop so I was just wondering if this issue is tied to the tmodloader itself or is it caused by a mod that I have downloaded via tmodloader?
 
Soooo I'm really bored and want to play some modded terraira before 1.4 and I don't know when will the Tmodloader update drop so I was just wondering if this issue is tied to the tmodloader itself or is it caused by a mod that I have downloaded via tmodloader?
you can play it just compress it in a zip archive and launch the .exe from there.
 
Back
Top Bottom