Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

variable problems - Help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AMP - 10 Mar 2008 18:10 GMT
Hello,
I have been working on a project with no problems for a few months
now.
All of a sudden I am getting errors when trying to declare a
variable.
I Have the following code:
           string DataToParse = "";
           string Ra = "";
           DataToParse = File.ReadAllText(UploadedFileName);
           Ra = File.ReadAllText(UploadedFileName);

The first variable "DataToParse" I have been using for months now.No
problem
The second one, Ra, I get "The name 'Ra' does not exist in the
current
context"
I have tried to rename it, I tried just setting it to a random
string.
(many times)
I even tried shutting down the computer.
When I put my curser over it when not debugging it shows as a local
variable, but during debugging it doesnt show anything when i put the
cursor over it.
This is freaking me out.
What can be the problem?
Thanks
Mike
Peter Duniho - 10 Mar 2008 18:21 GMT
> All of a sudden I am getting errors when trying to declare a
> variable.

This statement implies a compiler error.

But this statement:

> [...]
> When I put my curser over it when not debugging it shows as a local
> variable, but during debugging it doesnt show anything when i put the
> cursor over it.

Implies that you can in fact compile the code.

So, the first thing is for you to be more clear in your question.

Now, assuming the first implication is incorrect and all you're really  
seeing is a problem while debugging, my first thought is that you may be  
debugging an optimized build (i.e. "Release" version), in which the  
variable has been optimized away.  I've never run into this with C#, so I  
can't say for sure that this is a real possibility.  But I've seen it in  
other environments, and it seems like the most likely explanation for what  
I _think_ you're describing.

If that doesn't address your question, I suggest doing both of two things:  
try to state your issue more clearly, and create a concise-but-complete  
sample of code that reliably demonstrates the problem (including, of  
course, clear instructions as to what to do with the sample).

"Concise-but-complete" means we can compile the code without any  
addditional effort ("complete") and there's nothing in the code that's not  
absolutely required for demonstrating the issue ("concise").

Pete
AMP - 10 Mar 2008 19:25 GMT
On Mar 10, 1:21 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:

Pete,
Thanks,
It was  because I was in a Release version. I changed it to Debug and
it works.
Thanks Again,
Mike
> > All of a sudden I am getting errors when trying to declare a
> > variable.
[quoted text clipped - 30 lines]
>
> Pete

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.