VB .net Exception extremely slow

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.
 
C

Chris Dunaway

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.
 
C

craigh01

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).
 
R

Rick Mogstad

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)
 
G

Guest

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
 
C

craigh01

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...
 

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