Why i'm getting exception: Closed stream access exception while saving Bitmap ? Where does it come from ? What Bitmap ? Why i can't catch the exception ?


i have code in bottom label11 assign text:

private void getissuesnumber()          {              using (webclient client = new webclient())              {                  client.downloadfile("https://test/issues/26", @"c:\test\issues.html");                  client.downloadfile("https://test/issues", @"c:\test\main.html");              }                  using (streamreader reader = new streamreader(@"c:\test\issues.html"))              {                  try                  {                      string line = string.empty;                      while ((line = reader.readline()) != null)                      {                          if (line.contains("comments"))                          {                              if (line.any(char.isdigit))                              {                                  this.line = line;                                  numberofcomments = int32.parse(this.line.substring(17, 2));                              }                          }                          if (line.contains("opened this"))                          {                              opened = line;                              gettime(opened);                          }                                                }                  }                  catch (exception err)                  {                      error = err.tostring();                  }              }              label2.text = numberofcomments.tostring();                using (streamreader reader = new streamreader(@"c:\main\main.html"))              {                                        string line = string.empty;                      while ((line = reader.readline()) != null)                      {                          if (line == null || line != "")                          {                              if (line.contains("open"))                              {                                  issuesopened = line;                                  label10.text = issuesopened.tostring();                              }                              if (line.contains("closed"))                              {                                  try                                  {                                      issuesclosed = line;                                      label11.text = issuesclosed.tostring();                                  }                                  catch (exception err)                                  {                                      error = err.tostring();                                  }                              }                          }                      }                                                  }              }

if don't assign label11 not using ok.

if don't use line: 

label11.text = issuesclosed.tostring();

then when running program see label11

but if i'm using line assigning label11 see when running program is:

what bitmap ? don't use bitmap/s in code.

why can't catch exception using try , catch ? didn't stop on catch part used breakpoint.

i closed shut down whole visual studio , tried run on , still same exception on label11.

i dragged form1 designer 2 new labels: label10 , label11 10 there no problems 11 see exception.

in variable line when label11.text.....in variable line there is:       15 closed

there spaces before 15.

what variable issuesclosed? i don't see defined anywhere.

have looked inside c:\main\main.html? line "closed stream access exception..." embedded inside somewhere?



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user