473,840 Members | 1,552 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ToString() does not exist ... anywhere !

In .NET v1.1.4322 , in a VS.NET application , has anyone ever run into the
bizarre situation where at runtime .NET believes that the ToString() method
does not exist ...

Sometimes this problem will show up as a runtime exceptions, sometimes this
problem will only be clear via QuickWatch in Debug mode

But the error message is always identical :

"error: '{object name}.ToString' does not exist:"

It could be

System.Data.Sql Connection.SqlC lient.State.ToS tring()

or it could be

Application["key name"].ToString()

or a variety of other uses of the ToString() method ...

I've tried rebuilding , restarting the machine ... but the problem
continues.

This is the strangest behavior I have ever encountered

Jun 15 '06 #1
25 2235
Nope, can't say I have experienced this or ever heard of it even.

"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:uX******** ******@TK2MSFTN GP04.phx.gbl...
In .NET v1.1.4322 , in a VS.NET application , has anyone ever run into the
bizarre situation where at runtime .NET believes that the ToString()
method does not exist ...

Sometimes this problem will show up as a runtime exceptions, sometimes
this problem will only be clear via QuickWatch in Debug mode

But the error message is always identical :

"error: '{object name}.ToString' does not exist:"

It could be

System.Data.Sql Connection.SqlC lient.State.ToS tring()

or it could be

Application["key name"].ToString()

or a variety of other uses of the ToString() method ...

I've tried rebuilding , restarting the machine ... but the problem
continues.

This is the strangest behavior I have ever encountered

Jun 15 '06 #2
"John A Grandy" <johnagrandy-at-yahoo-dot-com> ha scritto nel messaggio

"error: '{object name}.ToString' does not exist:"

It could be

System.Data.Sql Connection.SqlC lient.State.ToS tring()

or it could be

Application["key name"].ToString()

or a variety of other uses of the ToString() method ...

I've tried rebuilding , restarting the machine ... but the problem
continues.


Can't you debug this?
Jun 15 '06 #3
"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:uX******** ******@TK2MSFTN GP04.phx.gbl...
<snip>
But the error message is always identical :

"error: '{object name}.ToString' does not exist:"


Quick checklist
Typo?
Did you remember the parens?

Bill
Jun 16 '06 #4
Well, neither of the 2 lines you are showing look valid to me; the first has
the namespace knackered, and doesn't seem to involve an instance; the second
(assuming System.Windows. Forms.Applicati on) simply doesn't have a static
indexer.

QuickWatch will allow these as lines, but they will report error - simply
because they don't exist; I'd be more interested in the runtime exceptions,
as I don't think that code can compile.

Are you sure the problem isn't the code? Perhaps calling .ToString() on some
null objects? If you can get as far as runtime, then (assuming it isn't
reflection) it knows it exists. Have you overridden the ToString() method
and screwed it up, perhaps?

Marc
Jun 16 '06 #5
Ok, this is a production project that was working fine. It somehow
"entered" a state where somehow .NET is reporting that the .ToString()
method does not exist on various classes.

ToString() is not overriden anywhere in the project.

There was a typo: I meant

System.Data.Sql Client.SqlConne ction con = new
System.Data.Sql Client.SqlConne ction();
con.State.ToStr ing();

QuickWatch on con.State.ToStr ing() gives the error "error: '{object
name}.ToString' does not exist:"

Also, this is an ASP.NET app , so the intrinsic Application object is an
instance of the HttpApplication State class

QuickWatch can be performed on Application[{key-name}] with no problem.

But QuickWatch on Application[{key-name}].ToString() gives the errror
"error: '{object name}.ToString' does not exist:"

"Marc Gravell" <ma**********@g mail.com> wrote in message
news:u$******** ******@TK2MSFTN GP05.phx.gbl...
Well, neither of the 2 lines you are showing look valid to me; the first
has the namespace knackered, and doesn't seem to involve an instance; the
second (assuming System.Windows. Forms.Applicati on) simply doesn't have a
static indexer.

QuickWatch will allow these as lines, but they will report error - simply
because they don't exist; I'd be more interested in the runtime
exceptions, as I don't think that code can compile.

