[Mono-bugs] [Bug 418452] New: AssemblyResolve event does not occur

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Aug 19 15:21:49 EDT 2008


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


           Summary: AssemblyResolve event does not occur
           Product: Mono: Class Libraries
           Version: 2.0
          Platform: x86
        OS/Version: Windows Vista
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: kobruleht2 at hot.ee
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


To reproduce:

1. Create assembly entityextension.dll containing code:

public class Extension { }

2. Create second assembly containing code:

public class Business
{
    public class Test : Extension { }

    public static void Configure()
    {
        new Business.Test();
    }

}

3. Create main assembly containing code

using System;
using System.CodeDom.Compiler;
using System.IO;
using System.Reflection;

class Program
{
    static void Main()
    {
        AppDomain.CurrentDomain.AssemblyResolve += new
ResolveEventHandler(CurrentDomain_AssemblyResolve);
        File.Delete("entityextension.dll");
        Business.Configure();
    }

    static Assembly CurrentDomain_AssemblyResolve(object sender,
ResolveEventArgs args)
    {
        if (args.Name.StartsWith("entityextension"))
        {
            Microsoft.CSharp.CSharpCodeProvider provider = new
Microsoft.CSharp.CSharpCodeProvider();

            CompilerParameters compilerParameters = new CompilerParameters
            {
                GenerateInMemory = true
            };

            CompilerResults compilerResults =
                 provider.CompileAssemblyFromSource(compilerParameters, "public
class Extension { }");
            if (compilerResults.Errors.HasErrors)
                throw new ApplicationException("Unexpected compile error");

            return compilerResults.CompiledAssembly;
        }
        return null;
    }
}

4. Create application with VCSE2008 SP1

5. Delete entityextension.dll assembly

6. Run application in Windows Vista

Observed:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or
assembly 'entityextension, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies.

File name: 'entityextension, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null'
  at Program.Main () [0x00000] 


Expected:

no exception


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


More information about the mono-bugs mailing list