Friday, July 6, 2007

You receive a "Message has not been initialized in construct statement" error when building your project

Problem

When you compile your BizTalk application, you get the error "Message has not been initialized in construct statement".

Cause

When you construct a message, you specify all the message variables. Then you make assignments to the message or its parts. If part of a specific message assignment is included in a separate Construct Message shape, you may receive the initialization error message.

Resolution

To resolve this behavior, make sure that you include all parts of a specific message assignment in the same Construct Message shape.

You can also resolve this behavior by creating your message in a Construct shape before using an instance of it in an Expression shape. For example, the following code will cause an error if placed in an Expression shape:

XMLDOM = new System.Xml.XmlDocument();

POAckMsg = XMLDOM;

To fix, create the instance of XMLDOM in a Construct shape, and then do the assignment in a downstream Expression shape.

Source: Microsoft

No comments: