Nov 18, 2010

Error HRESULT E_FAIL has been returned from a call to a COM component.

"Error HRESULT E_FAIL has been returned from a call to a COM component." Sounds familiar? 
This error gets thrown across so many places in a whole gamut of microsoft products. But, this post is specific to Silverlight. I would assume that, if you have the source code for the project you are debugging with VS, you should be able to pin point to the exact location of errors and exceptions no matter what caused it. But the above error is very tricky. Even if you have the code in place, VS debugger won't point to the exact location not does it give a meaningful stack information. This is a problem with layered programming languages like .NET and anything built on top of it. If you were to do unmanaged programming, you may have more diagnostic information to look at.

Limitation in Expression Blend for sample data generation.

Expression Blend has a great feature to create sample data for design time use. For instance, if you had datatemplates and building upon MVVM, Blend can generate sample data for your VM class and populate the UI during design time. This way, you can visualize your UI controls during design time. To do this, open your project in Blend.. simply click on the Data tab.. select the "Create Sample Data" icon and choose "Create sample data from class".. now choose your VM or any class that you are binding to your controls. Thats it. You should see your UI controls populated with sample data in design view. This is a great feature in Blend for designers/developers.

But, there is a limitation. The sample data can be generated only for classes. If any of your property has an Interface return type, Blend will not generate sample data. You may need to have an Interface by architecture, but Blend will fail to generate data.