Category Archives: silverlight

Quick code performance test for Flash vs Silverlight

Quick performance test for Flash vs Silverlight. This just counts prime numbers and doesn’t touch graphics or multimedia. See Bubblemark and GUIMark for some more comprehensive tests; I just put this one together to satisfy my own curiosity. More details, and the code to scrutinize, here.

Please don’t take this too seriously. I may have messed up the test; it is only one small aspect of performance; and there are lots of other factors to think about. I just find this sort of thing interesting.

Update: Note that both Flash and Silverlight have just-in-time compilers that dramatically speed this type of code.

Comments are welcome here.

Technorati tags: , ,

Silverlight developer reference poster shows off DeepZoom

The developer reference poster here shows off DeepZoom as well as providing a handy guide to what is in Silverlight 2.0. Thanks to Joe Stegman.

Tip: use the mouse scroll wheel to zoom in and out; click and drag to move round the poster.

What if you have no scroll wheel? I tried this on a Mac. You can actually single or double-click to zoom in. To zoom out without the scroll wheel … errrmm – you refresh the page. I can’t figure out an alternative.

One of the things I dislike about many Flash and Silverlight apps is the lack of a context menu on right-click. That is, you get a context menu, but it is for configuring the player. This is a case in point: it needs Zoom in and Zoom out on a right-click menu. And keyboard shortcuts. The problem isn’t inherent to DeepZoom, but needs a bit of extra work in the application code.

Technorati tags: , , ,

Expression Blend 2.5 problems with Silverlight 2.0 Beta 2

I hit a worrying error in Expression Blend 2.5 June 2008 preview. In search of a good screenshot, I opened the new Clock sample, and got this result:

The same XAML compiles and runs fine in Visual Studio 2008 with the latest Silverlight 2.0 Beta 2 tools.

Note that if Expression can’t render the XAML, none of its design tools can be used at all.

So what is going on here? Don’t Expression Blend and Visual Studio share the same parser? This kind of problem would soon torpedo any notion of designers and developers working seamlessly on the same code.

I got my screenshot by temporarily modifying the offending code.

Fixing a Silverlight 2.0 WCF reference in a VB application

Another in my recent series on getting Silverlight 2.0 beta 2 working.

If you create a WCF web service for Silverlight, it’s well known that on the server side you have to change the binding to basicHttpBinding (or use the new Silverlight-enabled WCF service). Then you can use the Add Reference wizard in your Silverlight application and code against the generated ServiceClient.

This works in C#, but in VB you may hit this error at runtime:

The error is “Could not find endpoint element” etc, and it refers to your “client configuration section”.

I fixed this by comparing the ServiceReferences.ClientConfig file generated in a VB project with that for a C# project. Check the Contract attribute of the endpoint element. It should be qualified with the full namespace, by default the name of your app. In this example, it would be:

contract="RegSilverlightDemoApp.RegService.IRegService"

However, the VB wizard omits the first part of the namespace; then at runtime, it can’t find the service.

Evidence, perhaps, that C# is the language of choice in Microsoft’s developer division.

More Silverlight, Visual Studio setup hassles

I thought I’d fixed my Silverlight 2 Beta 2 installation; but I had not.

I ran into the issues described here, specifically:

  1. Error “Object reference not set to an instance of an object” when adding a WCF service
  2. Silverlight app cannot see WCF services in same solution
  3. Error “Unable to find ‘DynamicTypeService’” when clicking the Advanced button in the Add Service Reference dialog.
  4. Visual Studio crashing on exit

Here’s what fixed it for me. First, I attempted to debug Visual Studio while adding a WCF service and spotted an exception related to version control. I discovered that Visual Studio was set to use Team Foundation Server as the Source Control plug-in, even though my Team Foundation Server is offline. I don’t know if the Silverlight install somehow reset this, as I thought I’d set it to None in Tools – Options – Source Control – Plug-in Selector; but I changed it back to None and that fixed the Object Reference error.

Unfortunately it did not fix the second problem. Following a tip in the thread mentioned above, I moved the file:

\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Microsoft.VisualStudio.ServicesProxy.dll

Then I uninstalled Microsoft Silverlight Tools Beta 2 for Visual Studio 2008. Then I reinstalled it (no reboot). Everything works.

The Microsoft.VisualStudio.ServicesProxy.dll is replaced with a new version.

An indicator of this problem is the size of your Silverlight Tools install in Control Panel – Programs and Features. If it is 1.14MB you may have the problem. If it is 1.17 or 1.18MB you probably do not have the problem. The size of my install increased from 1.14MB to 1.17MB on reinstall. A theory is that if the Silverlight Tools installer sees the ServicesProxy.dll, it doesn’t install some other stuff that in fact it should install.

Upgrading to Silverlight 2.0 Beta 2? Proceed with care

I dived straight into the Silverlight 2.0 Beta 2 download, and soon hit this dialog:

I discovered that I should have read this guide to installation by Microsoft’s Bradley Bartz. It is a little arduous: remove KB949325 (which requires the Visual Studio installation media) as well as any previous Silverlight SDK and tools, apply Visual Studio 2008 SP1 Beta if you have not yet done so, then install Silverlight. Otherwise you may get an error relating to silverlight_uninstallrtmpatches.exe as I did.

I’m grateful to BradleyB. I admit, the issue is also noted on the download page:

If you have previously installed Silverlight Tools Beta 1, you must uninstall KB949325 before installing Visual Studio 2008 SP1 Beta.

I should have read it more carefully.

Update

