Javin007
asked on
VB.NET IDE Not throwing errors?
I have the following in a form:
This SHOULD throw an error since the Engine and Tex objects haven't been "instantiated." (Am I using that term correctly?) Instead, the form opens as if there's no problems.
I assume I've changed some obscure setting somewhere accidentally, though why this setting would exist is beyond me.
Help!
-Javin
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Engine As TVEngine, Tex As TVTextureFactory, lngID As Long
Engine.Init3DNoRender(Me.Handle)
lngID = Tex.CreateTexture(48, 48)
End Sub
This SHOULD throw an error since the Engine and Tex objects haven't been "instantiated." (Am I using that term correctly?) Instead, the form opens as if there's no problems.
I assume I've changed some obscure setting somewhere accidentally, though why this setting would exist is beyond me.
Help!
-Javin
Engine and Tex in your example are variables which you are declaring. VB.NET IDE i correct NOT to throw an error / warning.
ASKER
Sorry, but you're wrong. Engine and Tex are objects that are declared but are not being instantiated. VB.NET SHOULD (and used to) throw exceptions when they are called.
Here goes a leson in the basics
1. Dim Engine As TVEngine
In the above, Engine is a variable TVEngine is the object
2. Dim Tex As TVTextureFactory
In this case Tex is the variable and TVTextureFactory is the object.
If your question was about TVTextureFactory and TVEngine not being instantiated, and therefore should throw errors, then fair comment, VB should and will.
Check your references, the objects may be declared in one of your custom references, and you have forgoten! (easy to do as is confusing variables with objects)
1. Dim Engine As TVEngine
In the above, Engine is a variable TVEngine is the object
2. Dim Tex As TVTextureFactory
In this case Tex is the variable and TVTextureFactory is the object.
If your question was about TVTextureFactory and TVEngine not being instantiated, and therefore should throw errors, then fair comment, VB should and will.
Check your references, the objects may be declared in one of your custom references, and you have forgoten! (easy to do as is confusing variables with objects)
ASKER
*sigh* I don't need a "leson in the basics (sic)" as I've been programming for 26 years.
Dim Engine as TVEngine
In this case, TVEngine is the class, and Engine is an "instance" of that class, also called an "object." I'm not going to argue semantics with you, as there's no point. Sure, you could argue that Engine is just a variable holding a pointer to the memory location of the instance of the object, but this is not the point.
Engine.Init3DNoRender(Me.H andle)
Here, a function of the Engine OBJECT is being called, despite the fact that the object was not instantiated. This should throw an exception and used to at the point that this is called. However, the form opens, no errors are thrown, and the code is entirely skipped. Putting a break in the Form_Load event shows that the code never executes.
This is what I'm trying to figure out. There SHOULD be an error thrown, and the code SHOULD attempt to execute, but it does not. The form simply opens.
-Javin
Dim Engine as TVEngine
In this case, TVEngine is the class, and Engine is an "instance" of that class, also called an "object." I'm not going to argue semantics with you, as there's no point. Sure, you could argue that Engine is just a variable holding a pointer to the memory location of the instance of the object, but this is not the point.
Engine.Init3DNoRender(Me.H
Here, a function of the Engine OBJECT is being called, despite the fact that the object was not instantiated. This should throw an exception and used to at the point that this is called. However, the form opens, no errors are thrown, and the code is entirely skipped. Putting a break in the Form_Load event shows that the code never executes.
This is what I'm trying to figure out. There SHOULD be an error thrown, and the code SHOULD attempt to execute, but it does not. The form simply opens.
-Javin
Hi Javin007;
Lets make sure that your Exceptions and Debug settings are not causing this. On the main menu click on Debug -> Exceptions.... When the Exceptions window opens click on "Reset All", this will reset all the exception setting to the default setting as when first installed VS. Now try executing the code.
Fernando
Lets make sure that your Exceptions and Debug settings are not causing this. On the main menu click on Debug -> Exceptions.... When the Exceptions window opens click on "Reset All", this will reset all the exception setting to the default setting as when first installed VS. Now try executing the code.
Fernando
I give up!
ASKER
Thanks, Fernando.
I tried the reset, still no dice. Form's still opening with no errors.
I tried the reset, still no dice. Form's still opening with no errors.
That leads me to believe that there is an instance of it somewhere or TVEngine has a static version.
ASKER
Newp. TVEngine definitely doesn't, and as this is literally the ONLY code in the app, it's not instantiated anywhere else. This code specifically used to throw errors all the time. The code isn't even EXECUTING. Debug.Print shows that it never executes the Form_Load event.
Is it possible that the "Handles MyBase.Load" could be wrong?
Is it possible that the "Handles MyBase.Load" could be wrong?
ASKER
So I've reduced the code down to this:
This outputs "Working" to the immediate window.
Then I change the code (bear in mind, this is 100% of the code in the entire project) to the following:
Now the word "working" does not appear in the immediate window, putting a break point on either line does not trigger anything, no errors are thrown, but the form still opens.
Definitely something stupid happening with the VB IDE. I've even tried to download/reinstall it, but it seems to keep the old settings with a reinstall. I assume there's some bizarre setting somewhere that says, "Don't show me anything at all, I'll just psychically determine when and where errors occur."
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Debug.Print("Working!")
End Sub
This outputs "Working" to the immediate window.
Then I change the code (bear in mind, this is 100% of the code in the entire project) to the following:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Engine As TVEngine
Debug.Print("Working!")
End Sub
Now the word "working" does not appear in the immediate window, putting a break point on either line does not trigger anything, no errors are thrown, but the form still opens.
Definitely something stupid happening with the VB IDE. I've even tried to download/reinstall it, but it seems to keep the old settings with a reinstall. I assume there's some bizarre setting somewhere that says, "Don't show me anything at all, I'll just psychically determine when and where errors occur."
What is TVEngine? Is there a web site that you can post so that I may do some research.
ASKER
TVEngine is a DirectX wrapper that I've used for years (www.TrueVision3D.com). I can assure you the problem isn't with the wrapper. This USED to throw the errors correctly, and then one day it just simply stopped throwing these exceptions. My suspicion is that there's a bad reference to the TV3D dll, but this should throw an error instead of simply opening the form and not executing the code in the event. It's not even limited to just this one situation. My VB IDE is doing all kinds of weirdness. In other obvious errors (syntax problems and whatnot) it takes me to an odd "can not find source" page and stops the execution without highlighting where the problem is.
ASKER
I'm currently in the process of uninstalling and removing all traces of VB.NET Express from my system, and will attempt a full reinstall once this is done.
ASKER
ARRRRGH! Full uninstall and reinstall of VB.NET Express and no change. This is driving me insane.
ASKER
I've even created a completely new project, thinking something may be corrupt in the project itself. This is 100% of the code in the project:
Executing this does NOT output "Working" to the Immediate Window. However if I comment out the Dim Engine As TVEngine line, it does.
Please help!
Imports MTV3D65
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Engine As TVEngine
Debug.Print("Working")
End Sub
End Class
Executing this does NOT output "Working" to the Immediate Window. However if I comment out the Dim Engine As TVEngine line, it does.
Please help!
Hi Javin007;
I think I have an answer for you so give me some time to write it up and post it.
Fernando
I think I have an answer for you so give me some time to write it up and post it.
Fernando
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Javin007;
Sorry in the above post I had the following statement :
On the main menu click on Debug -> Exceptions... When the dialog box opens click on Common Language RunTime Exceptions node to expand it.
Should read as :
On the main menu click on Debug -> Exceptions... When the dialog box opens click on Common Language RunTime Exceptions node to expand it then expand the System node.
Fernando
Sorry in the above post I had the following statement :
On the main menu click on Debug -> Exceptions... When the dialog box opens click on Common Language RunTime Exceptions node to expand it.
Should read as :
On the main menu click on Debug -> Exceptions... When the dialog box opens click on Common Language RunTime Exceptions node to expand it then expand the System node.
Fernando
ASKER
Unfortunately, I've already gone down that road. I've set *EVERYTHING* to "throw" in the "exceptions" section. Still nothing. The code has been reduced to this:
There's not even an attempt to call a method here, this is ONLY trying to DECLARE the variable. Still, when I execute this code, absolutely NOTHING prints in the immediate window. If I comment out the "Dim" line I will get "Eh?" and "Finally!" printed. Just by declaring the object the IDE is pretending not to see the sub at all.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Debug.Print("Eh?")
Try
Dim Engine As TVEngine, Tex As TVTextureFactory
Catch ex As Exception
Debug.Print("Failed.")
End Try
Debug.Print("Finally!")
End Sub
There's not even an attempt to call a method here, this is ONLY trying to DECLARE the variable. Still, when I execute this code, absolutely NOTHING prints in the immediate window. If I comment out the "Dim" line I will get "Eh?" and "Finally!" printed. Just by declaring the object the IDE is pretending not to see the sub at all.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well glad to here you found the issue. Have a great day.
ASKER
Note that this particular solution was due to a need for an app.config entry.