You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Josh Steward (JIRA)" <ji...@apache.org> on 2017/01/11 00:38:58 UTC
[jira] [Created] (AVRO-1981) ReflectionTypeLoadException
Josh Steward created AVRO-1981:
----------------------------------
Summary: ReflectionTypeLoadException
Key: AVRO-1981
URL: https://issues.apache.org/jira/browse/AVRO-1981
Project: Avro
Issue Type: Bug
Components: csharp
Reporter: Josh Steward
Priority: Minor
In the ObjectCreator the call to FindType(name, throwError) can throw a ReflectionTypeLoadException during the call to assembly.GetTypes() if any of the types are not able to load, MSDN link below for ref. This effectively kills the entire deserialization process. I put in a simple workaround to just continue if this happens. In my particular case it was trying to load types from a devexpress test runner dll.
https://msdn.microsoft.com/en-us/library/system.reflection.assembly.gettypes(v=vs.110).aspx
private Type FindType(string name,bool throwError)
{
//other code
foreach (Assembly assembly in assemblies)
{
// Fix for Mono 3.0.10
if (assembly.FullName.StartsWith("MonoDevelop.NUnit"))
continue;
/*Added catch in case assembly contains unloadable types*/
try
{
types = assembly.GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
continue;
}
//other code
}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)