Debugging a Silverlight project with a WCF service - visual-studio

I have a WCF service hosted in IIS which is consumed by a Silverlight client application. When I run the Silverlight application, none of the break points seem to get hit (not breakpoints in the service, although they also don't get hit. That service is not in the same solution).
Normally when I've created SL projects in the past, they hit break points by default, and I can't thing I've changed any of the settings.
When I run the project, I do get a message box saying, "The Silverlight project you are about to debug uses web services. Calls to the web service will fail unless the Silverlight project is hosted in and launched from the same web project as the web services. Do you want to debug anyway?"
So I say 'yes'.
My break point is in a place that I know gets hit (InitializeComponent in MainPage.xaml.cs), so that's not it.
I don't know if it makes a difference to the client application, but the WCF service does have within its App.config the compilation debug set to 'true'.
Can anyone help?
Edit:
Some useful points: The project is set to debug. There is no web component to the SL project. The application compiles and runs normally. The code in the screen shot below is the code behind for the main page which is the default page (and the one I see when I start the project). The Visual Studio version is 2010 Ultimate (version 10.0.40219.1 SPRel) and I am not creating an OOB application. As well as just running regularly, I have specifically started from the Debug->Start Debugging option in Visual Studio.
Screen shot:
If that image isn't clear enough, there is the full resolution one here.
Second screen shot showing a break point on the InitializeComponent in MainPage.xaml.cs which doesn't fire (the previous one showed the constructor of the related view model).
Again, if that's not clear enough, the full resolution version is here.

The message your getting is unrelated to your breakpoints not being hit. This 'warning' isn't entirely true as well, as long a the webservice you're calling is running you'll be fine. You can happily ignore this warning.
As to not hitting breakpoints, I can think of two reasons. You could be building in release mode, or you could be starting the wrong project. You should not be starting the MyApp.Web project Visual Studio probably created for you, but the actual Silverlight project.
If it isn't one of those options you should provide a bit more detail about what you're doing, like Visual Studio versions, whether you're running an out-of-browser app, does the app actually work etc. There can be a few more things to check but it hard to guess it them with this little info.

I'm not seeing a test page.htm in your solution. How are you hosting / running the SL app?
If you were hosting it in an ASP.NET web app I'd say check that the Silverlight debugger was enabled on the web project project properties.
But as it is I can't see how the silverlight app is getting run at all...?

Related

Unable to remote debug a ASP.NET 5 WebApp in Azure

I created a new ASP.NET 5 RC1 WebApp using Visual Studio 2015 and published it to Azure. I turned on remote debugging and selected VS 2015 for the debugger. I can attach to the WebApp, but any breakpoint I set is not showing up completely red. Hovering over the breakpoint gives you the message "The breakpoint will not be currently hit. No symbols have been loaded for this document." I did a bunch of searches to see if anyone else had encountered this issue. I found some articles that seemed to indicate the solution:
Remote debugging Azure website: Breakpoints not hit
Azure Website Remote Debugging with git deploy not working
I tried turning off "Just my code" and adding the app setting, but neither of these worked. I even had a colleague try the same thing from his system and his Azure account to make sure it wasn't just an environmental issue on my system. Does anyone know how to fix this?
The problem is the VS 2015 Azure tooling is not yet DNX aware at the debugger level. So for now, you'll need to manually attach the debugger, using the steps documented in this article.
Once you get the list of processes, you'll want to attach to the dnx.exe process, instead of the usual w3wp.
I just tried with a new ASP.NET RC1 app, and was able to set and hit breakpoints. It took a while to attach and load symbols, so be patient :)

Visual Studio 2013 launches the wrong MVC Application

This seems like a typical Microsoft bug. I have a project that when I click launch despite the fact that it's set as the default project is launches a skeleton MVC app as opposed to the MVC app that I'm currently working on.
To fix the problem I have to close down Visual Studio completely and relaunch my solution. I press f5 or just run the app and it works.
What I find interesting is this mysterious skeleton app which seems to be ASP.NET temporary files is the same port as my project. This happens multiple times a day while developing this particular app on the particular port. Does anybody know why Visual Studio 2013 is doing this?
Okay so this is a Microsoft bug. It turns out the project I'm working on does have identical names to another project that I was working on except in a different codeline. Visual Studio gets all confused and launches the old app in cache instead of the app I'm working on. The only way to fix this it appears it to manually change the port number for IIS Express.
For more information check this out.
https://connect.microsoft.com/VisualStudio/feedback/details/786645/vs-launches-the-wrong-mvc-website-when-two-identically-named-solutions-are-open-at-the-same-time

Difficulty debugging WCF Service in Visual Studio

I think I'm having an issue where, if I set breakpoints in a ASP Azure project, the page just freezes without letting me step around in Visual Studio 2010. I'm not sure if I have a bug, or if I'm doing something wrong.
I have a Silverlight 4 app that consumes a WCF service made available from an Azure project. If I start up VS, build, and run, everything works fine. If I set a breakpoint in the service getData() method, the browser tab becomes unresponsive. If I unset the breakpoint, it remains unresponsive until I restart visual studio.
I have the Azure project set as my web role. I am able to hit breakpoints in WebRole.cs in the ASP project, but it seems like putting a breakpoint in the .svc file messes it up.
Is this a known issue? Or could I be doing something wrong?
I don't how the Azure project might effect things but but you might want to look at:
Configuring Message Logging
Service Trace Viewer Tool (SvcTraceViewer.exe)
WCF Test Client (WcfTestClient.exe)

Question on debugging a Silverlight app in VS2008

Im trying to debug my first Silverligt 3 app. I have it linked to a web project. The problem is that if an exception occurs, I get a popup that tells me to choose a debugger, and after doing so says something like "There is already a debugger attached". Im used to WinForms where, if an exception is thrown VS breaks at that point and shows me where it is thrown. Is this type of behavior possible with Silverlight?
Yes, you should be able to debug your silverlight apps in exactly the same fashion as with winforms. Are your debugging settings correct? You should have your web application set as the startup project and make sure that silverlight debugging is enabled for the silverlight project, and asp.net debugging is enabled for the web app. Also make sure you are not building in release mode.

Debugging ASP.NET website from Visual Studio causes restart of the website

Somehow, since some time I'm experiencing problems with debugging my ASP.NET website.
Every time I try to debug the website ASP.NET shuts down (global.asax_Application_End is called).
I believe this is triggered because the site is built by Visual Studio. However, manually (re)build the site and then start debugging also restarts the site. Even debugging and ending the debugging session, clicking a couple of buttons on the site to get to the desired state, and start a debugging session again still triggers a build action, which causes the site to restart.
Since restarting resets HttpRuntime.Cache booting the site takes a long time, and sometimes I want to debug some situation that involves caching.
Now there is a setting on the website's property pages:
Start Action (F5):
Before running startup page:
No Build / Build Page / Build Web Site.
I've set it to No Build, restarted Visual Studio, but still it triggers the build action every time I hit F5 or the Start debugging button...
Anyone any ideas as to how to resolve this??
Thanks,
Jaap
We've solved this by converting our project to a Web Application instead of a Web Site. This had some impact on our architecture since we had some classes in app_code which we needed to use reflection on during site startup.
It turns out that the Web application in combination with "Use Custom Web Server" fixed out issue!

Resources