VB .net Exception extremely slow

  • Thread starter Thread starter craigh01
  • Start date Start date
C

craigh01

I put this code on a button:

dim x as integer
Try
x = "hello"
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

The application hangs up for over 1 minute, then finally comes back
with "Cast from string "hello" to type 'Integer' is not valid".

The second time I click the button the execption comes up immediately.
But if I exit the application and go back in, again it takes over a
minute to display the exception.

Has anyone else had this problem? I can't seem to find it in the
groups.
 
I put this code on a button:

dim x as integer
Try
x = "hello"
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

How is that code even getting past the compiler? Do you have Option
Strict On? It is normal for there to be some delay when the exception
class is first JIT'd but 1 minute is way too long. I usually notice
about a 5 second delay on the first exception.
 
I had to take option strict off to do that example - that's just an
example to demonstrate the problem. I've got the same problem with
any exception (e.g. SQL errors).
 
Chris Dunaway said:
How is that code even getting past the compiler? Do you have Option
Strict On? It is normal for there to be some delay when the exception
class is first JIT'd but 1 minute is way too long. I usually notice
about a 5 second delay on the first exception.

I would even say that 5 seconds is pushing it (even though it FEELS like 5
seconds)
 
I just tried your example and (at least on my machine) the longest the
exception took to get thrown was about two seconds. Does it take that long
 
Hi,

Thanks...

It happens on the 2 machines that we have vb.net ide installed on
here...

It only happens from the IDE, the compiled version returns the
exception immediately... So I can only try it on a machine that has
visual studio .net on it...
 
Back
Top