Silverlight update KB982926 failure and solution

by APIJunkie 4. June 2010 23:29

I was doing the rounds and updating 2 machines, running XP Pro and 2003 Server, with Silverlight 3 run time pre installed on them. When the update was complete I couldn’t view any Silverlight based web sites with IE 8 on both machines.

 

I would only receive an install Silverlight message. It was as if Silverlight was not installed on the machines any more.

 

A quick check in the IE installed component list (Tools/Internet Options/Programs/Manage add-ons/Show all add-ons) showed me I was automatically upgraded to Silverlight 4 (Version 4.0.50524.0) which seems fine.

 

To solve the problem I did the following:

 

1. Went to http://www.microsoft.com/silverlight/.

 

2. Pressed the install Silverlight button which crashed the installer (on npctrl.dll).

 

3. Restarted the browser at which point I got a message telling me I need to restart the browser again.

 

4. Restarted the browser for the second time which made Silverlight runtime and IE happy and willing to play together again.

Tags:

KB | Silverlight | Troubleshoot

Using the free Babel Obfuscator in Silverlight projects

by APIJunkie 4. February 2010 05:24

One of the problems with Silverlight managed code is that it can easily be reverse engineered using standard .NET reflection tools.

Although no method can completely prevent reverse engineering your code there are ways to slow down and even deter all but the most persistent hackers.

Most of the tools I found that can be used to obfuscate Silverlight code are not free. But the Babel obfuscator by Alberto Ferrazzoli is an open source .NET obfuscator that can be used in Silverlight based projects.

Babel is a command line tool and it can be integrated into your build process. One way to do that is to add it to your post build events.

When you run babel on a target dll (assembly) it will generate an obfuscated version of the dll in the directory “.\BabelOut” relative to your dll output directory.

Usage Example:

"D:\Program Files \Babel\babel.exe" $(TargetPath) --noildasm --nomsil --noinvalidopcodes

Some caveats that apply to current babel version 2.0.0.1:

1.       The current version does not support obfuscating xap files directly but you can unzip the files first or integrate the babel tool into your build process.

 

2.       Not all command line parameters/options are supported in Silverlight projects. The following options work:

       --noildasm --nomsil –noinvalidopcodes

 

3.       Some assemblies (dll’s) that contain resources do not seem to obfuscate correctly (Its very easily detected they are not usable after obfuscation). If you have this problem you can always move all the sensitive code into a separate Silverlight code library and obfuscate only the code library.

Example:

Let’s assume you have one monolithic project called: “MySilverlightApp” that contains all the code and resources (xaml, images etc.) that will not obfuscate. To solve the problem:

1.       Add a new project to the solution called “MySilverlightAppCode” of type “Silverlight Class Library”.

2.       Add a reference to the new Silverlight library from the “MySilverlightApp” project.

3.       Move all the sensitive code files into the new Silverlight code library (“MySilverlightAppCode”).

4.       Obfuscate only the “MySilverlightAppCode” assembly (MySilverlightAppCode.dll).

 

Tags:

Silverlight | How To

3XH Silverlight high score and in game achievement API is now available to developers

by APIJunkie 27. November 2009 09:19

As we mentioned before we have been busy working on our new Silverlight in-game event system, code name 3XH. You can see it in action on our featured games section on Mashooo.com. The system allows Silverlight game developers to work with high scores and user achievements without the hassle of building and maintaining the framework and the system to support them. The system was in closed beta testing until now. We were working with a limited number of developers (Jeff Weber, David Lévesque, Daniel James and Ian Tomlinson) to fine tune the system.  We are happy to announce that as of today we are opening the 3XH developers program and the services it includes. All Silverlight game developers can now start using our new Silverlight high score and in game achievement system (3XH).

3XH highlights include:

1.       Flexible system to store/retrieve high scores, achievements and other game events.

2.       Ability to use the system on any web site.

3.       Multi login support (Facebook, OpenID, AOL, Yahoo, Google and more to come.)

4.       Current player information.

5.       Integrated Reward system to reward users for their game achievements.

6.       Managed prize bearing contests.

7.       100% Silverlight from the ground up and much more.

To participate in the program or to find out more information read the 3XH developers manual.

