.net.net-4.0clrngenclr-profiling-api

Why do plain, non-profile-optimized native images aren't loaded by my CLR profiler?


I'm developing a CLR profiler, using the CLR profiling interfaces, and having a hard time getting the CLR to load plain, non-profile-optimized native images (that were compiled with ngen.exe without the /profile option) when running my profiler (or at least, it seems that such images are not loaded, but for now I can't tell for sure). What am I doing wrong?

I have verified that the COR_PRF_USE_PROFILE_IMAGES flag (which will only allow for profile optimized native images) is not set in my profiler.

Below is what I've tried. Any help/tips are much appreciated!

FUSLOGVW outputs:

I've been inspecting the native image binder logs (in FUSLOGVW.exe) trying to figure out whether images are loaded or not:

Additional Information:


Solution

  • Coming back to answer my own question, it seems that the native images were indeed loaded! (both kinds - plain and profile optimized). The problem was my understanding that this was indeed the case.

    The source of my consufion was misreading FUSLOGVW log outputs. Specifically, somehow I missed to see that WRN: Native image compile options do not match request. Looking for next native image was given for the /profile image, but image search continued and found the plain, non profile image, and succeeded.

    What helped my understanding eventually was Visual Studio. When debugging the CLR profiler in Visual Studio, the binding of native images was displayed in the Debug Output window, where it also showed the DLLs being loaded:

    'CSharpTestProgram.exe' (Win32): Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\2ef49acbb43c068f6ddf1587283b5f29\mscorlib.ni.dll'. 
    

    Visual Studio - Output - Native Image

    Once I got this, FUSLOGVW logs started to make more sense, and I could understand exactly which image is loaded and when.

    Another observation was that the mscorlib /profile image takes up more disk space than the plain native image (30% larger in my case), which also helped me correlate between the image path and whether it's /profile or not.