Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Code analysis false positive?

$
0
0
           Using message As New MailMessage(safeSender, New MailAddress("accounts@grasshoppersoccer.com.au", "Accounts")) With {.IsBodyHtml = True, .Subject = "New invoice"}
                message.Body = String.Format(Globalization.CultureInfo.CurrentCulture, "A new invoice from company is avaiable at {0}", url.ToString)
                Using client As New SmtpClient()
                    client.Port = 26
                    client.Send(message)
                End Using
            End Using

I have the above code twice in a class with little only differeing by email, subject and body, yet code analysis tells me that i need to dispose of mailmessage in only one of them.
It woulde seem that i am disposing of mailmessage, am i missing somthing?
Thanks


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>