ICorDebugManagedCallback methods not called when attaching to ASP.NET worker process

مؤمّن ICorDebugManagedCallback methods not called when attaching to ASP.NET worker process

  • Thursday, July 28, 2011 3:08 PM
     
      Has Code

    Hey,

    I am developing a debugger and I noticed that the methods from ICorDebugManagedCallback are not raised (in my debugger code) when I attach to a ASP.NET worker process (aspnet_iis.exe or w3wp.exe); on other application types (console or UI - WinForms/WPF), the methods are raised.

    Any help will be appreciated!

    Thanks


    Eusebiu
    • Changed Type Jon LangdonOwner Wednesday, October 19, 2011 3:00 PM Haven't gotten a response from originator
    • Changed Type Jon LangdonOwner Friday, January 06, 2012 1:21 AM no response from poster
    •  

All Replies

  • Wednesday, August 03, 2011 9:28 AM
    Moderator
     
     

    Hi,

    Could you please provide some code snippet?

    Any information that helps us reproduce this issue is appreciated.

    Have a nice day,


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Wednesday, August 03, 2011 12:33 PM
     
      Has Code

    Hey,

    It will be a little difficult to provide a complete code but I will try. :)

    I have a proxy

    class ManagedCallbackProxy : ICorDebugManagedCallback, ICorDebugManagedCallback2
    

    where the callback methods are implemented, e.g.

    public void LoadModule(System.IntPtr pAppDomain, System.IntPtr pModule)
    


    The class that represent the debugger has a reference to a callback instance.

    [DllImport("mscoree.dll", CharSet=CharSet.Unicode, PreserveSig=false)]
    public static extern ICorDebug CreateDebuggingInterfaceFromVersion(int debuggerVersion, string debuggeeVersion);
    
    ...
    
    corDebug = CreateDebuggingInterfaceFromVersion(debuggerVersion, debuggeeVersion);
    
    managedCallbackSwitch = new ManagedCallbackSwitch(this);
    managedCallbackProxy = new ManagedCallbackProxy(this, managedCallbackSwitch);
    			
    corDebug.Initialize();
    corDebug.SetManagedHandler(managedCallbackProxy);
    


    When I execute the attach command, I call the following method from the class that represents the debugger.

    public Process Attach(System.Diagnostics.Process existingProcess)		
    {
    	string mainModule = existingProcess.MainModule.FileName;
    	InitDebugger(GetProgramVersion(mainModule)); <- this calls the above code
    	ICorDebugProcess corDebugProcess = corDebug.DebugActiveProcess((uint)existingProcess.Id, 0);
    		
    	Process process = new Process(this, corDebugProcess, Path.GetDirectoryName(mainModule));
    	this.Processes.Add(process);
    	return process;
    }
    

    The process class contains the references to corProcess, debugger, callback proxy, modules, app domains and any other information needed to break, terminate, etc.


    When I attach on .NET apps (CUI or GUI), the LoadModule method (in the callback proxy) is called (and other methods also). But when attaching to ASP.NET worker process, the callback methods (e.g. LoadModule) are not called.

    Is this helpful?


    Eusebiu
  • Tuesday, August 09, 2011 1:56 AM
    Moderator
     
     
     

    Thank you for your feedback.

     

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thank you for your understanding and support.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Saturday, September 03, 2011 2:50 PM
    Owner
     
     

    Can you give us more details on what happens? Are you getting an exception? Are you able to call any methods on corDebugProcess?

    Also, what user is the worker process running as? If it's not running as the same user as the debugger you'll need to run the debugger as administrator.

    Have you tried attaching with mdbg (again, as admin if the user is different)? Does that work?

    If you can give more details we may be able to help you further.

    Regards,
    Jon