mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-01 03:52:25 +00:00
Handle the case where not all types of an assembly can be loaded
This commit is contained in:
parent
7cd7afbfa6
commit
7a1154182b
1 changed files with 7 additions and 2 deletions
|
@ -88,9 +88,14 @@ namespace Gst {
|
||||||
// Add types with GTypeNameAttribute in TypeCache
|
// Add types with GTypeNameAttribute in TypeCache
|
||||||
if (result) {
|
if (result) {
|
||||||
AssemblyTypesInCache[asm.GetHashCode ()] = true;
|
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) {
|
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);
|
GTypeNameAttribute gattr = (GTypeNameAttribute) Attribute.GetCustomAttribute (t, typeof (GTypeNameAttribute), false);
|
||||||
TypeCache[gattr.TypeName] = t;
|
TypeCache[gattr.TypeName] = t;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue