I have tired using statement after going through the links in stackoverflow but still couldnt figure the exact solution.
using (MemoryStream stream = new MemoryStream(textAsBytes))
{
using (HttpResponseMessage httpResponseMessage = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StreamContent(stream)
})
{
httpResponseMessage.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
FileName = "main-theme.scss"
};
httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("text/css");
ResponseMessageResult responseMessageResult = ResponseMessage(httpResponseMessage);
return responseMessageResult;
}
}
getting the following error
CA2000 In method 'GetStyleSheet()', object 'new HttpResponseMessage()' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'new HttpResponseMessage()' before all references to it are out of scope.