I'm currently using VS2010 to debug a process on a remote machine. The assembly I'm trying to step in to is GAC'ed on the remote machine. I'm using Reflector 6.5.0.135.

When I hit a breakpoint, I get this error:
---------------------------
.NET Reflector
---------------------------
The loaded PDB file for the assembly "Microsoft.ResourceManagement" is not the one .NET Reflector expected. 



Expected version: “C:\Users\BrianDesmond\AppData\Local\Red Gate\.NET Reflector 6\Cache\V2\x86\CS\V35\Microsoft.ResourceManagement.pdbâ€



Loaded version: "C:\Windows\assembly\GAC_MSIL\Microsoft.ResourceManagement\4.0.3531.2__31bf3856ad364e35\Microsoft.ResourceManagement.pdb"



If the correct PDB file is not loaded, debugging may not work.
---------------------------
OK   
---------------------------

I've found that everything works if I click OK and step through (e.g. line info is correct, etc.), but no locals are resolved. I'm quite certain that I've copied the symbol file in question from the "expected" path to the "loaded" path.

Here is the error when I try and resolve a local:
Cannot obtain value of local or argument 'value' as it is not available at this instruction pointer, possibly because it has been optimized away.

Is this a supported scenario? If I really need to I can load VS on the box being debugged but I'd prefer not to.
bdesmond
0

Comments

3 comments

  • Clive Tong
    The first warning is not a problem. The system is trying to warn you (correctly) that the pdb it generated isn't loaded into the process being debugged. However, as you say, you've manually copied this pdb to the target machine and it has been loaded correctly.

    The inability to see the local variables is most likely due to the optimization the clr is doing - we supply the pdb file and then the debugger works with the clr to get the values without any intervention on our part. If you view Debug/Modules you'll probably see that the module is optimized. You can re-ngen a module with an ini file present to make it more debuggable - see, for example, http://msdn.microsoft.com/en-us/library/9dd8z24x.aspx
    Clive Tong
    0
  • bdesmond
    Clive Tong wrote:
    The first warning is not a problem. The system is trying to warn you (correctly) that the pdb it generated isn't loaded into the process being debugged. However, as you say, you've manually copied this pdb to the target machine and it has been loaded correctly.

    The inability to see the local variables is most likely due to the optimization the clr is doing - we supply the pdb file and then the debugger works with the clr to get the values without any intervention on our part. If you view Debug/Modules you'll probably see that the module is optimized. You can re-ngen a module with an ini file present to make it more debuggable - see, for example, http://msdn.microsoft.com/en-us/library/9dd8z24x.aspx

    Hi-

    Thanks for the reply - and sorry for the delay in following up. I didn't get an email alert for some reason.

    As far as the alert box, is there any way to disable it? I get it constantly now when debugging in this app and it's more of a nuisance now.

    I'll givehte NI file a shot. Since I've actually backed out a couple DLLs and the example is for an EXE, do I just create the INI file for the EXE hosting the DLLs and it will apply to the DLLs as well? What if the app's installer ngen'ed the assemblies at install time?
    bdesmond
    0
  • Clive Tong
    There's no way to turn off the alert in the current version.

    To make a particular ngen'ed assembly less optimized, you have to re-ngen that assembly. For example, recently I had cause to step through System.Core using Reflector Pro. In order to re-ngen System.Core to make it more debuggable, I

    (i) uninstalled the current ngen version
    ngen.exe uninstall System.Core.dll 
    

    (ii) created an ini file named System.Core.ini in the same directory which contained
    [.NET Framework Debugging Control]
    GenerateTrackingInfo=1
    AllowOptimize=0 
    

    (iii) re-ngened it using
    ngen.exe install System.Core.dll 
    

    Does that help?
    Clive Tong
    0

Add comment

Please sign in to leave a comment.