|
-
Oct 30th, 2003, 01:34 AM
#1
error working with exceptions
I dont know why I cant get the stacktrace of the error this way:
I'm doing error handling this way, and the Globals.LogError function below always returns false:
VB Code:
Try
Dim img As Image = Image.FromFile(imagePath)
Dim frm As New frmImage(img, imagePath)
frm.MdiParent = Me
frm.Show()
Return frm
Catch ex As Exception When [b]Globals.LogError(ex)[/b]
Catch ex As IO.FileNotFoundException
MessageBox.Show("Error loading image. The following file could not be found: " & ex.FileName, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
[b]Catch ex As Exception[/b]
MessageBox.Show("Error loading image: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
' StackTrace has a value here
End Try
My problem is that when I check ex.StackTrace in my LogError function, its value is Nothing. But when I check it in the last Catch clause, it has a value. I dont know, is there a reason why this is happening? 
ignore the code inside the try catch block...
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 30th, 2003, 01:37 AM
#2
I don't think ex is assigned to anything until its inside the Catch. That is just a guess really. Can you get the message or other parts of the exception in the LogError method?
-
Oct 30th, 2003, 02:00 AM
#3
Originally posted by Edneeis
I don't think ex is assigned to anything until its inside the Catch. That is just a guess really. Can you get the message or other parts of the exception in the LogError method?
well yeah that's the weird part. I can get ex.Message and I can also get the type of the exception. This doesnt make sense! why would the other variables of ex be empty?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 30th, 2003, 02:36 AM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|