[Mono-bugs] [Bug 644316] New: AssemblyResolve handler subscribed immediately before the reference call does not get hit at the reference call

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Oct 6 15:33:28 EDT 2010


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

https://bugzilla.novell.com/show_bug.cgi?id=644316#c0


           Summary: AssemblyResolve handler subscribed immediately before
                    the reference call does not get hit at the reference
                    call
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: Other
        OS/Version: RHEL 4
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: cbutor at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=393398)
 --> (http://bugzilla.novell.com/attachment.cgi?id=393398)
Zip file containing ClassA.cs, Program.cs, and a Program directory

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.19)
Gecko/2010031422 Firefox/3.0.19 (.NET CLR 3.5.30729)

When working with an AssemblyResolve event handler that is subscribed
immediately before the possibly non-loaded assembly call, the handler will not
be hit and a type load exception will be thrown.  This is not the case with
NET as the handler is hit and the proper assembly is loaded - resulting in no
exception and successful program execution.

Reproducible: Always

Steps to Reproduce:
1.Unzip the attached "Mono_Bug" attachment
2.compile the ClassA.cs file with the following command:
gmcs /t:library ClassA.cs
3.compile the executable for Program.cs with the following command (note the
specific out directory!):
gmcs /t:exe /out:Program/Program.exe Program.cs /r:ClassA.dll
4.Navigate to the Program folder
5.Run the executable (mono Program.exe)
Actual Results:  
Type load exception is displayed:

[... Program]$ mono Program.exe
* (Program.exe:10425): WARNING **: The following assembly referenced from
/home/cebutor/dev/Mono_Bug/Program/Program.exe could not be loaded:
     Assembly:   ClassA    (assemblyref_index=1)
     Version:    0.0.0.0
     Public Key: (none)
The assembly was not found in the Global Assembly Cache, a path listed in the
MONO_PATH environment variable, or in the location of the executing assembly
(/home/cebutor/dev/Mono_Bug/Program/).


** (Program.exe:10425): WARNING **: Could not load file or assembly 'ClassA,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies.

** (Program.exe:10425): WARNING **: Missing method Initialize in assembly
/home/cebutor/dev/Mono_Bug/Program/Program.exe, type ClassA.ClassA

** (Program.exe:10425): WARNING **: Could not load file or assembly 'ClassA,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies.

** (Program.exe:10425): WARNING **: Missing method Initialize in assembly
/home/cebutor/dev/Mono_Bug/Program/Program.exe, type ClassA.ClassA

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or
assembly 'ClassA, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one
of its dependencies.
File name: 'ClassA, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
  at ClassB.Program.Main (System.String[] args) [0x00000]


Expected Results:  
No error should be observed:

[... Program]$ mono Program.exe
[... Program]$


If line 19 in Program.cs (System.Threading.Thread.Sleep(500)), and the Program
is rebuilt (again, specifying gmcs's output to the Program directory so that
the Program executable and the referenced dll are NOT in the same directory),
the error goes away.  This could point to a timing issue between the
subscription of the event handler and the call that should fire the event.

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