Type ReadType(ByteReader br, out string typeName)
{
typeName = br.ReadString();
if (typeName == null)
{
return null;
}
if (typeName.Length > 0 && typeName[typeName.Length - 1] == 0)
{
// there are broken compilers that emit an extra NUL character after the type name
typeName = typeName.Substring(0, typeName.Length - 1);
}
var type = universe.ResolveType(assembly, typeName);
if (type != null && type.Assembly == mscorlib)
{
// we don't want that!
type = universe.ResolveType(assembly, type.FullName + ", mscorlib, Version=0.0.0.0");
}
return type;
}