Yossi Dahan [BizTalk]


Wednesday, May 19, 2010

An unclear orchestration designer error in 2006, thankfully one that’s easy to fix

Yesterday I’ve tried to write a simple expression in the orchestration designer (BizTalk 2006) and got the following -

Could not parse expression. System.ArgumentNullException: Collection cannot be null.

Parameter name: c

   at System.Collections.ArrayList.InsertRange(Int32 index, ICollection c)

   at System.Collections.ArrayList.AddRange(ICollection c)

   at Microsoft.BizTalk.OrchestrationDesigner.Shell.ExpressionParser.ParseDotNetType(IDotNetType dotNetType, String token, LastCharType lastCharType, Boolean asStatic)

   at Microsoft.BizTalk.OrchestrationDesigner.Shell.ExpressionParser.ParseDotNetType(String typeName, String token, LastCharType lastCharType, Boolean asStatic)

   at Microsoft.BizTalk.OrchestrationDesigner.Shell.ExpressionParser.ParseExpression(String expression, UInt32 nCmdID)

   at Microsoft.BizTalk.OrchestrationDesigner.Shell.IntellisenseCommandFilter.UpdateParseInfo(UInt32 nCmdID)

    at IntellisenseCommandFilter.UpdateParseInfo(UInt32 nCmdID)

    at IntellisenseCommandFilter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

Turns out that this somewhat ‘nasty’ error message really means something very simple – I’m missing a reference!

Here’s description of a repro scenario -

I had a variable declared in the orchestration of Class1.
Class1 is a class with a single member of type Class2, which in turn has a single string member.
Class1 is defined in one assembly, and Class2 in another; however – I have only added a reference to the Class1 assembly from the BizTalk project, which was enough to be able to declare the Class1 variable (but, by the way, not enough to build the project)

When in the expression shape I then type ‘Variable_1.’ i get intellisense suggesting I could pick Class1Member; I do that and type ‘.’ again, at which point the exception is thrown (see image).


Adding a reference to the assembly containing Class2 sorts this out easily, and – of course – this makes perfect sense so I have no complaints that this is an error, I just wish the message was clearer in the designer itself.

Interestingly – if I try to compile the orchestration with the variable defined, I get a nice and clear compiler error - “error X2230: the type 'ClassLibrary2.Class2' is in assembly 'ClassLibrary2' that needs to be referenced”

Also – this does not happen in BizTalk 2009 (you simply don’t get intellisense after Class1Member until you add the missing reference, which I’m more than happy with, although it is not 100% clear either), which suggests this was fixed and – in fact – there may well be a hotfix for it for 2006 but I couldn’t find one. I haven’t been able to test this on BizTalk 2006 R2 yet.

Thursday, May 13, 2010

BizTalk and AppFabric

I’ve spotted only today this post by Mark Burch and started to write a comment there, but then figured it would be quite handy to post that here -

I think Mary-Jo Foley’s point is interesting, and it’s certainly one worth keeping an eye one, and I’m sure Mark is right that it would keep the discussion on BizTalk vNext active, which has to be a good thing! but really – isn’t this just a natural, expected, progression? (and – again – that’s not a criticism of Mark’s post)

I believe that as much as it is clear that BizTalk Server has can benefit from embracing at least some aspects of the Windows AppFabric platform, and I can think of a few,  it should also be clear that an organisation embracing Windows AppFabric would, often, gain a lot by complimenting it with a BizTalk version that integrates seamlessly to it one way or another.

BizTalk offers a lot of capabilities that Windows AppFabric is not currently able to offer, and so I’m sure Microsoft are facing the question of – do we want to re-write it all again, or do we want to leverage the mature product we already have with the field experience, integrators, community etc.

Similarly – from a BizTalk point of view –clearly AppFabric, built on the latest Microsoft stack, using the experience gained in Microsoft over the years has some advantages BizTalk could leverage, and so bringing the two close together has to be the most natural progression from where we are today.

What does that mean to a company that utilizes BizTalk today? probably not much - I would think they are already using or are considering using WCF extensively, and hopefully are evaluating and planning to use Windows AppFabric and WF 4 along side BizTalk as it is (they are very unlikely to want/be able to replace BizTalk with AppFabric today, or – in my view – in the near future), and so such a move by Microsoft, would simply mean that sometime in the (hopefully not to distant) future - their life is going to look be made much easier with these two products working very closely together.

Monday, May 10, 2010

What’s bigger than byte.MaxValue?

Well – byte.MinValue, of course!

Only that I didn’t think of that, and neither did the person whose code raised the weird exception that led me to this.

Can’t find anything on this on the web, which usually suggest everybody knows this but me, but it turns out that -

byte b = byte.MaxValue;

displays ‘0’, and so equally -

b = byte.MinValue ;

displays ‘255’

And I totally did not know that.

Conclusion – no matter how ‘efficient’ you want to be – don’t use bytes in a loop unless you know what you’re doing! :-)