474,052 Members | 2,527 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
25 2258
John A Grandy wrote:
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.


Which exceptions? (type, message, stacktrace, code snippets please!)

QuickWatch sometimes does silly things. But it would be interesting to
see these exceptions and the code that generates them.

Max
Jun 19 '06 #11
Well, as I mentioned above, it's things like :

using System.Data.Sql Client;

SqlConnection sqlConnection = new
SqlConnection(" server=SERVER1; database=DB1;TR USTED_CONNECTIO N=true");
sqlConnection.O pen();
if (sqlConnection. State.ToString( ) = "open")
{
....
....
}

If I QuickWatch over sqlConnection.S tate.ToString() I receive

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

"Markus Stoeger" <sp******@gmx.a t> wrote in message
news:eB******** ********@TK2MSF TNGP05.phx.gbl. ..
John A Grandy wrote:
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.


Which exceptions? (type, message, stacktrace, code snippets please!)

QuickWatch sometimes does silly things. But it would be interesting to see
these exceptions and the code that generates them.

Max

Jun 19 '06 #12
Is there any particular reason not to use enumeration?

if(sqlConnectio n.State == ConnectionState .Open)
{
....
}

John A Grandy wrote:
Well, as I mentioned above, it's things like :

using System.Data.Sql Client;

SqlConnection sqlConnection = new
SqlConnection(" server=SERVER1; database=DB1;TR USTED_CONNECTIO N=true");
sqlConnection.O pen();
if (sqlConnection. State.ToString( ) = "open")
{
...
...
}

If I QuickWatch over sqlConnection.S tate.ToString() I receive

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

"Markus Stoeger" <sp******@gmx.a t> wrote in message
news:eB******** ********@TK2MSF TNGP05.phx.gbl. ..
John A Grandy wrote:
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.

Which exceptions? (type, message, stacktrace, code snippets please!)

QuickWatch sometimes does silly things. But it would be interesting to see
these exceptions and the code that generates them.

Max


Jun 20 '06 #13
This isn't a code-design exercise. This is a huge project written by
someone else. They already used .ToString() in thousands of places,
thousands of contexts. Somehow, ToString has stopped being recognized.

I've tried de-installing, re-installing .NET Framework 1.1.4322 , to no
avail.
"Sericinus hunter" <se*****@flash. net> wrote in message
news:CG******** ***********@new ssvr11.news.pro digy.com...
Is there any particular reason not to use enumeration?

if(sqlConnectio n.State == ConnectionState .Open)
{
...
}

John A Grandy wrote:
Well, as I mentioned above, it's things like :

using System.Data.Sql Client;

SqlConnection sqlConnection = new
SqlConnection(" server=SERVER1; database=DB1;TR USTED_CONNECTIO N=true");
sqlConnection.O pen();
if (sqlConnection. State.ToString( ) = "open")
{
...
...
}

If I QuickWatch over sqlConnection.S tate.ToString() I receive

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

"Markus Stoeger" <sp******@gmx.a t> wrote in message
news:eB******** ********@TK2MSF TNGP05.phx.gbl. ..
John A Grandy wrote:
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.
Which exceptions? (type, message, stacktrace, code snippets please!)

QuickWatch sometimes does silly things. But it would be interesting to
see these exceptions and the code that generates them.

Max


Jun 20 '06 #14
John A Grandy wrote:
If I QuickWatch over sqlConnection.S tate.ToString() I receive

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


You can't use the Watch window on methods. It only works for fields and
properties (at least in VS2003, dunno about VS2005).

If you get real (runtime) exceptions, please post their type, message
and stacktrace.

Max
Jun 20 '06 #15


Hi, Just wondering if you found the answer to the .Tostring problem,
Currently i am having the same problem.
If i try the same code in vb instead of c# it works fine. Appear to be
affecting c# only.

*** Sent via Developersdex http://www.developersdex.com ***
Feb 4 '07 #16
D W

I'd love to see an answer posted for this issue too. I'm having the
exact same problem in VS2003.

Here's the line:

cmd.Parameters. Add("@DestDB", newCompany.ToSt ring() + RequestYear);

It's a very simple concat that's been working since before I started
with this company. In fact, it was working about an hour ago. The
project compiles, and I even get a "ToString" option from Intellisense,
but I still get the not recognized error at runtime.

"newCompany " is an enum type that has a verifiable value before trying
to execute this line. "RequestYea r" is a string representing a 4 digit
year.

*** Sent via Developersdex http://www.developersdex.com ***
Sep 28 '07 #17
On Sep 28, 3:26 pm, D W <gusar...@hotma il.comwrote:
I'd love to see an answer posted for this issue too. I'm having the
exact same problem in VS2003.

Here's the line:

cmd.Parameters. Add("@DestDB", newCompany.ToSt ring() + RequestYear);

It's a very simple concat that's been working since before I started
with this company. In fact, it was working about an hour ago. The
project compiles, and I even get a "ToString" option from Intellisense,
but I still get the not recognized error at runtime.

"newCompany " is an enum type that has a verifiable value before trying
to execute this line. "RequestYea r" is a string representing a 4 digit
year.
What error do you get at runtime *not* in the debugger? I suggest we
ignore the debugger for the moment, as the VS2003 debugger in
particular had some issues.

Jon

Sep 28 '07 #18
D W

I replied to this a while ago, but don't see it here now.

To reiterate:

I was having other runtime issues not involving this one, so I can't say
that it was strictly a debugger issue...though I believe that it was.

Here's what I did instead that worked:

string Company = System.Convert. ToString(newCom pany);
string Year = System.Convert. ToString(Reques tYear);

cmd.Parameters. Add("@DestDB", System.String.C oncat(Company + Year));
*** Sent via Developersdex http://www.developersdex.com ***
Sep 28 '07 #19
D W
Sorry about that.

I never specified that I wanted to email you. Hopefully, you don't get
this one too.

I didn't see anything in the FAQ about it either. Did I miss something?


*** Sent via Developersdex http://www.developersdex.com ***
Sep 28 '07 #20

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

Similar topics

3
1191
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
1763
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
2153
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
19340
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
3955
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
6214
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
4232
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
2753
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
10365
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
12178
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
11624
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
12059
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
10345
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...
0
7890
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
5434
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
4954
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3994
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.