diff --git a/src/Eto/Platform.cs b/src/Eto/Platform.cs index 7502d79829..6fb25501f6 100644 --- a/src/Eto/Platform.cs +++ b/src/Eto/Platform.cs @@ -611,14 +611,24 @@ internal HandlerInfo FindHandler(Type type) return info; var handler = type.GetCustomAttribute(true); - Func activator; - if (handler != null && instantiatorMap.TryGetValue(handler.Type, out activator)) + if (handler != null) { - var autoInit = handler.Type.GetCustomAttribute(true); - info = new HandlerInfo(autoInit == null || autoInit.Initialize, activator); - handlerMap.Add(type, info); - return info; + if (instantiatorMap.TryGetValue(handler.Type, out var activator)) + { + var autoInit = handler.Type.GetCustomAttribute(true); + info = new HandlerInfo(autoInit == null || autoInit.Initialize, activator); + handlerMap.Add(type, info); + return info; + } + // load the assembly of the handler type (needed when type is a subclass) + if (!loadedAssemblies.Contains(handler.Type.GetAssembly())) + { + LoadAssembly(handler.Type.GetAssembly()); + return FindHandler(type); + } } + + // load the assembly of the target type (can be a subclass) if (!loadedAssemblies.Contains(type.GetAssembly())) { LoadAssembly(type.GetAssembly());