[Mono-bugs] [Bug 418469] New: Dynamic assembly load causes mono to stop responding
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Aug 19 15:52:00 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=418469
Summary: Dynamic assembly load causes mono to stop responding
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:
using System;
using System.CodeDom.Compiler;
using System.Reflection;
public class Business
{
public class Test : Extension { }
}
public static class EntityManager
{
public static void Configure()
{
}
public static Business.Test Reference()
{
return new Business.Test();
}
static EntityManager()
{
AppDomain.CurrentDomain.AssemblyResolve +=
CurrentDomain_AssemblyResolve;
}
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;
}
}
3. Create main assembly containing code:
using System;
using System.CodeDom.Compiler;
using System.IO;
using System.Reflection;
using System.Collections.Generic;
class Program
{
static void Main()
{
File.Delete("entityextension.dll");
EntityManager.Configure();
ParseAppDomain();
}
static void ParseAppDomain()
{
var interfaceImplementations = new Dictionary<Type, IList<Type>>();
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
Parse(assembly, interfaceImplementations);
}
}
static void Parse(Assembly assembly, IDictionary<Type, IList<Type>>
interfaceImplementations)
{
try
{
var assemblyTypes = assembly.GetTypes();
foreach (Type type in assemblyTypes)
{
if (type.IsAbstract)
continue;
foreach (Type i in type.GetInterfaces())
{
if (i.Assembly.GetCustomAttributes(typeof(DbLinqAttribute),
false).Length > 0)
{
IList<Type> types;
if (!interfaceImplementations.TryGetValue(i, out
types))
interfaceImplementations[i] = types = new
List<Type>();
types.Add(type);
}
}
}
}
catch (ReflectionTypeLoadException) { }
}
}
[AttributeUsage(AttributeTargets.Assembly)]
public class DbLinqAttribute : System.Attribute
{
}
4. Create application using VSCE2008 SP1. Run application in Vista.
Observed:
4.1 Application stops responding. Only killing mono process in task manager
stops it.
4.2 In other testcase unhandled exception occurs:
at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes (bool)
<0x00004>
at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes (bool)
<0xffffffff>
at System.Reflection.Assembly.GetTypes () <0x00010>
at DbLinq.Factory.Implementation.ReflectionObjectFactory.Parse
(System.Reflection.Assembly,System.Collections.Generic.IDictionary`2) <0x0002c>
at DbLinq.Factory.Implementation.ReflectionObjectFactory.ParseAppDomain ()
<0x000c1>
at DbLinq.Factory.Implementation.ReflectionObjectFactory.get_Implementations
() <0x00037>
at DbLinq.Factory.Implementation.ReflectionObjectFactory.GetNewInstance
(System.Type) <0x0004a>
at DbLinq.Factory.Implementation.ReflectionObjectFactory.GetSingleton
(System.Type) <0x00049>
at DbLinq.Factory.Implementation.ReflectionObjectFactory.GetInstance
(System.Type,bool) <0x00042>
at DbLinq.Factory.Implementation.AbstractObjectFactory.Get () <0x00018>
at DbLinq.Factory.ObjectFactory.Get () <0x0002b>
at DbLinq.Linq.DataContext..ctor
(DbLinq.Linq.Database.IDatabaseContext,System.Data.Linq.Mapping.MappingSource,DbLinq.Vendor.IVendor)
<0x000f0>
at DbLinq.Linq.DataContext..ctor
(DbLinq.Linq.Database.IDatabaseContext,DbLinq.Vendor.IVendor) <0x00012>
at DbLinq.Linq.DataContext..ctor
(System.Data.IDbConnection,DbLinq.Vendor.IVendor) <0x00031>
..
at (wrapper runtime-invoke) System.Object.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Expected:
application should exit after run.
--
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