Using ref parameters

Using ref parameters

Post by QWxleGFuZG » Fri, 10 Aug 2007 16:54:01


Hi there,

I have a problem. I'm trying to call a function from my dll in orchestration.

RecordWriter.InsertRecords(RecordsListMessage, VendorName, ref errorLine);

errorLine - int variable.

Here is my function:

public static void InsertRecords(XmlDocument doc, ref int errorLine)
{
XmlNodeList nodesList = doc.SelectNodes("//Record");
if (doc != null)
{
XmlElement mainElement = doc.DocumentElement;

int counter = 1;
try
{
foreach (XmlNode node in nodesList)
{
SomeFunc(node);
counter++;
}
}
catch (Exception ex)
{
errorLine = counter;
throw new Exception(ex.Message + " Line #" +
errorLine.ToString() + ".");
}
}
}
}

In orchestration I catch an exception. It's message contains line number(146).
But my ref parameter errorLine == 0. Why ???
I'm really confused. Does anybody know how to fix it?
 
 
 

Using ref parameters

Post by ?Utf-8?Q?J » Mon, 13 Aug 2007 07:49:00

A better design would be to create your own custom exception deriving from
the Exception class, using a property to store the line number.

--
Joo Pedro Martins
BizTalk Server MVP
http://www.yqcomputer.com/
http://www.yqcomputer.com/
http://www.yqcomputer.com/

 
 
 

Using ref parameters

Post by Yossi Daha » Mon, 13 Aug 2007 18:52:24

Can you not attach to the BizTalk process and debug the code? that could
give you an exact view of what's happening in your class.

Yossi Dahan
 
 
 

Using ref parameters

Post by Leonid Gan » Wed, 15 Aug 2007 08:25:10

Exactly, Yossi.

Line number (146) you can catch if you open the orchestration from Xml or
Text editor.

--
Regards,

Leonid Ganeline

Microsoft Certified Technology Specialist: BizTalk Server 2006
http://www.yqcomputer.com/