Click here to Skip to main content
Sign Up to vote bad
good
See more: Visual-StudioDebugger, +
Hi,
 
If my C# program throws an error, I debug it. But sometimes if I debug, one of this two things are happening:
  • My program is running fine when I debug it.
  • My program doesn't throw an error, but it doesn't return what I want.
I'm using VS 2012 Express For Windows Desktop.
 
For example, I've this code:
void Form1_Load(object sender, EventArgs e)
{
  HttpWebRequest hwr =   (HttpWebRequest)HttpWebRequest.Create("[URL TO ANY WEBSITE]");
            hwr.Proxy = new WebProxy("1.1.1.1");
            hwr.ProtocolVersion = HttpVersion.Version11;
            HttpWebResponse resp = (HttpWebResponse)hwr.GetResponse();
            System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
            string s = sr.ReadToEnd();
            sr.Close();
            richTextBox1.Text = s;
}
This throws an exception "Unable to connect to the remote server", because I don't have a proxy with 1.1.1.1 as IP. But if I debug, I don't get an error, just an empty rich text box.
 
What's the reason for this?
Thanks in advance.
Posted 31 Dec '12 - 4:00
ProgramFOX56.1K
Edited 31 Dec '12 - 4:40

Comments
Sergey Alexandrovich Kryukov - 31 Dec '12 - 12:00
Why would you use this IP then? —SA
ProgramFOX - 1 Jan '13 - 5:15
I was just interested whether it would work or not.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Arun Vasu 339
1 OriginalGriff 320
2 Sergey Alexandrovich Kryukov 315
3 Tadit Dash 221
4 CPallini 178
0 Sergey Alexandrovich Kryukov 9,955
1 OriginalGriff 7,589
2 CPallini 4,028
3 Rohan Leuva 3,422
4 Maciej Los 2,949


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 31 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid