Saturday, June 12, 2010

The expression that you have entered is not valid.

A notorious error message in BizTalk is the irritating "The expression that you have entered is not valid.". This message will be shown in a random fashion when using expression shapes in orchestrations. The message will not make sense since the expression entered in fact is perfectly valid and it will seem impossible to make the message with it's red exclamation mark go away.

I have found two solutions to this problem (not permanent though). One is to simply close and reopen Visual Studio. This will not always work. The other is to comment out the line in question in the expression shape, build the project, and then uncomment the line again.

The reason the message can stick to the project is due to the fact that it is written to the orchestration file itself. This is one of few occasions I've seen error messages be saved to a source file as can be seen in the snippet below:

[Microsoft.XLANGs.BaseTypes.DesignerPosition("3616dac3-6f4f-482a-a3c4-1417e828c572")]
scope longrunning transaction Scope_Trans
{
  body
  {
    #error "The expression that you have entered is not valid."
    [Microsoft.XLANGs.BaseTypes.DesignerPosition("e6cc3fbe-3385-43a2-b535-2a066e76d63c")]
    TSFactory.Framework.Logger.Log(System.Diagnostics.TraceEventType.Information, System.String.Format("{0} Orchestration Start", tracePrefix), logCategory);

By commenting out the line and rebuilding, the error message will also be deleted from the source file and then completely disappear.

Microsoft has released a hotfix for this problem, but I cannot find that it fixed the issue for me, especially in the case of calling external assemblies from an expression shape. Neither did it do any measurable difference for my colleagues. The hotfix can however be found here: http://support.microsoft.com/kb/979153.

2 comments:

  1. I too had no help from that hotfix. Thanks for posting the solution to this. Solidarity, BizTalker.

    ReplyDelete
  2. Tackar, r├Ąddade dagen

    ReplyDelete