473,382 Members | 1,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

C# :: repeating debug statements

BA
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.
Apr 5 '07 #1
0 1771

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Dan Perl | last post by:
Is there a mechanism or an idiom for adding code for debugging so that it can easily be removed in the production code? I am thinking of something similar to the C/C++ preprocessor statements with...
1
by: Robert | last post by:
Simple way of writing debug print statements in your JavaScript code. You need to have enabled popups in your browser. I liked the ability to write to the java console in Netscape 4.x. This,...
2
by: Eric Mathieu | last post by:
Hi ! I have a program with almost 100 sources. The program coredump so i want debug the memory and i try memwatch but i don't get the result i want. The program crash so memwatch don't...
5
by: Tom Lam lemontea | last post by:
Hi all, This is my very first post here, I've seriously tried some programming on C, and shown below is my very first program(So you can expect it to be very messy) that I wrote after I've learned...
7
by: Srinivasa Rao | last post by:
I have read in one article that when we compile the application in release mode, all the debug classes and properties will be automatically removed from the code. I tried to implement this thing by...
5
by: MLH | last post by:
I use a fair number of debug.print statements. My apps are fairly well 'peppered' with them. I've often wondered if leaving them in the mdb, creating and rolling out an mde intended for use in the...
6
by: pauldepstein | last post by:
To help me debug, I am writing a lot of information into a stream which I call debug. However, because of the large amount of time taken to print this information, I only want this printed while...
2
by: mthread | last post by:
Hi, I am new to C++, But has good experience in C. In C I have used macros to enable / disable debug statements in the code. For ex : #if defined ENABLE_DEBUG #define Printf1(arg) printf(arg)...
9
by: vivek | last post by:
Hi i have used some debug macro and called several times(hundreds) in the code. The purpose of the macro was to print the values at that time to the screen Now that i have finished...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.