Fabian Schmied wrote:
>
> Jan, you are right, it actually does work. I guess, the exception I am
> remembering occurred due to something else (I was also having problems with
> DefineMethod not being callable in JitCompilationStarted and similar
> things).

As I reported earlier, I have no problems replacing bodies of methods
in mscorlib in the real CLR.

> The image flags I meant were CorLoadOSMap, CorLoadOSImage, and
> CorLoadDataMap (as opposed to CorLoadImageMap), which causes the bug to
> occur. Because only when a module has one of these flags, the
> Cor_RtlImageRvaToOffset method is called. I was just interested in what
> these flags actually mean.

I don't know what they mean exactly, either. But I think "all" code
assemblies have 1 of these 3 flags. mscorlib has CorLoadOSImage, user
assembly with main method has CorLoadDataMap (due to earlier PE file
load for verification) and all other assemblies have CorLoadOSMap.

>
> Fabian
>
> ----- Original Message -----
> From: "Jan Kotas" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, March 19, 2003 10:26 PM
> Subject: Re: [DOTNET-ROTOR] Get/SetILFunctionBody" bug in Shared Source CLI
> 1.0 Release? - II
>
> > > In any case, I'd like to have a proper fix for the problem.
> >
> > Same goes for me.
>
> Okay okay ... I will try to put together a clean fix for this problem in
> a couple days.

I look forward to this real fix!

> > And I'd also like to know, what these image flags mean, after all.
>
> Which image flags do you mean?
>
> > 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.
>
> The "real" CLR should be fine. I have tried the following with the CLR
> v1.0.3705:
>
> 1. download the dnprofiler sample from
> http://msdn.microsoft.com/msdnmag/issues/01/12/hood/default.aspx
>
> 2. Replaced CProfilerCallback::JITCompilationStarted method in the
> sample with the attached code fragment. This code fragment expects
> Console.WriteLine(int) in mscorlib to be called, and changes it to
> always print 1.
>
> 3. Build the modified dnprofiler sample and register it by running
> profiling_on.bat.
>
> 4. Compile and run the following program:
>
> using System;
>
> class My {
>    static void Main() {
>        Console.WriteLine(2);
>        Console.WriteLine(3);
>        Console.WriteLine(4);
>    }
> }
>
> It prints "1 1 1" as expected.
>
> 5. Don't forget to unregister the profiler once you are done with the
> experiments...
>
> Can you try to reproduce this on your machine? If you can come up with a
> short example of what did not worked for you, I can take a look...
>
> -Jan
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.

Thanks,
Nam.

Reply via email to