title: why get "Cannot read from a closed TextReader"
body: <p>i have a SQL CLR function that return the Json from a Web Api, here es my code </p>
  
  <pre><code>[Microsoft.SqlServer.Server.SqlFunction]
  public static SqlString Funcion()
  {
      SqlString document;
      HttpWebRequest request = (HttpWebRequest)WebRequest.Create("URL");
      request.Method = "GET";
      request.ContentLength = 0;
      request.Credentials = CredentialCache.DefaultCredentials;
      HttpWebResponse response = (HttpWebResponse)request.GetResponse();
      Stream receiveStream = response.GetResponseStream();
      StreamReader readStream = new StreamReader(receiveStream);
      document = (SqlString)readStream.ReadToEnd();
      return document;
  }
  </code></pre>
  
  <p>i delete the next code because i think that it was the problem</p>
  
  <pre><code>     //response.Close();
      //readStream.Close();
  </code></pre>
  
  <p>but i still gettin the error</p>
  
  <pre><code>System.ObjectDisposedException: Cannot read from a closed TextReader System.ObjectDisposedException: 
  at System.IO.__Error.ReaderClosed()
  at System.IO.StreamReader.ReadToEnd()
  at UserDefinedFunctions.Funcion()
  </code></pre>
  
  <p>i inspect the dll withILSpy and my code looks different
  <a href="https://i.stack.imgur.com/Rl7o6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rl7o6.png" alt="enter image description here"></a> 
  someone can helpme please. i tried this code in an application cosole to write the result in a file and works perfectly</p>