c# - How to check if referenced dll is needed for class on runtime -


i hav ea program dynamically loads , adds elements based on found dlls in given directory. (in short: assembly.loadfrom("...xyz.dll").gettypes().where(t => typeof(mybaseclass).isassignablefrom(t).select(t => activator.createinstance(t)))

now of dlls (including multiple classes derived mybaseclass) require additional referenced dlls, not included (like when using api-dll program). typically handled appdomain.currentdomain.assemblyresolve event, dynamically load missing api-dlls based on installation paths) result, when using assembly.gettypes(), "reflectiontypeloadexception ex" subtype "filenotfoundexception" part of ex.loaderexceptions.
clarify: exception ok, because api-dlls part of other programs; if run program on pc without these programs installed, of course referenced api-dlls missing (and adding them program not allowed).

my question is: how can filter listed types (either assembly.gettypes() or reflectiontypeloadexception ex.types) remove classes use 1 of missing api.dlls (or use class use 1 of etc.)? - assembly.getreferencedasseblies() lists referenced assemblies of top level assembly. mentioned, can contain multiply classes based on mybaseclass, of e.g. 1 uses missing api-dll (defined "using ..." @ start)

as addition: can automatically split .currentdomain.assemblyresolve event regarded top assemblies? having (static?) resolve method in each of dlls handles missing sub-assemblies instead of 1 method in mainform?

thank in advance!

best regards, robin


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -