[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


User francis at aspl.es added comment

--- 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

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:
appending path: /mnt/spare/acinom/test/mono-test-case/Common/test-object

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:

        if (strncmp (tmp [0], reduced, appbaselen)) {
                g_free (reduced);
                g_free (tmp [i]);
                tmp [i] = g_strdup ("");

.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;

                if (!is_private)

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

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.


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