RSS Feed Feed your read!

Bookmark and Share







Tag Cloud

ASP.NET Generic, Best Practices, Business Intelligence, Freeware Releases, InfoPath, Infrastructure, jQuery, Lunch & Learn Events, Project Server, Random, Reporting Services, Search, SharePoint Administration, SharePoint Business Analysis and Project Management, SharePoint Development, Silverlight, Social Networking, Speaking Events, White Paper Releases, Workflow Foundation,

Archives

June 2007 (3)
August 2007 (1)
November 2007 (2)
February 2008 (2)
April 2008 (5)
May 2008 (7)
June 2008 (8)
July 2008 (7)
August 2008 (3)
September 2008 (7)
October 2008 (1)
November 2008 (3)
December 2008 (3)
January 2009 (7)
February 2009 (5)
March 2009 (10)
April 2009 (2)
May 2009 (6)
June 2009 (3)
July 2009 (4)
August 2009 (6)
September 2009 (3)
October 2009 (9)
November 2009 (10)
December 2009 (1)
January 2010 (1)
February 2010 (3)
March 2010 (6)
April 2010 (2)
May 2010 (3)
June 2010 (4)
July 2010 (3)

Upgrade Silverlight 2 beta 1 to beta 2 

Tags: ASP.NET Generic

As you may have heard, Silverlight 2 beta 2 came out. This post for me is necessary because I wrote a two part series on getting a Silverlight application to work in SharePoint, and since beta 2 came out, a few things need to be updated in that walkthrough of mine. Before I get started, MSDN has a nice article on all the main things that changed that could cause your applications to break – it's a laundry list so prepare for a heavy read.

 

Here's my laundry list of updates to my steps:

 

STEP 1:    You need to install the beta 2 extensions for visual studio, not beta 1 as I mentioned in Step 1. After you install it, just load your beta 1 project and it will prompt you to upgrade it. After it is upgraded, rebuild and redeploy the XAP file and now your application is beta 2. But there's a few more things to note…

 

STEP 4:    If you installed your Silverlight application like how I did, you just inputted the necessary HTML into a content editor web part. That HTML needs to be updated. The red highlighted text notes the updates from what was noted in step 4 of my 10 steps:

<div id="container">

        <div id="header">

            <div id='errorLocation' style="font-size: small;color: Gray;"></div>

 

<div id="silverlightControlHost">

        <object data="data:application/x-silverlight," type="application/x-silverlight-2-b2" width="100%" height="200px">

            <param name="source" value="/clientbin/SilverlightApplication1.xap"/>

            <param name="onerror" value="onSilverlightError" />

            <param name="background" value="white" />

            

            <a href="http://go.microsoft.com/fwlink/?LinkID=115261" style="text-decoration: none;">

            <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>

            </a>

        </object>

        <iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>

</div>

 

 

STEP 9:    Lastly, the error handling code also needs to be updated to be as follows:

<script type="text/javascript">

function onSilverlightError(sender, args) {

var appSource = "";

if (sender != null && sender != 0) {

appSource = sender.getHost().Source;

}

var errorType = args.ErrorType;

var iErrorCode = args.ErrorCode;

 

var errMsg = "Unhandled Error in Silverlight 2 Application " + appSource + "\n" ;

 

errMsg += "Code: "+ iErrorCode + " \n";

errMsg += "Category: " + errorType + " \n";

errMsg += "Message: " + args.ErrorMessage + " \n";

 

if (errorType == "ParserError")

{

errMsg += "File: " + args.xamlFile + " \n";

errMsg += "Line: " + args.lineNumber + " \n";

errMsg += "Position: " + args.charPosition + " \n";

}

else if (errorType == "RuntimeError")

{

if (args.lineNumber != 0)

{

errMsg += "Line: " + args.lineNumber + " \n";

errMsg += "Position: " + args.charPosition + " \n";

}

errMsg += "MethodName: " + args.methodName + " \n";

}

 

throw new Error(errMsg);

}

</script>

 

That's all that needs to be updated to get our simple little Silverlight application to work. As I mentioned in the beginning, there are a lot of other things that changed, but our app is just a Hello World app, most of it isn't relevant to us.

 

 

Good luck!

 

 

Phil

 
Posted by Phillip S. Wicklund on 11-Jun-08
2  Comments  |  Trackback Url  | 0  Link to this post | Bookmark this post with:        
 
Failed to render control: Value does not fall within the expected range.

Comments


Hitender Singhcommented onTuesday, 17-Jun-2008
gr8 job Phil


Michael Hermancommented onWednesday, 3-Dec-2008
Subject: "Failed to load the application. It was built with an obsolete version of silverlight" I'm trying to use the current SL beta version of the samples #1 and #2 with the SL 2.0 RTM runtime and am getting the following error message "Failed to load the application. It was built with an obsolete version of silverlight". How can I workaround this problem when using the SL 2.0 RTM bits? Thanks Michael

Bookmark and Share

Note: Facebook no longer sends notifications for comments, so it may be a number of days before I see your post. For urgent matters, click "Contact Me" on the top nav. More info: Click Here.