mercredi 12 août 2015

Function imported from .net assembly always returns true on windows 8

I'm importing functions into my code at runtime from a .net dll I compiled on windows 7 64bit.

Pseudo:

delegate bool Test(int i);

var assembly = Assembly.LoadFrom(...);
var type = assembly.GetType(...);
var method = type.GetMethod(...);
Test test = (Test) Delegate.CreateDelegate(typeof(Test), method);

Now, when I call the imported function on windows 7 (which I compiled everything on) it works like it is supposed to, however, when I call it on windows 8 (64bit) it always returns true, even if the only thing the function does is "return false". In both cases, the function seems to be imported correctly. I checked with

Console.WriteLine(test.Method.ToString());

And it does output the function's name and type.

Any ideas what might be causing it?





Aucun commentaire:

Enregistrer un commentaire