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.


Post a Comment

<< Home