Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error BC30002 - Type XXX is not defined

OK, this begins to drive me crazy. I have an asp.net webapp. Pretty straightforward, most of the code in the .aspx.vb, and a few classes in App_Code.

The problem, which has begun to occur only today (even though most of the code was already written), is that once in a while, I have this error message :

Error BC30002: Type ‘XXX’ is not defined

The error occurs about every time I modify the files in the App_Code folder. EDIT : OK, this happens also if I don't touch anything for a while then refresh the page. I'm still trying to figure out exactly how to trigger this error.

I just have to wait a little bit without touching anything, then refresh the page and it works, but it's very annoying.

So I searched a little bit, but nothing came up except imports missing. Any idea ?

like image 676
thomasb Avatar asked Sep 17 '08 16:09

thomasb


1 Answers

I think I found the problem.

My code was like that :

Imports CMS

Sub Whatever()
    Dim a as new Arbo.MyObject() ' Arbo is a namespace inside CMS
    Dim b as new Util.MyOtherObject() ' Util is a namespace inside Util
End Sub

I'm not sure why I wrote it like that, but it turns out the fact I was calling classes without either calling their whole namespace or importing their whole namespace was triggering the error.

I rewrote it like this :

Imports CMS.Arbo
Imports CMS.Util 

Sub Whatever()
    Dim a as new MyObject()
    Dim b as new MyOtherObject()
End Sub

And now it works...

like image 160
thomasb Avatar answered Oct 12 '22 11:10

thomasb