473,386 Members | 1,644 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,386 software developers and data experts.

Bizarre C# behavior

BA
Hello,

I have a very strange code behavior that I cannot make heads or tails of:

I have c# code being executed in BizTalk assemblies which is acting very
strangely.

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...

Validate ASSERTED
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Then it gets strange.... when I execute it a second time, I get:

Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

A third time I get:

Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
And so on... It keeps piggy-backing these past method calls and I don't know
why!

If I restart the BizTalk host, the first call behaves normally as described
above and then this problem begins again.

If anyone has seen this or knows what I am doing wrong, please help.

Thanks,

BA

Mar 21 '07 #1
7 1319
BA <bi***************@gmail.comwrote:

<snip>
And so on... It keeps piggy-backing these past method calls and I don't know
why!

If I restart the BizTalk host, the first call behaves normally as described
above and then this problem begins again.

If anyone has seen this or knows what I am doing wrong, please help.
Are the debug lines from your code? If so, I suggest you add a stack
trace to the output.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 21 '07 #2
BA

"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
BA <bi***************@gmail.comwrote:

<snip>
>And so on... It keeps piggy-backing these past method calls and I don't
know
why!

If I restart the BizTalk host, the first call behaves normally as
described
above and then this problem begins again.

If anyone has seen this or knows what I am doing wrong, please help.

Are the debug lines from your code? If so, I suggest you add a stack
trace to the output.

--
Jon,

Thanks for the reply.

I am not getting an error, the code executes fine, just too many times. I
am under the impression the stack trace is dumped when an exception is
thrown, if not, how do I dump the trace to the debug view?

BA
Mar 21 '07 #3
BA <bi***************@gmail.comwrote:
I am not getting an error, the code executes fine, just too many times. I
am under the impression the stack trace is dumped when an exception is
thrown, if not, how do I dump the trace to the debug view?
Create a new instance of StackTrace, and call ToString() on it - then
write that out to the debug view in the same way you do the other
lines.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 21 '07 #4
Have you perchance registered to handle an event more than once?

On Mar 21, 4:41 pm, "BA" <biztalk.archit...@gmail.comwrote:
Hello,

I have a very strange code behavior that I cannot make heads or tails of:

I have c# code being executed in BizTalk assemblies which is acting very
strangely.

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...

Validate ASSERTED
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

Then it gets strange.... when I execute it a second time, I get:

Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

A third time I get:

Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

And so on... It keeps piggy-backing these past method calls and I don't know
why!

If I restart the BizTalk host, the first call behaves normally as described
above and then this problem begins again.

If anyone has seen this or knows what I am doing wrong, please help.

Thanks,

BA

Mar 22 '07 #5
On Mar 21, 1:41 pm, "BA" <biztalk.archit...@gmail.comwrote:
Hello,

I have a very strange code behavior that I cannot make heads or tails of:

I have c# code being executed in BizTalk assemblies which is acting very
strangely.

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...

Validate ASSERTED
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

Then it gets strange.... when I execute it a second time, I get:

Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

A third time I get:

Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

And so on... It keeps piggy-backing these past method calls and I don't know
why!

If I restart the BizTalk host, the first call behaves normally as described
above and then this problem begins again.

If anyone has seen this or knows what I am doing wrong, please help.
We would need to see the code that writes these lines out, and any
variable declarations involved.

The first question that occurred to me is, "Is it really running the
method once, then twice, then three times, or is the output stored in
a static StringBuilder and each call just appends output?" In other
words, are there really three calls the third time, or are you just
seeing one new call's worth of output appended to the output from the
previous two calls?

Mar 22 '07 #6
BA
Hi,

I doubt it. My code is rather simple. If there was a way to check, I would
be grateful.

BA

<pg******@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
Have you perchance registered to handle an event more than once?

On Mar 21, 4:41 pm, "BA" <biztalk.archit...@gmail.comwrote:
>Hello,

I have a very strange code behavior that I cannot make heads or tails of:

I have c# code being executed in BizTalk assemblies which is acting very
strangely.

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...

Validate ASSERTED
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

Then it gets strange.... when I execute it a second time, I get:

Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

A third time I get:

Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

And so on... It keeps piggy-backing these past method calls and I don't
know
why!

If I restart the BizTalk host, the first call behaves normally as
described
above and then this problem begins again.

If anyone has seen this or knows what I am doing wrong, please help.

Thanks,

BA


Mar 22 '07 #7
BA

"Bruce Wood" <br*******@canada.comwrote in message
news:11*********************@y80g2000hsf.googlegro ups.com...
On Mar 21, 1:41 pm, "BA" <biztalk.archit...@gmail.comwrote:
>Hello,

I have a very strange code behavior that I cannot make heads or tails of:

I have c# code being executed in BizTalk assemblies which is acting very
strangely.

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...

Validate ASSERTED
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

Then it gets strange.... when I execute it a second time, I get:

Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

A third time I get:

Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines
Validate :: ValidateMessage STARTED
Validate :: looping thru lines
Validate :: looping thru lines

And so on... It keeps piggy-backing these past method calls and I don't
know
why!

If I restart the BizTalk host, the first call behaves normally as
described
above and then this problem begins again.

If anyone has seen this or knows what I am doing wrong, please help.

We would need to see the code that writes these lines out, and any
variable declarations involved.

The first question that occurred to me is, "Is it really running the
method once, then twice, then three times, or is the output stored in
a static StringBuilder and each call just appends output?" In other
words, are there really three calls the third time, or are you just
seeing one new call's worth of output appended to the output from the
previous two calls?
I also considered whether 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 and its the
very first thing which is done when the code is executed.

If there is something appended, where am I allowing this to happen in the
code (below)?
Here is the output from the debug view and the code below..................
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 the code..................
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;
}

}
}
}
Mar 22 '07 #8

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

Similar topics

0
by: Roy Smith | last post by:
Can anybody explain this bizarre behavior: --------------------- Roy-Smiths-Computer:play$ py Python 2.3.4 (#3, Jun 29 2004, 21:48:03) on darwin Type "help", "copyright", "credits" or...
14
by: Michael Carr | last post by:
I have an intermittent problem that occurs on a very small number of browsers that access my website. The strange thing is this: my site works perfectly for 99.9% of browsers. The behavior...
1
by: Michael Carr | last post by:
I have created a website that responds to the following two domain names: logintest.carr-engineering.com logintest.onualumni.org If you open either of these websites on their own, everything...
5
by: ChaunceyMo | last post by:
Hi all, some help would be much appreciated on this issue: We have a fairly large asp.net app which until now has been using response.redirect without issue to move between pages. Unfortunately,...
0
by: Mark | last post by:
We're authoring a VS 2005 app that includes several EXE's and DLL's and also uses a COM component (a customer requirement). The COM component provides a graphic image to be used by the .NET app;...
1
by: zoehart | last post by:
I'm working with VBScript to build a text email message. I'm seeing a variety of bizarre formatting issues. The following lines of code MT = MT & vbCrLf & "Card Type: " & CardType MT = MT &...
0
by: ckfan.painter | last post by:
I've run into a seemingly bizarre problem with insert() for std::vector. (This was done on Microsoft Visual C++ 2005 express version 8...maybe it is a compiler specific bug?) Here's the code: ...
3
by: Peter | last post by:
Hi! I am having some very strange behavior with my databound controls. It's taken a long time to isolate exactly what is provoking the problem, but I'm still leagues away from solving it. I...
35
by: bukzor | last post by:
I've found some bizzare behavior when using mutable values (lists, dicts, etc) as the default argument of a function. I want to get the community's feedback on this. It's easiest to explain with...
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: 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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.