I posted on this once before and could not get a solution, I am hoping
someone can help. I have a very strange code debug behavior that I cannot
make heads or tails of:
I have c# code being executed in BizTalk assemblies which is repeating debug
statements. I tried debug.flush() and debug.close() which did not solve the
problem.
In my BizTalk process I call a static method:
public static string ValidateMessage(params...)
When I call this method the FIRST TIME, everything is fine, and the
DebugView outputs the following...
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification ASSERTED
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification ::
VerifyPOLineUnique STARTED
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO NUM =
V360006300001000
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO lines 0
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: all lines
are unique
Then it gets strange.... when I execute it a second time, I get:
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification ::
VerifyPOLineUnique STARTED
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO NUM =
V360006300001000
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO lines 0
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: all lines
are unique
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification ASSERTED
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification ::
VerifyPOLineUnique STARTED
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO NUM =
V360006300001000
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO lines 0
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: all lines
are unique
A third time I get:
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification ::
VerifyPOLineUnique STARTED
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO NUM =
V360006300001000
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO lines 0
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: all lines
are unique
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification ::
VerifyPOLineUnique STARTED
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO NUM =
V360006300001000
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO lines 0
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: all lines
are unique
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification ASSERTED
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification ::
VerifyPOLineUnique STARTED
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO NUM =
V360006300001000
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: PO lines 0
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: looping thru
lines
AL.TechSvcs.Procurement.Support :: BusinessRulesVerification :: all lines
are unique
And so on... It keeps piggy-backing these past method calls.
If I restart the BizTalk host (similar to an iisreset), the first call
behaves normally as described above and then this problem begins again.
Someone suggested there was something static is being appended, but I cant
see it in the code. If you see something, please let me know. The reason I
tend to agree is because the line "AL.TechSvcs.Procurement.Support ::
BusinessRulesVerification ASSERTED " appears 2/3 of the way thru on the
repeats and its the very first thing which is done when the code is
executed. It does not appear that the logic is executing 3x, just the
output to the debugger. I have also verified this behavior is repeated on
other systems.
If there is something in .NET 2.0 which is causing my debug statements to
append? I have never had a problem in .NET 1.*.
Here is a sample of the code. This behavior is happening in more methods
than this one, so its not an isolated problem.
using System;
using System.Xml;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Diagnostics;
using Microsoft.RuleEngine;
namespace AL.TechSvcs.Procurement.Support
{
public class BusinessRulesVerification
{
public BusinessRulesVerification()
{
Debug.WriteLine("AL.TechSvcs.Procurement.Support ::
BusinessRulesVerification ASSERTED");
}
public static string VerifyPOLineUnique(TypedXmlDocument rootNode,
string PoNum, string xpath, string xLineNum)
{
XmlNodeList PoLines;
try
{
Debug.WriteLine("AL.TechSvcs.Procurement.Support ::
BusinessRulesVerification :: VerifyPOLineUnique STARTED");
Debug.WriteLine("AL.TechSvcs.Procurement.Support ::
BusinessRulesVerification :: PO NUM = " + PoNum);
PoLines = rootNode.Document.SelectNodes(String.Format(xpath,
PoNum));
if (PoLines.Count 0)
{
Debug.WriteLine("AL.TechSvcs.Procurement.Support ::
BusinessRulesVerification :: PO lines 0");
//PUT MATCHING PO NUMBERS IN AN ARRAY
ArrayList arrLineNums = new ArrayList();
foreach (XmlNode node in PoLines)
{
Debug.WriteLine("AL.TechSvcs.Procurement.Support ::
BusinessRulesVerification :: looping thru lines");
arrLineNums.Add(node.SelectSingleNode(xLineNum).In nerText);
}
int i, j;
for (i = 0; i < arrLineNums.Count - 1; i++)
{
for (j = i + 1; j < arrLineNums.Count; j++)
{
if (arrLineNums[i].Equals(arrLineNums[j]))
{
Debug.WriteLine("AL.TechSvcs.Procurement.Support
:: BusinessRulesVerification :: found non-unique line !!");
return "False";
}
}
}
Debug.WriteLine("AL.TechSvcs.Procurement.Support ::
BusinessRulesVerification :: all lines are unique");
return "True";
}
else
{
Debug.WriteLine("AL.TechSvcs.Procurement.Support ::
BusinessRulesVerification :: no PO lines found");
return string.Empty;
}
}
catch (Exception e)
{
Debug.WriteLine(exception.ToString());
EventLog.WriteEntry("Biztalk", String.Format("Error occured
when trying to find unique PO lines. Return empty string"),
EventLogEntryType.Error);
throw e;
}
}
}
}
If anyone has seen this or knows what I am doing wrong, please help.