Code Not Getting Executed In VB.NET

P

Phil Galey

I have a routine that calls a function that returns a boolean. If I paste
the function call into the immediate command window, it runs the function
and returns the correct result. However, if I let the program run the
function, either in debug mode or even as a compiled executable, it does not
execute the function and blindly returns True for the function and then
continues to execute the rest of the routine.

I have the configuration set for Debug mode and not Release, so that's not
the cause. This problem started happening a few days ago and now affects
many different programs that I have created in VB.NET and that did not
previously exhibit this behavior. What could be the cause / solution of
this problem? Please answer soon, while I still have my job. It not only
impacts my debugging, even the compiled executable acts the same way! Is
there a setting that would de-distasterize my VB.NET?

Thanks.
 
C

Chris Dunaway

Without seeing the code for the function, it's difficult to know what
the problem is. One thing you could try is to delete the bin folder of
your app and then recompile.

What happens when you step through the code? Can you put some
Debug.WriteLine's in the code to see if they get hit?

Just some thoughts
 
C

Chris, Master of All Things Insignificant

Might help if we see the code causing you problems.

Chris
 
P

Phil Galey

Thanks for your help. I figured out what the problem was ... in this case,
anyway. The function call was the second item in a line with an AndAlso
boolean operator, with the first item returning False; therefore it was by
design that it was not executing the function. Sorry for the mistake.

I have been experiencing a lot of the problem where it acts like Release is
selected when Debug is actually selected, and where it sometimes says "There
is no source code available for the current location.", and then after
hitting F5, runs the rest of the code without allowing debugging. I still
need to find a solution for that problem.

Phil Galey
 
C

Chris, Master of All Things Insignificant

I've heard that when that happens delete the obj/pdb files then rebuild it
can clear that up. Not sure but give it a try.

Chris
 

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