[Bug 9056] Mono 1.2.4 fails to find mscorlib.dll on startup

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Sep 15 09:35:01 CDT 2007


Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
                 CC|                            |focht at gmx.net

--- Comment #13 from Anastasius Focht <focht at gmx.net>  2007-09-15 09:35:00 ---

yes it's a bug in mono's assembly loader hook -> AOT code.
Judging from ximian/bugzilla comments the people there are not very interested
nor helpful "-> WONTFIX".

There are two options how to get around this...

1. Fix the stuff in mono source

The call chain until the bug goes as follows (pseudo/simplified):

mono_assembly_load_corlib( ASCII "v2.0.50727")
mono_assembly_open_full( ASCII "C:\Program
Files\Mono-1.2.5\lib\mono\2.0\mscorlib.dll" )
mono_assembly_load_from_full( ASCII "C:\Program
Files\Mono-1.2.5\lib\mono\2.0\mscorlib.dll" )
mono_assembly_invoke_load_hook( mscorlib)

which invokes runtime hook: load_aot_module( mscorlib)

-- quote mono/mono/mini/aot-runtime.c ---
static void
load_aot_module (MonoAssembly *assembly, gpointer user_data)
if (use_aot_cache)
                assembly->aot_module = load_aot_module_from_cache (assembly,
        else {
                char *err;
                aot_name = g_strdup_printf ("%s%s", assembly->image->name,

                assembly->aot_module = mono_dl_open (aot_name, MONO_DL_LAZY,

                if (!assembly->aot_module) {
                        mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT
failed to load AOT module %s: %s\n", aot_name, err);
                        g_free (err);

-- quote mono/mono/mini/aot-runtime.c ---

"assembly->image->name" contains already full assembly path ("C:\Program
So blindly appending SHARED_EXT is not a good idea in this case.

The same ".dll.dll" bug exists on native windows too.
Though the win32 mono_dl_open() version seems to be more conservative in error
handling (load hook cleanly exits).


Another way to get around:

2. use AOT cache to prevent buggy code path from executed (which involves wine
workaround due to missing msvcrt api)

Set environ var "MONO_AOT_CACHE"
Running the app with wine will result in a crash due to unimplemented msvcrt

--- snip ---
Mono-INFO: Assembly Loader probing location: 'C:\Program
Mono-INFO: Image addref mscorlib 00141910 -> C:\Program
Files\Mono-1.2.5\lib\mono\2.0\mscorlib.dll 0013EDA0: 2

Mono-INFO: AOT trying to load from cache:
Mono-INFO: AOT not found.
Mono-Message: AOT precompiling assembly 'C:\Program
wine: Call from 0x7b840aa0 to unimplemented function msvcrt.dll._wspawnvp,
err:seh:setup_exception stack overflow 144 bytes in thread 0016 eip 7b840b3f
esp 00410f70 stack 0x411000-0x620000
--- snip ---

Quick fix is to use native msvcrt.dll (winecfg).
After that, .net apps should start successfully.

Though adding msvcrt._wspawnvp() should be a piece of cake, because the ANSI
version is already in place.


Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.

More information about the wine-bugs mailing list