Tags: ,

Silverlight | Games

Mashooo S Prize Silverlight Game Contest Rating Period

by APIJunkie 16. June 2009 00:06

My hat is off to the Silverlight game developers community.

Who would have believed the quality and quantity of Silverlight games produced by this growing, vibrant and amazing community of Silverlight game developers.

If anyone had any doubts about the future of Silverlight game development those doubts will immediately be put to rest once they see what have been achieved in this contest.

The contest is now in the community rating period until Sunday, Jun 21'st. The winners will get some great prizes but they first have to qualify by reaching the top ten community favorites list.

So if you have a few minutes to spare come play the games and rate the S Prize game submissions.

Good luck to all the contestants!

-JB

Tags: ,

Silverlight | Games

How to add Silverlight version detection to Google Analytics

by APIJunkie 15. May 2009 06:35

One of the things that are currently missing from Google Analytics is Silverlight detection. Normally this type of information would appear under the browser capabilities section, the same section that lists Flash and Java versions. While I'm sure this will change eventually, it is something that can be very useful to web sites hosting Silverlight applications today.

In order to bridge this detection hole here is a simple solution that would plug this information into Google analytics.

The solution is based on 2 things:

1. Custom visitor segments  - Google Analytics allows us to create user defined values that can be stored and reported upon.

2. Silverlight JavaScript detection code - Code that allows you to detect the installed Silverlight version on the client's browser.

Awhile back I showed how to detect/report the current Silverlight version in JavaScript. Combining this code with Google analytics code to report user defined values is fairly simple. The following code is a rough example that would do the trick:

////////////////////////////////////////////////////

// Google analytics include files

////////////////////////////////////////////////////

<script type="text/javascript">

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

</script>

////////////////////////////////////////////////////

// Report Silverlight version to Google analytics

////////////////////////////////////////////////////

<script type="text/javascript">

var pageTracker = _gat._getTracker("UA-xxxxx-x");

pageTracker._setVar('SLVersion ' + getSilverlightVersion() );

</script>

////////////////////////////////////////////////////

Notes:

1. Remember to replace UA-xxxxx-x with your Google analytics code in the code example.

2. The information you report to Google analytics will appear under user defined values in the visitors section.

3. You can use Advanced Segments to integrate your user defined values into other reports.

4. There is normally a time delay in Google analytics reporting so it might take a few hours before you start to see the effects of your new code.

Good Luck!

Tags:

Silverlight | How To | Google | Analytics

Mashooo S Prize Silverlight Game Contest Update

by APIJunkie 26. April 2009 22:40

Wow it's been an amazing month. The contest has just begun and there are already 15 game submissions to the Mashooo S Prize. To top it all the quality bar for Silverlight games just keeps on rising. Silverlight games are really starting to look like the wave of the future when it comes to casual web games.

I can't wait to see what new games the talented Silverlight developer community is going to come up with next.

You can checkout the latest Silverlight game submission list here and don't forget to comment and rate your favorite games.

-JB

 

Tags:

Silverlight | Games

How to programmatically detect Silverlight version

by APIJunkie 24. April 2009 23:39

Two questions that often arise when building Silverlight based websites are:

  A. How do I detect if Silverlight is installed on a visitor's browser?

  B. How do I detect what version of Silverlight is installed on a visitor's browser?

The answer to A is relatively simple since Silverlight.js (the standard Silverlight javaScript include file) contains a function that we can use. The function is called isInstalled and it returns true/false. You can use it the following way to detect if there is any Silverlight version installed:

<script src="Silverlight.js" type="text/javascript"></script>

var isSLInstalled = Silverlight.isInstalled(null)

The answer to B is a little more complex since for some reason there is no direct way to get Silverlight's version number. Basically the only documented way to answer this question is to repeatedly call isInstalled with different version numbers until you get the right version.

Example:

Silverlight.isInstalled('3.0')

Silverlight.isInstalled('2.0')

Silverlight.isInstalled('1.0')

etc.

Every time we call isInstalled the function code goes through the same process of trying to create an ActiveX/Plugin object etc. In some parts of the programming world this kind of inefficiency would be labeled as border line heresy. But luckily Since we are normally only interested in Silverlight's major version we can do things a little more efficiently. The function below will only return 0,1,2,3 where 0 stands for no version and 1 to 3 stand for a Silverlight major version.*

