##// END OF EJS Templates
Fixed Safe.DisposeCollection NullReferenceException...
cin -
r292:807f0bc35f40 v3
parent child
Show More
@@ -7,7 +7,7
7 7 Provides simple and flexible Xml configuration for UnityContainer.
8 8 </Description>
9 9 <Copyright>2012-2018 Sergey Smirnov</Copyright>
10 <Version>1.0.1</Version>
10 <Version>1.0.3</Version>
11 11 <PackageLicenseUrl>https://bitbucket.org/wozard/implabnet/src/v3/Implab/license.txt</PackageLicenseUrl>
12 12 <PackageProjectUrl>https://bitbucket.org/wozard/implabnet</PackageProjectUrl>
13 13 <RepositoryUrl>https://bitbucket.org/wozard/implabnet</RepositoryUrl>
@@ -101,10 +101,12 namespace Implab.ServiceHost.Unity {
101 101
102 102 public void AddNamespace(string ns) {
103 103 m_resolver.AddNamespace(ns);
104 Log.Log($"AddNamespace: {ns}");
104 105 }
105 106
106 107 public void AddAssembly(string assembly) {
107
108 var asm = Assembly.Load(assembly);
109 Log.Log($"AddAssembly: {assembly} -> {asm.FullName}");
108 110 }
109 111
110 112 /// <summary>
@@ -145,6 +147,9 namespace Implab.ServiceHost.Unity {
145 147
146 148 public void LoadConfig(Uri location) {
147 149 Safe.ArgumentNotNull(location, nameof(location));
150
151 Log.Log($"LoadConfig {location}");
152 Safe.ArgumentNotNull(location, nameof(location));
148 153
149 154 m_location = location;
150 155
@@ -75,27 +75,31 namespace Implab
75 75 }
76 76
77 77 public static void Dispose(params IDisposable[] objects) {
78 foreach (var d in objects)
79 if (d != null)
80 d.Dispose();
78 if (objects != null)
79 foreach (var d in objects)
80 if (d != null)
81 d.Dispose();
81 82 }
82 83
83 84 public static void Dispose(params object[] objects) {
84 foreach (var obj in objects) {
85 var d = obj as IDisposable;
86 if (d != null)
87 d.Dispose();
88 }
85 if (objects != null)
86 foreach (var obj in objects) {
87 var d = obj as IDisposable;
88 if (d != null)
89 d.Dispose();
90 }
89 91 }
90 92
91 93 public static void DisposeCollection(IEnumerable<IDisposable> objects) {
92 foreach (var d in objects)
93 Dispose(d);
94 if (objects != null)
95 foreach (var d in objects)
96 Dispose(d);
94 97 }
95 98
96 99 public static void DisposeCollection(IEnumerable objects) {
97 foreach (var d in objects)
98 Dispose(d);
100 if (objects != null)
101 foreach (var d in objects)
102 Dispose(d);
99 103 }
100 104
101 105 public static void Dispose(object obj) {
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

ok, latest stable version should be in default

You need to be logged in to leave comments. Login now