Are you sure the problem isn't the code? Perhaps calling .ToString() on
some null objects? If you can get as far as runtime, then (assuming it
isn't reflection) it knows it exists. Have you overridden the ToString()
method and screwed it up, perhaps?

Marc

Jun 19 '06 #6
You have to over ride ToString(). It is completely virtual. Hope that
helps.
Jun 19 '06 #7
I've never had to override ToString() before ... ever. I've seen the source
for dozens of high quality projects, and none of them includes overrides of
intrinsic ToString() methods on .NET framework classes.

Project was in a working state before -- it never threw any of these
exceptions.
"poojo hackma" <poojo.com/mail> wrote in message
news:e9******** ******@TK2MSFTN GP04.phx.gbl...
You have to over ride ToString(). It is completely virtual. Hope that
helps.

Jun 19 '06 #8
> I've never had to override ToString() before ... ever. I've seen the
source for dozens of high quality projects, and none of them includes
overrides of intrinsic ToString() methods on .NET framework classes.

Project was in a working state before -- it never threw any of these
exceptions.


I'm not 100%, but I think overriding ToString() started with VS 2005. Not
sure why some other things still work with ToString(); maybe they inherit
something else that has a built in version, but that's just a guess.
Jun 19 '06 #9
I'm on VS03 with .NET 1.1

"poojo hackma" <poojo.com/mail> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
I've never had to override ToString() before ... ever. I've seen the
source for dozens of high quality projects, and none of them includes
overrides of intrinsic ToString() methods on .NET framework classes.

Project was in a working state before -- it never threw any of these
exceptions.


I'm not 100%, but I think overriding ToString() started with VS 2005. Not
sure why some other things still work with ToString(); maybe they inherit
something else that has a built in version, but that's just a guess.

Jun 19 '06 #10

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

Similar topics

3
1178
by: rc | last post by:
is there anyway of creating a class so that when it is used as the object directly it does the toSting implementation ie public class recordID private mid as string public overloads function Tostring as string retrun mid end function end class so if i was using recorid anywhere then i dont get unable to convert to
2
1755
by: qazmlp | last post by:
I have a class containing 5-6 member data. I want to provide a toString() method as a part of this class to help the users to do tracing. const std::string& toString() { std::string objectData ; objectData = "memberData1=" + memberData1 ; objectData += " memberData2=" + memberData2 ; objectData += " memberData3=" + memberData3 ; objectData += " memberData4=" + memberData4 ;
1
2138
by: Bakunin | last post by:
Hi, I may be doing something dumb but.......I have been using the data access ent lib to do the HOL's. All is well. However I now want to add the data access functionality to my BTS2004 project, therefore requiring strong name key. When I try to compile the Data solution from source I get Namespace "Configuration" does not exist in Microsoft.practices.EnterpriseLibrary.Data are you missing..... The problem is that I am not. I can't...
101
19264
by: Sean | last post by:
Book I am reading says that Cstr() is best method for efficency and safety however it doesnt compare that method of the .ToString() method. Which is best. Thanks
7
3945
by: axkixx | last post by:
For whatever reason, I keep getting error of int.ToString() not existing. Why not? Has anyone encountered this problem before?
31
6179
by: Zytan | last post by:
Everything (er, every class) in C# has ToString() which is conveniently automatically invoked when using it in Debug.WriteLine() or in a string concatenation, etc. I made a struct, and I want to make a method to print out its data in a similar format. So, I did this: public struct MyStruct { public override string ToString() {
19
4215
by: Angus | last post by:
I have a socket class CTestClientSocket which I am using to simulate load testing. I create multiple instances of the client like this: for (int i = 0; i < 5; i++) { CTestClientSocket* pTemp = new CTestClientSocket(this, ip, port); pTemp->Connect(); m_collClients.push_back(pTemp);
11
441
by: etam | last post by:
Hi, why I can not override it? This line: virtual String^ ToString() override = Object::ToString; produces this error: cannot override base class method 'System::Object::ToString'. Why is that?
19
2728
by: Michael C | last post by:
If we have something like this object x = null; MessageBox.Show(x.ToString()) we get an error. That kindof makes sense but there is no reason the behaviour couldn't be to return an empty string. When we call x.ToString we are really calling a function like this: class Object
0
9861
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
9699
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10605
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
10665
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,...
0
10301
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9444
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7839
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
7023
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();...
0
5874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.