//////////////////////////////////////////////////////////////////

// get major Silverlight version

// Return values:

// 0 -> Silverlight not installed (at least not properly).

// 1 -> Silverlight 1 installed

// 2-> Silverlight 2 installed

// 2-> Silverlight 3 installed

//////////////////////////////////////////////////////////////////

getSilverlightVersion = function() {

var SLVersion;

try {  

       try {

            var control = new ActiveXObject('AgControl.AgControl');

            if (control.IsVersionSupported("3.0"))                

               SLVersion = 3;

            else

            if (control.IsVersionSupported("2.0"))               

               SLVersion = 2;

            else

               SLVersion = 1;           

            control = null;

      }

      catch (e) {      

                     var plugin = navigator.plugins["Silverlight Plug-In"];

                     if (plugin)

                     {         

                       if (plugin.description === "1.0.30226.2")             

                          SLVersion = 2;

                       else

                          SLVersion = parseInt(plugin.description[0]);

                      }

                      else

                         SLVersion = 0;

      }

}

catch (e) { 

      SLVersion = 0;

}

return SLVersion;

}

-------------

* Note that this code will break with future versions of Silverlight/silverlight.js so it needs to be rechecked when a new version is released.

 

Tags:

Silverlight | How To

Fix for invalid XAML error - the member is not recognized or accessible when using ControlTemplate

by APIJunkie 16. December 2008 05:26

I've recently encountered an error that only appears when working on XAML in blend and not when working on XAML in VS.

Blend is apparently more sensitive then Visual studio 2008 when it comes to type checking templates.

If you forget to set the TargetType in a ControlTemplate and access certain properties in the content presenter, Blend will report an error and you will not be able to edit the XAML in design mode.

Note that this error only effects design mode in blend, the XAML still compiles and works perfectly (assuming we apply the template to the correct type).

Example:

Ok on blend, ok on VS 2008 ->

<ControlTemplate x:Key="MyXTemplate" TargetType="MyClassType">

Invalid XAML error on blend, ok on VS 2008 ->

<ControlTemplate x:Key="MyXTemplate">

For the error to appear you will also have to access non globally shared properties in the content presenter.

In the example below we try to set a content property which is not guaranteed to exist in the type we apply the template to.

Example:

<ContentPresenter Content="{TemplateBinding Content}" />

 

Tags:

Silverlight | PRB | Troubleshoot | Blend

A new Silverlight framework for creating managed code splash screens, pre loaders and loader projects

by APIJunkie 7. November 2008 10:54

We released a new open source project called Silverlight loader on CodePlex today.

The project is basically a simple and light framework aimed at taking the pain out of writing splash screens, pre-loaders and loaders.

To find out more info check out the Silverlight loader getting started guide and how the Silverlight loader works.

Thanks to Silverlight Girl's talent you can view an artistic demo here.

Hope you find it useful.

  JB

Tags:

Silverlight | news

A new forum dedicated to Silverlight game development and design

by APIJunkie 27. October 2008 07:21

As some of you may know, a couple of months ago Silverlight Girl decided to create a centralized place where people can display their Silverlight game creations. The great community reaction encouraged us to continue and maintain the site.

Over the past few months we have received many game submissions and supportive emails. Some of you have been suggesting we offer a place where people can exchange ideas about Silverlight game design and development. Last but not least was Daniel Gimenez the author of the now famous Vector Space Zer0.

Fast forward a couple of weeks of work on our spare time and thanks to the YAF project, the Silverlight game forums are now live.

We hope you will find them helpful and feel free to post any comments and suggestions you may have.

JB

 

Tags:

Silverlight | Games | news

About the author

Name of author

I was first wounded by x86 assembly, recovered and moved on to C. Following a long addiction to C++ and a short stint at rehab I decided to switch to a healthier addiction so I am now happily sniffing .NET and getting hooked on Silverlight.

I am mainly here to ramble about coding, various API’s, Junkies(me especially) and everything else that happens between coders and their significant other.

  James Bacon