> > This is just a workaround for the problem that can cause undesired
> > behavior under some circumstances. The clean fix would involve
> > more complex changes in several files - I can put it together if
> > there is interest in it.
>
> Thanks for your detailed reply, Jan. Your patch would work.
>
> I've also implemented another workaround, which a bit more involved
> where I use a flag bit in MethodDesc to indicate if its body has been
> changed, and change GetILHeader to return base + (unresolved) rva if
> that the case. This doesn't work for someone calling GetILCode directly
> with an rva obtained from metadata. And perhaps it suffers from similar
> undesired behaviors as your patch?
>
> In any case, I'd like to have a proper fix for the problem.

Same goes for me. (Actually, I'm very glad that someone from Microsoft did
notice this problem; I had already given up and believed I was doing
something completely wrong.) And I'd also like to know, what these image
flags mean, after all.

And, by the way, is Get/SetILFunctionBody only broken in Rotor, or is it the
same with the CLR? Because I was getting BadImageFormatExceptions (at least
I think so, they might also have been InvalidProgramExceptions) with the
"real" CLR, too: when I tried to replace a method in mscorlib, with Rotor I
had the problem described by Nam, with the CLR I got these exceptions.

Fabian

Reply via email to