Monday 18 June 2007

Gatecrasher Gone!!!!

I was absolutely gutted to hear on the radio this evening that Gatecrasher in Sheffield is on fire as i write this! Sounds like its totally destroyed. Had some great time in there over the years! An end of an era and a sad sad day!

as the crasher slogan went

itwillalwaysbewithyou

Windows Communication Foundation Deserialization Bug

I recently had a bash at putting a WCF service together. I did all the tutorials and everything seemed ok so i had a bash at my own. Well i put it all together but could i get to consume it in a windows application??? Could i b*&^*^*.

I was at it ages until i finally discovered why! I am using VB.net for this implementation. All the demos and tutorials i did in c# which is fine but for my project it had to be in vb.net. It turns out there is a compilation switch that is different in VB.net and this causes a namespace problem which totally fricks up the deserialization of complex types! Working with strings and ints - no problem. Basic complex type such as a person with firstname and surname - forget it. All i got was an empty instance.

I wont go into the number of things i tried to get it all working but put it this way - i learnt a hell of a lot about xobjectgen and serialization.

So here is the fix! All you have to do is clear out the root namespace in your windows application and VOILA! It works.

If you are using C# you will not hit this problem because of the compiler switch you dont see.

I hope this saves someone a weeks worth of work pulling their hair out because i did! I was on the verge of binning WCF altogether. Now i think its pretty neat! And it seems very quick with the new high speed serialization engine.

Windows Workflow Foundation Activity Dependency Properties

I had been implementing a custom activity in WWF and added some dependecy properties to the actvity to allow binding. I tried and tried but for some reason i could not get the little blue i at the side of my properties to show it was bindable.

Here is what i had put in my activity:

Public Shared ToProperty As DependencyProperty = DependencyProperty.Register("To", GetType(String), GetType(SendEmailActivity), New PropertyMetadata(someone@example.com))

Public Property EmailTo() As String
Get
Return CType(MyBase.GetValue(SendEmailActivity.ToProperty), String)
End Get

Set(ByVal value As String)
MyBase.SetValue(SendEmailActivity.ToProperty, value)
End Set

End Property

As you can see i had ToProperty and EmailTo as the names. Even though they were pointing to each other the dependency property and the .NET accessor property need to be identical. They are even case sensitive!!

One to watch out for if you are doing any WWF and custom activities.