internal static bool GenerateSerializer(Type[] types, XmlMapping[] mappings, Stream stream) { if (types == null || types.Length == 0) { return(false); } if (mappings == null) { throw new ArgumentNullException(nameof(mappings)); } if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (XmlMapping.IsShallow(mappings)) { throw new InvalidOperationException(SR.XmlMelformMapping); } Assembly assembly = null; for (int i = 0; i < types.Length; i++) { Type type = types[i]; if (DynamicAssemblies.IsTypeDynamic(type)) { throw new InvalidOperationException(SR.Format(SR.XmlPregenTypeDynamic, type.FullName)); } if (assembly == null) { assembly = type.Assembly; } else if (type.Assembly != assembly) { throw new ArgumentException(SR.Format(SR.XmlPregenOrphanType, type.FullName, assembly.Location), nameof(types)); } } return(TempAssembly.GenerateSerializerToStream(mappings, types, null, assembly, new Hashtable(), stream)); }