From: Maarten Bosmans Date: Sat, 26 Dec 2009 11:23:48 +0000 (+0100) Subject: Handle the case where not all types of an assembly can be loaded X-Git-Tag: 1.19.3~483^2~361 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a1154182baf1742a4a08db0120b50cc27d7e7e8;p=platform%2Fupstream%2Fgstreamer.git Handle the case where not all types of an assembly can be loaded --- diff --git a/gstreamer-sharp/Application.cs b/gstreamer-sharp/Application.cs index 08ca68b9aa..b365a74655 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; }