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