[Mono-bugs] [Bug 436189] Failed to create shadow copy (CopyFile) exception

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Oct 17 11:36:50 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=436189

User francis at aspl.es added comment
https://bugzilla.novell.com/show_bug.cgi?id=436189#c4





--- Comment #4 from Francis Brosnan <francis at aspl.es>  2008-10-17 09:36:49 MDT ---
Hi Paolo,

Finally we have isolated the bug. It is associated with
AppDomain.AppendPrivatePath.

The problem is triggered under windows, by calling to append a private path to
your current app domain with the same directory as the assembly main exe. Under
this context, if you perform more calls to AppendPrivatePath with other
directories containing more assemblies, they are treated as private, causing
mono_make_shadow_copy to try to do a copy (and failing to do so).

However, under Linux this behaviour is not showed. I'm attaching a test case
that runs properly on linux but not on windows. It is included with make files.
This is how to execute it:

>> tar xzvf mono-test-case.tar.gz
>> cd mono-test-case
>> make
>> MONO_PATH=Common/loader ./app.exe 
Adding base directory: /mnt/spare/acinom/test/mono-test-case
Base dir: /mnt/spare/acinom/test/mono-test-case
Found dll:
/mnt/spare/acinom/test/mono-test-case/Common/test-object/test-object.dll
appending path: /mnt/spare/acinom/test/mono-test-case/Common/test-object
Do!

Under windows, you must change the latest sentence with:

>> MONO_PATH=Common\\loader mono.exe app.exe

Tracking the problem at mono_make_shadow_copy, I see set_domain_search_path
setting to "" when a path is found to be the same as the first path configured
(tmp[0]) which is likely to be the location of the main .exe:

mono-2.0/mono/metadata/appdomain.c:1015
        if (strncmp (tmp [0], reduced, appbaselen)) {
                g_free (reduced);
                g_free (tmp [i]);
                tmp [i] = g_strdup ("");
                continue;
        }

.this then cause at mono_make_shadow_copy to set is_private to TRUE (line
1237) for each assembly found after paths that were "cleared" by setting "":

        for (path = domain->search_path; *path; path++) {
                if (**path == '\0') {
                        is_private = TRUE;
                        continue;
                }

                if (!is_private)
                        continue;

                if (strstr (dir_name, *path) == dir_name) {
                        do_copy = TRUE;
                        break;
                }
        }

We have solved the problem making our code to take care on windows to not
append a path that is also containing the main executable (in this case
app.exe). After doing this change it works.

Cheers!


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list