C# – Debugging c# silverlight projects from vb web application

cinteropsilverlightvb.net

I have a problem whereby I cannot debug a c# silverlight application project that is hosted from within a visual basic web application. I add breakpoints to the main App constructor and the symbols are loaded ok but my breakpoints are never hit. I have concluded that it is a vb/c# interop problem as to test i did the following.

  1. Created a new c# web application project
  2. Added a c# silverlight application
  3. Added a new vb web application project
  4. Added references to the silverlight project from both web apps
  5. set a breakpoint in App.xaml.cs constructor

if i run the c# webapp the break points are hit whereas if i run the vb webapp they are not.
has anyone come across this before or can anyone suggest a solution please?
Many Thanks

Best Answer

You need to make sure that your debug type is "Silverlight" not "Managed" or "Script". The problem is that VS is not seeing the VB web application as the test host for the Silverlight project.

Create the VB Application first, then when you add the Silverlight choose the VB application as the test host for the Silverlight application. Now when you run the solution with the VB application as the start up application VS will attach to the browser using the "Silverlight" type for debugging.

Alternatively you can edit the debuggers used by the VB Application. Open the project properties and select the Start options, check the Silverlight box in the Debuggers section.