Updated Branches: refs/heads/branch_4x ef3c4e7c8 -> ee9d4da55
Swallow exceptions in SPIClassIterator Sometimes due to invalid dependencies, etc. Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/ee9d4da5 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/ee9d4da5 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/ee9d4da5 Branch: refs/heads/branch_4x Commit: ee9d4da55a8a385787d65430f904204fb5c1678a Parents: ef3c4e7 Author: Paul Irwin <[email protected]> Authored: Thu Nov 7 14:52:11 2013 -0500 Committer: Paul Irwin <[email protected]> Committed: Thu Nov 7 14:52:11 2013 -0500 ---------------------------------------------------------------------- src/core/Util/SPIClassIterator.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee9d4da5/src/core/Util/SPIClassIterator.cs ---------------------------------------------------------------------- diff --git a/src/core/Util/SPIClassIterator.cs b/src/core/Util/SPIClassIterator.cs index 4601b44..0d865fa 100644 --- a/src/core/Util/SPIClassIterator.cs +++ b/src/core/Util/SPIClassIterator.cs @@ -20,10 +20,24 @@ namespace Lucene.Net.Util foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { - foreach (var type in assembly.GetTypes()) + try { - if (typeof(S).IsAssignableFrom(type) && !type.IsAbstract && !type.IsInterface && type.GetConstructor(Type.EmptyTypes) != null) - _types.Add(type); + foreach (var type in assembly.GetTypes()) + { + try + { + if (typeof(S).IsAssignableFrom(type) && !type.IsAbstract && !type.IsInterface && type.GetConstructor(Type.EmptyTypes) != null) + _types.Add(type); + } + catch + { + // swallow + } + } + } + catch + { + // swallow } } }
