it seem, after looking with reflector, that the sendasync(smtpclient) with the object token in the parameter of the function is byval
does it make sense to try to release the attachment in the callback function?
everywhere people(myself included) seem to do sendasync(mailmessage,mailmessage)
and in the callback(SendCompletedCallback) doing something like:
Dim mail As Net.Mail.MailMessage = CType(e.UserState, Net.Mail.MailMessage)
For i = (mail.Attachments.Count - 1) To 0 Step -1
mail.Attachments(i).Dispose()
Next
mail.Dispose()
but since the sendasync is byval, that should not dispose the original attachment, right?
in my case, attachment are memorystream