473,841 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Spurious "Not Defined" error messages

We have a project with many other projects referenced (all of which are referenced at the project level and are included in the solution). Frequenly, if we make a change in project A (such as adding a property, or even simply changing a line of code), a form in project B will then show 10 or more "object such-and-such is not defined". To fix this problem we check out the form in project B and 90% of the time that fixes it (but nothing changes in the code or on the form - if we check the code in, our repository just ignores it since the code hasn't changed!). The other 10% of the time, we solve the problem but cutting a line out of the "Windows Form Designer Generated code" section where all the objects are declared (Friend Withevents...") and simply pasting it back in - again, no changes

I'm using VS.NET 2003

This has been pretty annoying for a while, but now it is out of control, frequently showing a hundred errors messages in 3 or more forms, all of which have to be checked out and un-checked out before the app will compile. This really derails the train of thought, as you can imagine

Any suggestions would be greatly appreciated!
Nov 20 '05 #1
10 1647
I saw this behaviour with the following situation:
- Project A defines a base class with a Protected WithEvents variable
- Project B, which is in another assembly, inherits from the base class
in project A
- Project B has an event handler method which handles events from the
WithEvents variable defined in project A

This scenario, altough completely legal, should be avoided with VB.NET
2003 (and 2002), since the IDE cannot cope with it (you'll get the
errors you described). Instead, use AddHandler/RemoveHandler to handle
such events.

AFAIK, MS should be aware of this problem and has hopefully fixed it
already for Whidbey.

Best regards,
Urs
Eric G. Harrison wrote:
We have a project with many other projects referenced (all of which are referenced at the project level and are included in the solution). Frequenly, if we make a change in project A (such as adding a property, or even simply changing a line of code), a form in project B will then show 10 or more "object such-and-such is not defined". To fix this problem we check out the form in project B and 90% of the time that fixes it (but nothing changes in the code or on the form - if we check the code in, our repository just ignores it since the code hasn't changed!). The other 10% of the time, we solve the problem but cutting a line out of the "Windows Form Designer Generated code" section where all the objects are declared (Friend Withevents...") and simply pasting it back in - again, no changes.

I'm using VS.NET 2003.

This has been pretty annoying for a while, but now it is out of control, frequently showing a hundred errors messages in 3 or more forms, all of which have to be checked out and un-checked out before the app will compile. This really derails the train of thought, as you can imagine!

Any suggestions would be greatly appreciated!


Nov 20 '05 #2
Hi Urs,

Thanks for posting in the community.

Based on my test, I can not reproduce the problem.
Here is my reproduce steps.
[ProjectB]
Imports System.Windows. Forms
Public Class BaseClass
Protected WithEvents fm As Form
Private str As String = "Test"
Public Property sk() As String
Get
Return str
End Get
Set(ByVal Value As String)
str = Value
End Set
End Property
End Class

[ProjectA]
[Class1.vb]
Public Class DerivedClass
Inherits ProjectA.BaseCl ass
Public Sub Test()
fm = New Form
fm.Show()
Me.sk = "Hello"
End Sub
Private Sub fm_Closing(ByVa l sender As Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles fm.Closing
MsgBox("fm_Clos ing")
End Sub
Private Sub fm_Click(ByVal sender As Object, ByVal e As
System.EventArg s) Handles fm.Click
MsgBox("Click")
End Sub
End Class

[Form1.vb]
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim o As New ProjectB.Derive dClass
o.Test()
End Sub

Also I have added a new property to ProjectA.BaseCl ass and press
Ctrl+Alt+B to build the solution, the event will fire again.

Can you build a reproduce sample as simple as possible as long as it can
reproduce the problem, and send to me by removing the "online" from my
email address?
I look forward to hearing from you.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #3
Hi Eric, Urs, Peter.

I am working on a large solution with several large project included into
it. I also am connected to Visual Source Safe.

There are only two developers working on this solution, and both of us have
the same problem.. spurious errors in projects that we haven't even edited..
usually on forms.. but sometimes on a control inherited from Label..

The errors appear upon compilation, then if I check out the offending Form
or Class then comment out the line defining the object it claims to be
missing, then uncomment the same line, the problem goes away for a few more
compiles.. then re-appears..

It only seems to be a problem when the solutions gets above a certain size..
I have several other solutions that contain small projects, and the problem
never occurs there..

So I would guess it has something to do with the size of the solution..

Also it means it is extremely difficult to give a small reproduction of the
problem.

also several others are having the same problem.. see post in
microsoft.publi c.vsnet.ide on 05Feb2004 by Jeff Lindholm, title "Compile
Errors - only sometimes"

I can only re-iterate what Urs stated, and hope this problem goes away with
Whidbey!

Here's hoping,
Rigga.

"Eric G. Harrison" <er***********@ hotmail.com> wrote in message
news:68******** *************** ***********@mic rosoft.com...
We have a project with many other projects referenced (all of which are referenced at the project level and are included in the solution).
Frequenly, if we make a change in project A (such as adding a property, or
even simply changing a line of code), a form in project B will then show 10
or more "object such-and-such is not defined". To fix this problem we check
out the form in project B and 90% of the time that fixes it (but nothing
changes in the code or on the form - if we check the code in, our repository
just ignores it since the code hasn't changed!). The other 10% of the time,
we solve the problem but cutting a line out of the "Windows Form Designer
Generated code" section where all the objects are declared (Friend
Withevents...") and simply pasting it back in - again, no changes.
I'm using VS.NET 2003.

This has been pretty annoying for a while, but now it is out of control, frequently showing a hundred errors messages in 3 or more forms, all of
which have to be checked out and un-checked out before the app will compile.
This really derails the train of thought, as you can imagine!
Any suggestions would be greatly appreciated!

Nov 20 '05 #4
Peter,
as said, this the error will only show up very spuriously (sometimes not
for weeks, and then all of a sudden multiple times a day!), and it seems
like it only shows up on large projects, not on small ones. That means,
sorry, I cannot give you a simple expample.

We had this problem about half a year ago and cleaned up all the
Protected Withevents variables then. I'm sorry I cannot rebuild the
project with the state half a year ago.

It seems to have to do with Building a project (not *re*building) it,
since when you rebuild it the problem goes away.

Sorry I can't be of more help
Urs
Peter Huang wrote:
Hi Urs,

Thanks for posting in the community.

Based on my test, I can not reproduce the problem.
Here is my reproduce steps.
[ProjectB]
Imports System.Windows. Forms
Public Class BaseClass
Protected WithEvents fm As Form
Private str As String = "Test"
Public Property sk() As String
Get
Return str
End Get
Set(ByVal Value As String)
str = Value
End Set
End Property
End Class

[ProjectA]
[Class1.vb]
Public Class DerivedClass
Inherits ProjectA.BaseCl ass
Public Sub Test()
fm = New Form
fm.Show()
Me.sk = "Hello"
End Sub
Private Sub fm_Closing(ByVa l sender As Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles fm.Closing
MsgBox("fm_Clos ing")
End Sub
Private Sub fm_Click(ByVal sender As Object, ByVal e As
System.EventArg s) Handles fm.Click
MsgBox("Click")
End Sub
End Class

[Form1.vb]
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim o As New ProjectB.Derive dClass
o.Test()
End Sub

Also I have added a new property to ProjectA.BaseCl ass and press
Ctrl+Alt+B to build the solution, the event will fire again.

Can you build a reproduce sample as simple as possible as long as it can
reproduce the problem, and send to me by removing the "online" from my
email address?
I look forward to hearing from you.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Nov 20 '05 #5
Rigga,
did you check if you have this Protected WithEvents scenario I
described? Since we got rid of those constructs and consequently avoid
them, we never had this problem again.
Urs

Rigga wrote:
Hi Eric, Urs, Peter.

I am working on a large solution with several large project included into
it. I also am connected to Visual Source Safe.

There are only two developers working on this solution, and both of us have
the same problem.. spurious errors in projects that we haven't even edited..
usually on forms.. but sometimes on a control inherited from Label..

The errors appear upon compilation, then if I check out the offending Form
or Class then comment out the line defining the object it claims to be
missing, then uncomment the same line, the problem goes away for a few more
compiles.. then re-appears..

It only seems to be a problem when the solutions gets above a certain size..
I have several other solutions that contain small projects, and the problem
never occurs there..

So I would guess it has something to do with the size of the solution..

Also it means it is extremely difficult to give a small reproduction of the
problem.

also several others are having the same problem.. see post in
microsoft.publi c.vsnet.ide on 05Feb2004 by Jeff Lindholm, title "Compile
Errors - only sometimes"

I can only re-iterate what Urs stated, and hope this problem goes away with
Whidbey!

Here's hoping,
Rigga.

"Eric G. Harrison" <er***********@ hotmail.com> wrote in message
news:68******** *************** ***********@mic rosoft.com...
We have a project with many other projects referenced (all of which are


referenced at the project level and are included in the solution).
Frequenly, if we make a change in project A (such as adding a property, or
even simply changing a line of code), a form in project B will then show 10
or more "object such-and-such is not defined". To fix this problem we check
out the form in project B and 90% of the time that fixes it (but nothing
changes in the code or on the form - if we check the code in, our repository
just ignores it since the code hasn't changed!). The other 10% of the time,
we solve the problem but cutting a line out of the "Windows Form Designer
Generated code" section where all the objects are declared (Friend
Withevents...") and simply pasting it back in - again, no changes.
I'm using VS.NET 2003.

This has been pretty annoying for a while, but now it is out of control,


frequently showing a hundred errors messages in 3 or more forms, all of
which have to be checked out and un-checked out before the app will compile.
This really derails the train of thought, as you can imagine!
Any suggestions would be greatly appreciated!



Nov 20 '05 #6
Peter, obviously othesr are running into this problem and have posted more information. Thanks for your quick reply!
Nov 20 '05 #7
Urs, we're not using exactly that construct, but we are using some components from Infragistics that are using Friend WithEvents in their declarations. Other than that, it sounds like the same problem. Later tonight we're going to take the form that we're inheriting from and move it into the same project as the derived classes

Thanks again, and I'm glad to see all the other responses - this is obviously a real problem!
Nov 20 '05 #8
Hi,

Thanks for posting in the community.

I am researching the issue, if I have new information, I will update with
you ASAP.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #9
Hi,

I still can not reproduce the problem I also try to add my solution to the
Visual source safe.

To isolate the problem, I think you may try to re create a new solution and
add the projects and rebuild the project one by one to the solution to see
if the problem persists.

Also you may try to copy the whole solution to another machine to see if
the problem persists.

You may also take a look at the build log in the OutPut panel, to see if
all of the projects build successful.

Please try my suggestion and let me know the result.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6460
by: Dmitry | last post by:
Hello, Sometimes on js code execution Mozilla 1.5 prints in JS concole the following error: "Error: fn is not defined" where "fn" is the function name surely defined _before_ the line that produces error. The fn body and error line both live in the same *.js file.
13
3119
by: gary | last post by:
Hi, We all know the below codes are dangerous: { int *p = new int; delete p; delete p; } And we also know the compilers do not delete p if p==NULL. So why compilers do not "p = NULL" automatically after programs do "delete p"?
11
9872
by: MLH | last post by:
I copied the following code snippet from A97 HELP. Am getting an error at compile time suggesting there's a problem with the first line (compile error, user-defined type not defined). It is likely that I've left something out. Doesn't seem to like Dim dbs as Database - that's what's hi-lited after acknowledging the error. Can you see anything wrong with that syntax? Dim dbs As Database, rst As Recordset Dim rstEmployees As Recordset,...
6
1734
by: david | last post by:
When I compile a window form client for web service, there is error message as follows: Program 'D:\usr\winVBcontrol\WinClient4WebServiceFileCS\obj\Debug\WinClient4WebServiceFileCS.exe' does not have an entry point defined Notice: I create a solution (perhaps for VB). In the sulotion, I created win form clients for web service with VB in a window form VB project and they worked fine. Now the current one is developed in a C# project under...
2
2070
by: Yannick Turgeon | last post by:
Hello, I'm using A97 (french version) on XP (english version). Since this afternoon, all the Access built-in french-equivalent function are generating a "Sub or Function not defined" error. An exemple: IIf(1=1,"bob","joe") is ok but it's french equivalent VraiFaux(1=1,"bob","joe") generates the error. It's not linked to the PC since other applications with this function
3
4755
by: KelHemp | last post by:
I have compiled data from 13 tables, one for each month of the year that hold 45 fields each, and another for employee information, that holds 16 fields. The database is intended to record hours and special pay withholdings. I split up the report into First Half and Second Half, as the paper version we use currently does. My report First Half let me create control boxes for each field I wanted to include, however, when I try printing or...
2
9518
by: =?Utf-8?B?UmFscGggSQ==?= | last post by:
OK, Dell inspirion 9300 - 100 gb hd partitioned into 3 drives C: OS 10 gb D: Programs 20 gb E: Data 70 GB Page Files 0 on C: 4092 on D: 3070 on E:
6
2567
by: newholborn | last post by:
Hi everyone. I have some questions, which should be rather easy to reply, but as I am working on PHP, JavaScript, XML, CSS, Photoshop and other stuff at the same time, my head, which is about to explode, would be grateful for any answers :). 1) I have created a simple navigation system which loads local html documents on a main big DIV element in my page. Although greek language (iso-8859-7) is working outside that DIV, inside it i see...
2
3132
by: jmike | last post by:
I'm using some legacy code that has a user-defined exception in it. The top level program includes this line from TestRunError import * It also imports several other modules. These other modules do not explicitly import TestRunError. TestRunError is raised in various places throughout the modules.
0
9865
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10934
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10609
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7853
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7025
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4085
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3140
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.