locked
How to debug a dynamically loaded assembly RRS feed

  • Question

  • I am writing a Silverlight assembly that is dynamically loaded by a website which is out of my control. It appears that I cannot set breakpoint within my DLL code. Please help me if some body knows the solution. I have read a few thread on this site and tried a few solutions, but still cannot get it to work.

    I am using VS2008. The assembly is coded in C#. The project is created as a Silverlight(3) Class Library(DLL) and placed in a Visual Studio solution containing the DLL only. On the property page of the DLL project, I do not see the normal "debug" settings where you can specify the startup program, such as, "Start Browser with URL: http://localhost:7100/".

    On the [Debug] menu, both "Start debugging" and "Start without debugging" are grayed. The only option is to start the web site manually. Then "Attach to process..." and select IEXPLORER.exe with type "Script, Silverlight, x86". But when I set a breakpoint, it is always grayed. When I check the "Modules" tab, my DLL file does not appear in the list. All modules that do list there have no symbols loaded.

    My DLL file together with the PDB file are output and placed in the "ClientBin" folder alongside the main XAP file that dynamically loads my assembly.

    I hope I have provided enough information and looking forward to a solution. Thanks in advance for any help.

     

    Thursday, October 7, 2010 6:30 AM

Answers

  • Hi,

    As far as I know you cannot debug a dynamically loaded assembly.

    Maybe you can try to add some output like alert in assembly to monitor the value of certain parameter.

     

    Best Regards,

    Wednesday, October 13, 2010 4:43 AM
  • Thanks to all replied and viewed. After some discussion with my XAP application supplier, I now got a solution and a simple solution. Basically, I just add the web site to my solution as an existing "Web Site" project. That means, my solution contains both the main web site and my Silverlight Assembly project. Of course, I need to enable "Silverlight Debugging" in the "Web Site" project.

    Tuesday, October 19, 2010 4:29 AM

All replies

  •  

    Goto the project properties and check if Silverlight Debuging is enabled or not... if it is enabled then once delete the .xap from ClientBin folder and compile the project again...

     

     

    Thursday, October 7, 2010 6:49 AM
  • Thanks for the reply.

    The option "Silverlight Debugging" is only available if the project is a Silverlight Web Site. As I have mentioned, I cannot even see the Debug tab on the Project Property page, let alone enabling "Silverlight Debugging" or "ASP.NET Debugging".

    Thursday, October 7, 2010 7:38 AM
  • Hi,

    As far as I know you cannot debug a dynamically loaded assembly.

    Maybe you can try to add some output like alert in assembly to monitor the value of certain parameter.

     

    Best Regards,

    Wednesday, October 13, 2010 4:43 AM
  • I am not exactly sure what your scenerio is but i can tell you how i debug mine. We have a Silverlight application that is composed of many xap files that get loaded dynamically when they are requested by the application. First thing i do is go to the starting page of our Application just using the normal browser. Next i attach the debugger to the the silverlight process. I then go add break points in the code i want to debug. Most likely these break points will be greyed out because the xap file is not loaded yet. Finally i do whatever it takes in the application to cause the xap file to load. At that point the break points become red and i break into my debugger and can do normal debugging. If this fails to happen it generally means i forgot to load the newest xap files to the server so the pdb files don't match.

    Hope that helps.

     

    Friday, October 15, 2010 6:56 AM
  • Thanks to all replied and viewed. After some discussion with my XAP application supplier, I now got a solution and a simple solution. Basically, I just add the web site to my solution as an existing "Web Site" project. That means, my solution contains both the main web site and my Silverlight Assembly project. Of course, I need to enable "Silverlight Debugging" in the "Web Site" project.

    Tuesday, October 19, 2010 4:29 AM