In my case, it was worse than that. I could not find KB949325 in the list of installed programs, but the Visual Studio SP1 Beta install still failed. I found this post by Heath Stewart. I had to follow the manual steps with reg.exe; the utility did not work for me. I also found that KB945140, which is the SP1 Beta, was actually listed as installed in Programs in Control Panel, but only for the Visual Studio 2008 Shell (Integrated mode). I removed that too. Eventually, SP1 Beta installed successfully, following which the Silverlight SDK and Blend 2.5 installed without further issue.

Stewart has not responded to Will Dean’s comment on his post:

It sometimes feels that VS + .NET FX are in a death-spiral of an ever-increasing prevalence of this sort of issue.   

For more evidence, see Aaron Stebner’s worrying posts about problems with the installation of .NET Framework 3.5 Client Profile. Apparently this beta, once installed, makes it hard to install other versions of .NET or applications which depend on them; and uninstall is a multi-step process that has to be done in a certain order.

The only positive thought I can muster from all these complications is that this is the kind of issue that running apps in the browser avoids, at least for users rather than developers. That assumes that the install for the Silverlight runtime is bulletproof; I’ve been impressed with it so far, though I’ve heard of some users having problems. The Flash runtime isn’t immune either; I’ve had issues installing the latest security update and resorted to Adobe’s Flash uninstaller.

Missing from Bill Gates Tech Ed keynote: Live Mesh

I watched the video of Bill Gates keynote at Tech Ed yesterday. You can also read the transcript.

I enjoyed the second half more than the first. Gates can rarely resist giving a potted history of computing in his keynotes – maybe because of his own role in that history – but I find it a snooze. It also tends to reinforce the impression that Microsoft is yesterday’s company.

Gates shaped his keynote, which was on the subject of application development, around four themes:  Presentation, Business Logic, Data Access and Web Services. In presentation we got a plug for WPF and Silverlight – more the latter, with a nice demo by Soma Somasegar but nothing we haven’t seen before from Mix08 and the like.

On the business logic theme, we got a demo of a new tool called the Architecture Explorer, said by Brian Harry to be part of the Oslo wave. Microsoft will be pushing Oslo strongly at PDC later this year. Separately, I noticed that the Microsoft’s software factories guy, Jack Greenfield, has recently posted about how his team has moved from Visual Studio Team Architect to Developer and Platform Evangelism. Now I may be wrong here; but my guess is that Microsoft had a huge internal debate about whether to bet on software factories or modelling as the next step in enterprise application development, and that software factories is being sidelined in favour of Oslo. Hence statements like this:

Visual Studio Team Architect team remains actively committed to supporting Software Factories, as do the rest of Visual Studio Team System, the Visual Studio Ecosystem team and patterns & practices.

Phrases like “actively committed” usually mean the opposite of what they say. We’ll see; but note that we got Oslo in the Gates keynote, not factories.

Then we got data access, with Dave Campbell on SQL Server Data Services and the Sync framework. I think this is cool stuff; but having seen it at Mix (where I talked to Campbell and liked what he had to say) it was not new to me.

Finally,  web services. This is where Gates talks about Live Mesh, right? Wrong. Gates gave a nod to cloud computing as the future:

I can run Exchange on premise, or I can connect up to it as a service. But even at the BizTalk level, we’ll have BizTalk Services. For SQL, we’ll have SQL Server Data Services, and so you can connect up, build the database. It will be hosted in our cloud with the big, big data center, and geo-distributed automatically.

but that was it, it was on to fun robotics. I found this a surprising omission. As I see it, Mesh + Silverlight (plus of course things like SSDS) forms Microsoft’s cloud computing development platform. However, I imagine that like modelling vs software factories this is a matter of debate within the company as well as outside; perhaps we are seeing the Gates view vs the Ozzie view here.

By the way, I got my official Mesh sign-up invite this morning and I have the impression anyone can sign up now; why not try it?

Tech Ed news: Silverlight 2.0 goes live, more Oslo hype

I’m not at Tech Ed in Orlando, but was ready to watch the Bill Gates keynote which this web site tells me starts at 8.30am Eastern – trouble is, that was 45 minutes ago, and the webcast still just plays a pretty tune and then stops. Not a great way to showcase Silverlight live streaming.

Fortunately the press release has gone up. Gates has announced Silverlight 2 beta 2 (this is the one with .NET runtime included), complete with a Go Live license. Microsoft has also released Expression Blend 2.5 June 2008 Preview and Microsoft Silverlight Tools beta 2 for Visual Studio 2008, so we should be all set to code and go.

Other highlights: IE 8 Beta 2 in August, new preview code of project “Velocity” for caching high-scale apps, and more hype for Oslo, Microsoft’s “unified modeling platform”:

Oslo will include visual modeling and composition tools, a foundational repository built on SQL Server 2008 for managing application metadata, and a new, declarative modeling language to enable interoperability of models between tools and domain-specific modeling notations.

I don’t doubt that Microsoft is serious about Oslo; others at Microsoft has confirmed that this is a major initiative. However, I am naturally sceptical about whether Oslo will achieve its goals. Most other grand model-driven development products have failed; why will this be different?

What’s coming in Windows? Check the PDC 2008 agenda

Microsoft’s Professional Developer’s Conference is traditionally where it shows developers its forward plans. Sometimes these do not work out as expected. Notorious examples include Hailstorm web services, and pre-reset Vista, in which Windows Presentation Foundation was more at the core, and which included the WinFS smart file system.

It follows that the just published session list for the PDC should not be treated as an infallible guide to the future. Still, there are interesting snippets here:

  • .NET and ASP.NET for Windows Server Core
  • Silverlight for Mobile devices
  • Touch computing in Windows 7
  • A “new networking API with support for building SOAP based web services in native code”
  • and of course the Live Mesh developer platform