Skip to content

Instantly share code, notes, and snippets.

@jfsurban
Created July 26, 2012 07:02
Show Gist options
  • Save jfsurban/3180662 to your computer and use it in GitHub Desktop.
Save jfsurban/3180662 to your computer and use it in GitHub Desktop.
Prevent ReflectionTypeLoadException when calling Assembly.GetTypes()
// http://stackoverflow.com/questions/7889228/how-to-prevent-reflectiontypeloadexception-when-calling-assembly-gettypes
Type[] types;
try
{
types = asm.GetTypes();
}
catch (ReflectionTypeLoadException e)
{
types = e.Types;
}
foreach (var t in types.Where(t => t != null))
{
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment