Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs')
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
index a7d4888d6d7..eabb8f84fb9 100644
--- a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
@@ -252,6 +252,8 @@ namespace System.Reflection.Emit {
}
private TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, Type[] interfaces, PackingSize packsize, int typesize) {
+ if (name_cache.Contains (name))
+ throw new ArgumentException ("Duplicate type name within an assembly.");
TypeBuilder res = new TypeBuilder (this, name, attr, parent, interfaces, packsize, typesize, null);
if (types != null) {
if (types.Length == num_types) {
@@ -433,7 +435,7 @@ namespace System.Reflection.Emit {
if (types == null)
return new TypeBuilder [0];
- int n = types.Length;
+ int n = num_types;
TypeBuilder [] copy = new TypeBuilder [n];
Array.Copy (types, copy, n);
@@ -624,9 +626,8 @@ namespace System.Reflection.Emit {
internal void Save ()
{
- if (transient)
+ if (transient && !is_main)
return;
-
if ((global_type != null) && (global_type_created == null))
global_type_created = global_type.CreateType ();