diff options
author | Maarten Bosmans <mkbosmans@gmail.com> | 2009-12-26 12:23:48 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2010-01-04 10:01:23 +0100 |
commit | 7a1154182baf1742a4a08db0120b50cc27d7e7e8 (patch) | |
tree | 4734e1daa8d751e3c8083dea9b19322eab56bd0a | |
parent | 7cd7afbfa64ebc0a712f6d7fbfd9ccb230deacef (diff) |
Handle the case where not all types of an assembly can be loaded
-rw-r--r-- | gstreamer-sharp/Application.cs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gstreamer-sharp/Application.cs b/gstreamer-sharp/Application.cs index 08ca68b..b365a74 100644 --- a/gstreamer-sharp/Application.cs +++ b/gstreamer-sharp/Application.cs @@ -88,9 +88,14 @@ namespace Gst { // Add types with GTypeNameAttribute in TypeCache if (result) { AssemblyTypesInCache[asm.GetHashCode ()] = true; - Type[] ts = asm.GetTypes (); + Type[] ts; + try { + ts = asm.GetTypes (); + } catch (ReflectionTypeLoadException e) { + ts = e.Types; + } foreach (Type t in ts) { - if (t.IsDefined (typeof (GTypeNameAttribute), false)) { + if (t != null && t.IsDefined (typeof (GTypeNameAttribute), false)) { GTypeNameAttribute gattr = (GTypeNameAttribute) Attribute.GetCustomAttribute (t, typeof (GTypeNameAttribute), false); TypeCache[gattr.TypeName] = t; } |