Unhandled exception on Windows98

B

billsahiker

Why is my application crashing on a windows 98 machine? It runs fine
on the development machine with xp pro.It was developed with VS2005
in
VB. I installed framework 2 and windows installer 2 on the windows 98
machine. The error message I get is "Application generated an
exception that cannot be handled." It then lists the process and
thread IDs.

I installed the app on a windows 98 machine. Some of the functions
work, others do not.
The ones that do not have one thing in common: they make an
asynchronous call to a method in a class library in the same VB
solution.I checked out the methods at msdn which indicates they are
supported on windows 98. I added extra message boxes to see how far
the code gets. The app crashes before reaching the sub that makes
the
async call.


Private Sub btnQuickQuoteOK_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnQuickQuoteOK.Click
If Trim(txtQuickQuoteSymbol.Text) = "" Then
MsgBox("A symbol is required.") 'executes if
textbox is
empty
Exit Sub
End If
If InStr(txtQuickQuoteSymbol.Text, ",") > 0 Then
MsgBox("One Symbol only") 'executes if textbox
contains a
comma
Exit Sub
End If
Try
ClearQuickQuote() 'does not execute this
call, but
exception is not handled.
Catch ex As Exception
MsgBox(ex.Message)
End Try
Try
GetQuotes(Split(Trim(txtQuickQuoteSymbol.Text),
",")) 'makes the async call
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub


Private Sub ClearQuickQuote()
txtLast.Text = ""
txtDayHi.Text = ""
txtDayLo.Text = ""
txtOpen.Text = ""
txtClose.Text = ""


End Sub


Private Sub GetQuotes(ByVal Symbols() As String)
' Create an instance of the test class.
Dim ad As New Async()
' Create the delegate.
Try
Dim caller As New AsyncMethodCaller(AddressOf
ad.GetQuotes)
' Initiate the asynchronous call
Dim result As IAsyncResult = caller.BeginInvoke(Symbols,
AddressOf CallbackMethod, _
caller)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' Callback method must have the same signature as the
' AsyncCallback delegate.
Sub CallbackMethod(ByVal ar As IAsyncResult)
Dim returnValue As String = ""
' Retrieve the delegate.
Try
Dim caller As AsyncMethodCaller = CType(ar.AsyncState,
AsyncMethodCaller)


' Call EndInvoke to retrieve the results.
returnValue = caller.EndInvoke(ar)
Catch ex As Exception
MsgBox(ex.Message)
End Try


'need to implement a thread-safe way to reference a control
on
the form to avoid a
'cross-thread access error.
SetData(returnValue)


End Sub
Private Sub SetData(ByVal HtmlString As String)
' InvokeRequired required compares the thread ID of the
' calling thread to the thread ID of the creating thread.
' If these threads are different, it returns true.
Try
If Me.WebBrowser1.InvokeRequired Then
Dim d As New SetTextCallback(AddressOf SetData)
Me.Invoke(d, New Object() {HtmlString})
Else
If BusTier.Buslayer.QuickQuote Then
FillQuickQuote(HtmlString)
Else
Me.WebBrowser1.DocumentText = HtmlString
End If
End If
Catch ex As Exception
Exit Sub
End Try


End Sub
 
B

Brian Schwartz

I don't have a solution for you, but I can tell you from past experience
that just because it crashes before it reaches the method making the async
call doesn't mean it's not that call that's the problem. I had a situation
once that I thought I was going to go nuts trying to pin down. I finally
concluded that at run-time it was crashing just before reaching a method it
couldn't fully understand, as if it was doing some kind of interpretation or
compile of it on the fly before it actually ran it. When I commented out a
certain statement inside that method, it ran fine, even though when it was
uncommented and crashing it was never reaching that statement.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top