Feed Icon  

Contact

  • Bryant Likes
  • Send mail to the author(s) E-mail
  • twitter
  • View Bryant Likes's profile on LinkedIn
  • del.icio.us
Get Microsoft Silverlight
by clicking "Install Microsoft Silverlight" you accept the
Silverlight license agreement

Hosting By

Hot Topics

Tags

Open Source Projects

Archives

Ads

Page 1 of 1 in the VisualStudio category(RSS)

Debugging a Remotely Hosted Silverlight App

Posted in Silverlight | Visual Studio at Tuesday, March 10, 2009 3:32 AM Pacific Standard Time

This question has come up in the forums a few times so I thought it would be worth a blog post. Most people are pretty familiar with debugging a Silverlight application running locally during development, but what people many times don’t realize is that you can also attach your debugger to a xap file that is hosted remotely. This MSDN article touches on this briefly, but doesn’t really go into details on how it works.

The important thing to understand about Silverlight is that it runs the .NET code on the client machine, not on the server. The code runs in the browser process, so if you’re going to debug it you need to attach to that process. The one caveat is that the xap on the server must be the same as the compiled xap on your development machine. In other words, you can’t debug the remote xap after you’ve made changes locally and haven’t deployed them.

As an example I will demonstrate remotely debugging the Twilight badge on my blog.

First I open the Twilight.sln and since I’ve made a few changes in the last week I’ll deploy the latest xap file from my project to my server at http://blogs.sqlxml.org/wpfe/twilight.xap.

Next, now that I am sure the xap file on the server has the same code as my solution, I can set a breakpoint on Line 36 (using version 1.5.2) where the Twitter javascript callback calls into Silverlight with the latest list of tweets:

image 

Now instead of hitting F5 to start debugging my application, I’ll open a new instance of Internet Explorer (or you could use Firefox to debug that as well) and navigate to my blog since that is where the xap shows up. Back in Visual Studio I click Debug –> Attach to Process and select the iexplore.exe process which is Internet Explorer (or firefox.exe if you’re debugging Firefox).

NOTE: Make sure you click highlight iexplore.exe or firefox.exe and then click the Select button and choose Silverlight as the type of code you wish to debug.

image

 

 

Once I click attach I can go back to my Internet Explorer window and hit refresh to force the breakpoint to get hit. If everything was setup correctly you should get taken back to Visual Studio where your breakpoint is highlighted and you can now step through your Silverlight code.

image

So why is this useful? Well a lot can change in your application when you start hosting it on a real server instead of in your localhost. For one, you now have to access services running on the server and you are subject to a lot more security checks that were ignored on your localhost. So I find this to be a useful tool for troubleshooting things when they work locally but break once I deploy out to a server.

One last thing, you can also set this up to remotely debug code running on the Mac.

Font Smoothing for Windows Server 2003 RDP

Posted in General | .NET | Visual Studio at Wednesday, July 09, 2008 6:59 AM Pacific Daylight Time

A few days ago Peter Provost blogged about Brad Wilson's Dark Visual Studio color scheme. I decided to try it out (again) since I felt like I needed a little change in my coding environment. For my current project we are using Windows Server 2003 for our virtual machines and I'm using Hyper-V to run them. One of the things I like to do with my Hyper-V machines is RDP into them since that gives me better clipboard support and I can connect my local drives to the machine and access them easily.

The problem is that Brad's color scheme uses the Consolas font which doesn't render very nicely if you don't have clear type font smoothing. Well after a little digging around I found out that Microsoft just recently released a hotfix to enable font-smoothing in RDP on Windows Server 2003. So I gave the hotfix a try and as long as you check the "enable font-smoothing" checkbox in the RDP connection it works perfectly.

Before the hotfix:

unsmooth

After the hotfix:

smooth

Much better on the eyes. And I think I like the dark color scheme. I'll give it a few days and see how it goes.

Page 1 of 1 in the VisualStudio category(RSS)