Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Merge in 'release/2.0.0' changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnet-bot committed Feb 12, 2018
2 parents 3e1de6c + d96927a commit e612053
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/System.Private.Xml/src/System/Xml/Serialization/Compilation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,29 @@ internal static Assembly LoadGeneratedAssembly(Type type, string defaultNamespac
name.Name = serializerName;
name.CodeBase = null;
name.CultureInfo = CultureInfo.InvariantCulture;
string serializerPath = Path.Combine(Path.GetDirectoryName(type.Assembly.Location), serializerName + ".dll");
if (!File.Exists(serializerPath))
{
serializerPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), serializerName + ".dll");
}

string serializerPath = null;

try
{
serializer = Assembly.LoadFile(serializerPath);
if (!string.IsNullOrEmpty(type.Assembly.Location))
{
serializerPath = Path.Combine(Path.GetDirectoryName(type.Assembly.Location), serializerName + ".dll");
}

if ((string.IsNullOrEmpty(serializerPath) || !File.Exists(serializerPath)) && !string.IsNullOrEmpty(Assembly.GetEntryAssembly().Location))
{
serializerPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), serializerName + ".dll");
}

if (!string.IsNullOrEmpty(serializerPath))
{
serializer = Assembly.LoadFile(serializerPath);
}
}
catch (Exception e)
{
if (e is OutOfMemoryException)
if (e is StackOverflowException || e is OutOfMemoryException)
{
throw;
}
Expand All @@ -195,6 +205,7 @@ internal static Assembly LoadGeneratedAssembly(Type type, string defaultNamespac
return null;
}
}

if (serializer == null)
{
return null;
Expand Down

0 comments on commit e612053

Please sign in to comment.