Fixed dynamic assembly saving (debug option).

This commit is contained in:
jfrijters 2009-07-13 08:00:18 +00:00
Родитель ab8f450751
Коммит 90f389b530
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -71,7 +71,9 @@ namespace IKVM.Internal
#if !STATIC_COMPILER
if(JVM.IsSaveDebugImage)
{
saveClassLoaders = new List<DynamicClassLoader>();
#if !CLASSGC
saveClassLoaders.Add(instance);
#endif
}
// TODO AppDomain.TypeResolve requires ControlAppDomain permission, but if we don't have that,
// we should handle that by disabling dynamic class loading
@ -415,8 +417,12 @@ namespace IKVM.Internal
private static ModuleBuilder CreateModuleBuilder()
{
AssemblyName name = new AssemblyName();
if(saveClassLoaders != null)
if(JVM.IsSaveDebugImage)
{
if(saveClassLoaders == null)
{
System.Threading.Interlocked.CompareExchange(ref saveClassLoaders, new List<DynamicClassLoader>(), null);
}
// we ignore the race condition (we could end up with multiple assemblies with the same name),
// because it is pretty harmless (you'll miss one of the ikvmdump-xx.dll files)
name.Name = "ikvmdump-" + saveClassLoaders.Count;