Quantcast
Channel: Jeff On Games » Orbus - Jeff On Games
Viewing all articles
Browse latest Browse all 10

Firefox, Silverlight, Services and ASP.NET Debugging

$
0
0

Edit: If you've been having problems with this, it's because I accidentally missed a step. Firefox will always look for an old process regardless of whether you want to start as a separate profile. To fix this, you need to add the MOZ_NO_REMOTE environment variable with a value of 1. Note: This will make it so you can't click FireFox again to open a new window. You'll have to use File->New Window instead. This whole problem kinda sucks, but at least there's a way around it.

Edit 2: That fix also doesn't work. It won't allow you to browse "as normal" since running the program with the same profile causes it to error out. It doesn't really matter though since the recently released, Orcas Beta 2 broke this fix entirely. For some reason starting an external program to the location doesn't have the Silverlight debugging system attach correctly, which just ruins everything. So, you're pretty much stuck closing down FireFox entirely if you want to debug Silverlight

So this one is really interesting, and took me quite a bit of time to figure out. We’re currently working on trying to do some interesting visualizations of our data using Microsoft’s new Silverlight platform, and, despite some initial problems with setting up the service, it looked like we had everything figured out. Except there were still some debugging problems.

Basically, after an initial success, whenever we tried to debugging, the debugger would attempt to start then immediately exit with no error other than

The program '[x] WebDev.WebServer.EXE: Managed' has exited with code 0 (0x0).

The page would load in Firefox (on a new tab) but none of the changes to our Silverlight components were actually taking effect.

As near as I can figure out, here’s what’s happening: When debugging Silverlight, Orcas attaches to both your web browser and WebDev.WebServer.Exe. However, if Firefox was already open and had the Silverlight .dll loaded (which is common if you open all new links in a new tab), the Orcas debugger was unable to push the new copy of the dll to the cache for Firefox to use. As a result, Orcas immediately shuts down with the incredibly cryptic "error" message. Firefox, meanwhile, happily uses a cached version and you are left frustrated.

So, how do you fix it and still be able to browse your web pages normally? The simple solution is to have Firefox start in a separate process and in a separate, non-default user space. Here’s the steps:

  1. Start Firefox’s profile manager with:

    Firefox.exe –ProfileManager

    You will be greeted with the following screen:
    Firefox Profile Manager

  2. Add a new profile. As you can see, I chose the name “Testing User.” Setting everything else to default is fine.
  3. Change the start up options for your website to execute Firefox with the new user profile. (See screen below). This will start Firefox in the separate user profile in a different process space that will close when you stop debugging.
    The Start Options for an ASP.NET web page
    The values are:
    Start External Program: [Firefox path]\firefox.exe
    Command line arguments: -P “Testing User” http://localhost: [port]/WebSite/Page.aspx
    Working Directory: [Firefox path]
    

    (Note: If anyone knows how to get the virtual path for the command line arguments, I’d appreciate knowing)

And that’s it! You should now be able to run Firefox normally and debug your Silverlight applications without problem.


Viewing all articles
Browse latest Browse all 10

Trending Articles