public void Export(ICollection<Assembly> assemblies)
{
if (assemblies == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(assemblies)));
TraceExportBegin();
DataContractSet oldValue = (_dataContractSet == null) ? null : new DataContractSet(_dataContractSet);
try
{
foreach (Assembly assembly in assemblies)
{
if (assembly == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.CannotExportNullAssembly, nameof(assemblies))));
Type[] types = assembly.GetTypes();
for (int j = 0; j < types.Length; j++)
CheckAndAddType(types[j]);
}
Export();
}
catch (Exception ex)
{
if (DiagnosticUtility.IsFatal(ex))
{
throw;
}
_dataContractSet = oldValue;
TraceExportError(ex);
throw;
}
TraceExportEnd();
}