# HG changeset patch # User cin # Date 2018-06-21 15:13:02 # Node ID 807f0bc35f40ce36df16880ac008fc873728c6e4 # Parent 450a55e0c2222a63e25e6dbdb2adb4096cf5a2c4 Fixed Safe.DisposeCollection NullReferenceException Added logs to ContainerBuilder diff --git a/Implab.ServiceHost/Implab.ServiceHost.csproj b/Implab.ServiceHost/Implab.ServiceHost.csproj --- a/Implab.ServiceHost/Implab.ServiceHost.csproj +++ b/Implab.ServiceHost/Implab.ServiceHost.csproj @@ -7,7 +7,7 @@ Provides simple and flexible Xml configuration for UnityContainer. 2012-2018 Sergey Smirnov - 1.0.1 + 1.0.3 https://bitbucket.org/wozard/implabnet/src/v3/Implab/license.txt https://bitbucket.org/wozard/implabnet https://bitbucket.org/wozard/implabnet diff --git a/Implab.ServiceHost/src/Unity/ContainerBuilder.cs b/Implab.ServiceHost/src/Unity/ContainerBuilder.cs --- a/Implab.ServiceHost/src/Unity/ContainerBuilder.cs +++ b/Implab.ServiceHost/src/Unity/ContainerBuilder.cs @@ -101,10 +101,12 @@ namespace Implab.ServiceHost.Unity { public void AddNamespace(string ns) { m_resolver.AddNamespace(ns); + Log.Log($"AddNamespace: {ns}"); } public void AddAssembly(string assembly) { - + var asm = Assembly.Load(assembly); + Log.Log($"AddAssembly: {assembly} -> {asm.FullName}"); } /// @@ -145,6 +147,9 @@ namespace Implab.ServiceHost.Unity { public void LoadConfig(Uri location) { Safe.ArgumentNotNull(location, nameof(location)); + + Log.Log($"LoadConfig {location}"); + Safe.ArgumentNotNull(location, nameof(location)); m_location = location; diff --git a/Implab/src/Safe.cs b/Implab/src/Safe.cs --- a/Implab/src/Safe.cs +++ b/Implab/src/Safe.cs @@ -75,27 +75,31 @@ namespace Implab } public static void Dispose(params IDisposable[] objects) { - foreach (var d in objects) - if (d != null) - d.Dispose(); + if (objects != null) + foreach (var d in objects) + if (d != null) + d.Dispose(); } public static void Dispose(params object[] objects) { - foreach (var obj in objects) { - var d = obj as IDisposable; - if (d != null) - d.Dispose(); - } + if (objects != null) + foreach (var obj in objects) { + var d = obj as IDisposable; + if (d != null) + d.Dispose(); + } } public static void DisposeCollection(IEnumerable objects) { - foreach (var d in objects) - Dispose(d); + if (objects != null) + foreach (var d in objects) + Dispose(d); } public static void DisposeCollection(IEnumerable objects) { - foreach (var d in objects) - Dispose(d); + if (objects != null) + foreach (var d in objects) + Dispose(d); } public static void Dispose(object obj) {