473,386 Members | 1,796 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.

How does this simple function hang up?

The dirt simple function below hangs up the thread it is executing on.

Private Function PurifyTelnum(ByVal telnum As String) As String

' drop trailing " "

Dim nbspIndex As Integer = telnum.Length - 5 ' offset to " "
if it's at the end of the string
If telnum.Substring(nbspIndex, 6) = " " Then
Return telnum.Substring(0, telnum.Length - 6)
End If

' drop imbedded "&nbsp;<br>" and then get rid of redundant blanks

Return CleanUpIdiomas(telnum.Replace("&nbsp;<br>", " "))

Return telnum
End Function

In single-stepping thru the code the last statement highlighted is
If telnum.Substring(nbspIndex, 6) = "&nbsp;" Then
I see no indication that it gets to the Return statement below it.

When I do a "Break All" and try to look at the thread I get a pop-up saying
that there is no source code corresponding to the location (but it does not
say what source code it is looking for).

TaskManager indicates that the problem is not a CPU loop.

This is driving me nuts! I'll be grateful if one of you guys spots the
problem.

Thanks, Bob
Nov 1 '07 #1
1 1165
I put the code below into a separate and trivial application and discovered
right off that the PurifyTelnum function has at least one dumb error -
nbspIndex can be less than 0. This causes a pop-up when the error occurs in
the trivial application. But in my "real" application where this code is
running in its own thread there is no pop-up. Is this because I've done
something wrong in the way I do the multi-threading? Or is it just the way
it is? I hope it's some dumb mistake on my part because it was a real pain
to find the source of the problem without the error pop-up.

Thanks, Bob
"eBob.com" <eB******@totallybogus.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
The dirt simple function below hangs up the thread it is executing on.

Private Function PurifyTelnum(ByVal telnum As String) As String

' drop trailing "&nbsp;"

Dim nbspIndex As Integer = telnum.Length - 5 ' offset to "&nbsp;"
if it's at the end of the string
If telnum.Substring(nbspIndex, 6) = "&nbsp;" Then
Return telnum.Substring(0, telnum.Length - 6)
End If

' drop imbedded "&nbsp;<br>" and then get rid of redundant blanks

Return CleanUpIdiomas(telnum.Replace("&nbsp;<br>", " "))

Return telnum
End Function

In single-stepping thru the code the last statement highlighted is
If telnum.Substring(nbspIndex, 6) = "&nbsp;" Then
I see no indication that it gets to the Return statement below it.

When I do a "Break All" and try to look at the thread I get a pop-up
saying that there is no source code corresponding to the location (but it
does not say what source code it is looking for).

TaskManager indicates that the problem is not a CPU loop.

This is driving me nuts! I'll be grateful if one of you guys spots the
problem.

Thanks, Bob

Nov 1 '07 #2

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

Similar topics

10
by: Jason | last post by:
Hi, I have a few million data items being received by my program and I wish to store them in a list, with each item being inserted in any position in the list. Any performance tips so that my...
4
by: Thomas Mlynarczyk | last post by:
Hi, I stumbled over a strange behaviour of Mozilla. When I want to access the caller property of a function that was not called from within another function, Mozilla seems to abort the script....
6
by: sam c | last post by:
I have some code that looks a bit like this (note: this isn't the actual code, it's just here in an attempt to help me explain what actions I'm doing): void foo(int bar1) { } void foo(float...
1
by: Amil Hanish | last post by:
I'm having an issue on IIS 6 on Windows 2003 Server. The following simple file hangs the client forever (I quite waiting after about five minutes). No error in IIS error file or IIS log file. The...
3
by: Joel Leong | last post by:
I use C# to invoke DTS. The DTS run successfully if no process cube function in it. But after i add process cube function, the ASP.NET page hang. I even impersonate ASP.NET to an account with...
13
by: Just Me | last post by:
Trying threads for the first time. This seems to hang and I wonder if it looks OK to you. Right now the thread t is simply a Form with a Cancel Button. If clicked it should raise an event that...
73
by: Claudio Grondi | last post by:
In the process of learning about some deeper details of Python I am curious if it is possible to write a 'prefix' code assigning to a and b something special, so, that Python gets trapped in an...
5
by: marcsirois | last post by:
I have an SQL Query that looks like this. I simplified it for the purpose of this example, but it's still a runnable query SELECT TOP 1 FundedPositions.PositionNumber AS , (select top 1...
20
by: Bryan A | last post by:
Is there a way to add a timeout to this script so that it times out at a certain time. So it would be auto updating every 2seconds and it would timeout like after 100 seconds with a message?. ...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.