Register resolve handler before loading types

This commit is contained in:
yck1509 2015-02-25 17:04:53 +08:00
Родитель 2dbeec00a3
Коммит 9e0397dab6
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -58,12 +58,13 @@ namespace Confuser.Runtime {
Array.Clear(b, 0, b.Length); Array.Clear(b, 0, b.Length);
h.Free(); h.Free();
Array.Clear(q, 0, q.Length); Array.Clear(q, 0, q.Length);
// For some reasons, reflection on Assembly would not discover the types unless GetTypes is called.
m.GetTypes();
key = n.ResolveSignature(Mutation.KeyI2); key = n.ResolveSignature(Mutation.KeyI2);
AppDomain.CurrentDomain.AssemblyResolve += Resolve; AppDomain.CurrentDomain.AssemblyResolve += Resolve;
// For some reasons, reflection on Assembly would not discover the types unless GetTypes is called.
m.GetTypes();
MethodBase e = m.ResolveMethod(key[0] | (key[1] << 8) | (key[2] << 16) | (key[3] << 24)); MethodBase e = m.ResolveMethod(key[0] | (key[1] << 8) | (key[2] << 16) | (key[3] << 24));
var g = new object[e.GetParameters().Length]; var g = new object[e.GetParameters().Length];
if (g.Length != 0) if (g.Length != 0)