Skip to content

Commit

Permalink
Merge pull request #1966 from JustArchi/patch-1
Browse files Browse the repository at this point in the history
System.UriFormatException on load (Mono)
  • Loading branch information
304NotModified committed Feb 15, 2017
2 parents 5c51004 + f5d1b68 commit c277ecc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/NLog/Config/ConfigurationItemFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,14 @@ private static ConfigurationItemFactory BuildDefaultFactory()

try
{
var assemblyLocation = Path.GetDirectoryName(new Uri(nlogAssembly.CodeBase).LocalPath);
Uri assemblyCodeBase;
if (!Uri.TryCreate(nlogAssembly.CodeBase, UriKind.RelativeOrAbsolute, out assemblyCodeBase))
{
InternalLogger.Warn("No auto loading because assembly code base is unknown");
return factory;
}

var assemblyLocation = Path.GetDirectoryName(assemblyCodeBase.LocalPath);
if (assemblyLocation == null)
{
InternalLogger.Warn("No auto loading because Nlog.dll location is unknown");
Expand Down

0 comments on commit c277ecc

Please sign in to comment.