Jul 16, 2009

ResourceDictionary value out of range in silverlight 3 RTW

I am porting my SL 3 beta code to RTW.
After a bit of tweaks, i got past build errors. Refer to other post. And then started getting the following runtime error:

Attribute "MyAssembly;component/MyStyles.xaml" value is out of range. [Line: x Position: y]

The corresponding line in the XAML below. Position y is the equal sign after TargetType.
  • style key="ImageButton" targettype="Button"
The following is the code for MergedDictionaries reference
  • resourcedictionary source="MyAssembly;component/MyStyles.xaml"
The actual cause was the Build Action property of XAML file.
The solution steps are
1) the xaml file you are referencing should have BuildAction = Resource
2) addition of a "/" prefix to the assembly in the source:

You can read more in these links:
http://silverlight.net/forums/t/111475.aspx

http://silverlight.net/forums/p/108647/251577.aspx#251577

Also, check the section
"3.18 Effects Files (.ps) can no longer be loaded as Content"
from the list of SL3 RTW breaking changes @ http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx

Jul 11, 2009

Silverlight 3 RTW - Breaking Changes from 3 Beta and SL 2

Go through the link to understand all the breaking changes from SL 3 Beta and SL 2 before converting your code.

http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx

Silverlight 3 SDK - Removed Controls

Silverlight 3 RTW removes some of the controls from the SDK. Following are some that were throwing errors in my code.

DockPanel
Expander
HeaderContentControl
ViewBox
WrapPanel

Read this link for the complete list of controls that have moved from the SDK to Silverlight Toolkit.

System.Web.Silverlight not found in Silverlight 3 release

With Silverlight 3 RTW in the wild, i tried running my existing Silverlight 3 beta code with the RTW with anticipations of broken code. I wasn't wrong. Got the first one.

The type or namespace name 'SilverlightControls' does not exist in the
namespace 'System.Web.UI' (are you missing an assembly reference?)


After a bit of searching on my system, i realised it was still referring to my Silverlight 2 libraries path. But, having uninstalled that, unresolved namespace.

After searching on the web and silverlight.net site, found out that, the "System.Web.Silverlight.dll" has been moved out of the Silverlight SDK and made available separately as ASP.NET Server Controls here. So, the fix is to get the dll from here and add it to your project as a library. There could be other ways such as installing to GAC etc, which wasn't really needed in my case.

Hope this helps.
Reblog this post [with Zemanta]

Jun 19, 2009

Hug a Developer

I thought you might enjoy this one.



Atleast, I know I am not alone. And, therefore my boss knows, I can't complaint :)

Happy Friday.

Jun 13, 2009

Debugging WCF hosted on IIS

Image representing Microsoft Silverlight as de...Image via CrunchBase


Something trivial as debugging a WCF hosted on IIS eventually cost me hours of googling and digging into VS2008. Lot of lessons learnt though.

In brief:
Built a WCF and a Silverlight app to connect to it.

On trying to run both of them out of development web server supported by VS resulted in error

This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent.
After digging for while and repeatedly reading the basic requirements to have crossdomain.xml and clientaccesspolicy.xml, this article gave an organized summary with examples on crossdomain. Again, it didn't work. The solutions recommended having either of the crossdomain.xml and clientaccesspolicy.xml files in the app folder or the www root folder. It really didn't work in my case. It started working when placed both the files in root and app folder. Still, not sure if that made it work. Worth a try and different from all the solutions i came across.

Error 2:

Trying to debug the WCF hosted on the IIS through VS.NET started throwing the error "The following module was built either with optimizations enabled or without debug information"

I was sure, the modules were built with debug mode and optimizations turned off. After searching for while, the below url provided ways to debug further. The articles talks about attaching to w3 process and using VS.NET to check the availability of debug information.

http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/3d99bf8b-dd32-4562-ab9b-8f63982ec57c

http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic49328.aspx

Reblog this post [with Zemanta]

Jun 6, 2009

Software Engineering ≠ Computer Science [Source: DDJ.COM]

Giving The Signal! (Rubik's Cube)Image by Gojca via Flickr

A great post on practical issues surrounding Software Engineering and why Software Engineering is different from Computer Science. The author points out the human factor as the key to all issues and why Software Engineering will never be as rigorous and predictable as Computer Science.

The complete article at Dr.Dobb's journal here.
Must Read!

Reblog this post [with Zemanta]