Any way to make GetTypes() less brittle.

Posted by scope-creep on Stack Overflow See other posts from Stack Overflow or by scope-creep
Published on 2010-05-24T17:15:52Z Indexed on 2010/05/24 17:21 UTC
Read the original article Hit count: 130

Filed under:
|
|
|

I'm iterating through all the types in GAC, GAC_32 and GAC_MSIL looking for specific types, fundamentally to match those using clauses in my source code, so when I compile the source. I'll know exactly what assembly dll's to provide.

I'm getting all the file names from each of those directory and applying GetTypes to each assembly in turn and comparing the returned types against my using list. But the problem I have is that GetTypes() keeps crapping out with an exception, when it can't load the types from a loaded assembly.

Is their any way to make GetTypes() less brittle. For instance, when parsing this assembly on my box, {blbmmc, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}, it craps out.

Any suggestions welcome.

I know this is a fairly lengthly process, but I figure i'll eventually use a subset of common assemblies to search, or possibly cache the list of types->assembly dll name at program start.

Thanks.

© Stack Overflow or respective owner

Related posts about assembly

Related posts about assemblies