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

Very very strange. Major bug?

Hi. Can anyone please explain to me why this method "restarts" after the
StreamWriter is created?? Put a brakepoint on the sub and you will see what
I mean. I've tried running it on a different machine and the same thing
happends. I'm running .NET Framework 1.0

Private Sub test()
Dim swWebBidLog As System.IO.StreamWriter
Dim strLogFile As String

strLogFile = Server.MapPath("log.log")

swWebBidLog = New System.IO.StreamWriter(strLogFile, True,
System.Text.Encoding.Default)
End Sub

Thanks,
Shawn
Nov 18 '05 #1
4 1008
I don't get it, for one you aren't "closing" the StreamWriter in the code
you posted. Just for grins I added a swWebBidLog.Close() at the end of it
all, and it uh closed, then exited. I don't really see what your problem
is. Please post more, especially the sub you are calling "test()" out of,
your probably most likely lies there.

"Shawn" <bo********@hotmail.com> wrote in message
news:40******@news.wineasy.se...
Hi. Can anyone please explain to me why this method "restarts" after the
StreamWriter is created?? Put a brakepoint on the sub and you will see what I mean. I've tried running it on a different machine and the same thing
happends. I'm running .NET Framework 1.0

Private Sub test()
Dim swWebBidLog As System.IO.StreamWriter
Dim strLogFile As String

strLogFile = Server.MapPath("log.log")

swWebBidLog = New System.IO.StreamWriter(strLogFile, True,
System.Text.Encoding.Default)
End Sub

Thanks,
Shawn

Nov 18 '05 #2
Creating the StreamWriter might block the current thread for a small
amount of time waiting for IO. This would allow a second thread to get
into the Sub.

You could check if this is what you are seeing by opening the Threads
windows in the Debugger (Debug -> Windows -> Threads). Watch the
little yellow arrow to see if the ID changes on the "restart".

HTH,

--
Scott
http://www.OdeToCode.com

On 3 Feb 2004 14:44:42 +0100, "Shawn" <bo********@hotmail.com> wrote:
Hi. Can anyone please explain to me why this method "restarts" after the
StreamWriter is created?? Put a brakepoint on the sub and you will see what
I mean. I've tried running it on a different machine and the same thing
happends. I'm running .NET Framework 1.0

Private Sub test()
Dim swWebBidLog As System.IO.StreamWriter
Dim strLogFile As String

strLogFile = Server.MapPath("log.log")

swWebBidLog = New System.IO.StreamWriter(strLogFile, True,
System.Text.Encoding.Default)
End Sub

Thanks,
Shawn


Nov 18 '05 #3
No I didn't close the StreamWriter in the code, I left it out along with the
rest of the sub because it's not important. What is important is that when
I set a brakepoint on this line: swWebBidLog = New
System.IO.StreamWriter(..) and do a "step over" the whole page restarts and
page_load is called again.
test() is called from page_load.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
test()
End Sub

This is the case on two machines at work, but when I tried it at home it
worked.

Shawn
"Michael Ramey" <raterus@localhost> wrote in message
news:eH**************@TK2MSFTNGP09.phx.gbl...
I don't get it, for one you aren't "closing" the StreamWriter in the code
you posted. Just for grins I added a swWebBidLog.Close() at the end of it
all, and it uh closed, then exited. I don't really see what your problem
is. Please post more, especially the sub you are calling "test()" out of,
your probably most likely lies there.

"Shawn" <bo********@hotmail.com> wrote in message
news:40******@news.wineasy.se...
Hi. Can anyone please explain to me why this method "restarts" after the
StreamWriter is created?? Put a brakepoint on the sub and you will see what I mean. I've tried running it on a different machine and the same thing
happends. I'm running .NET Framework 1.0

Private Sub test()
Dim swWebBidLog As System.IO.StreamWriter
Dim strLogFile As String

strLogFile = Server.MapPath("log.log")

swWebBidLog = New System.IO.StreamWriter(strLogFile, True,
System.Text.Encoding.Default)
End Sub

Thanks,
Shawn


Nov 18 '05 #4
Hi Scott.
The ID didn't change.. I found out that it wasn't the sub that restartet,
it was the entire page. After trying to create the StreamWriter the thread
jumped back to Page_Load again (thus starting test() for the second time).

Shawn
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:si********************************@4ax.com...
Creating the StreamWriter might block the current thread for a small
amount of time waiting for IO. This would allow a second thread to get
into the Sub.

You could check if this is what you are seeing by opening the Threads
windows in the Debugger (Debug -> Windows -> Threads). Watch the
little yellow arrow to see if the ID changes on the "restart".

HTH,

--
Scott
http://www.OdeToCode.com

On 3 Feb 2004 14:44:42 +0100, "Shawn" <bo********@hotmail.com> wrote:
Hi. Can anyone please explain to me why this method "restarts" after the
StreamWriter is created?? Put a brakepoint on the sub and you will see what
I mean. I've tried running it on a different machine and the same thing
happends. I'm running .NET Framework 1.0

Private Sub test()
Dim swWebBidLog As System.IO.StreamWriter
Dim strLogFile As String

strLogFile = Server.MapPath("log.log")

swWebBidLog = New System.IO.StreamWriter(strLogFile, True,
System.Text.Encoding.Default)
End Sub

Thanks,
Shawn

Nov 18 '05 #5

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

Similar topics

8
by: Ondine | last post by:
Hi I have a client running an Access 2000 database on a small network with 3 pc's. Two of the laptop pcs have a data replica, which they use when not connected to the network, the 'server'...
6
by: leonecla | last post by:
Hi everybody, I'm facing a very very strange problem with a very very simple C program... My goal should be to write to a binary file some numbers (integers), each one represented as a sequence...
12
by: Dan Keeley | last post by:
Hi, As far as i can tell this can't be done, but thought i'd quickly ask, I have 4 labels in my combobox, and i want to add them to the box with a numeric "value" and then get that value of the...
5
by: joe.hrbek | last post by:
Hello everyone, I'm experimenting with python and i'm following this tutorial: http://docs.python.org/tut/node6.html#SECTION006400000000000000000 I'm in section 4.7.5 Lambda Forms. In this...
9
by: M. Posseth | last post by:
i have 3 forms Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm As New Form2 frm.Show(Me) End Sub...
12
by: John | last post by:
I can't get my head around this! I have the following code: <% .... Code for connection to the database ... .... Code for retrieving recordset ... If Not rs.EOF Then ... Do something...
0
by: Paul Cheetham | last post by:
Hi, I have a strange problem in one of my applications. It occurs after I show a second form from my main form. When I close the second form, and re-show the main form I sometimes get an...
11
by: VijaKhara | last post by:
Hi all, I just write a very simple codes in C and vthere is a very strange bug which I cannot figure out why. The first loop is for v, and the second for k. There is no relationship between v...
4
by: Gotch | last post by:
Hi, I'm getting a very strange behaviour while running a project I've done.... Let's expose it: I've two projects. Both of them use a Form to do some Gui stuff. Other threads pack up messages...
112
by: Prisoner at War | last post by:
Friends, your opinions and advice, please: I have a very simple JavaScript image-swap which works on my end but when uploaded to my host at http://buildit.sitesell.com/sunnyside.html does not...
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: 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: 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?
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
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,...

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.