ReleaseHandleFailed Exception
I have just got the following bloody MDA exception on a rather simple little program:
A SafeHandle or CriticalHandle of type 'Microsoft.Win32.SafeHandles.SafeCapiHashHandle' failed to properly release the handle with value 0x004E48C0. This usually indicates that the handle was r开发者_StackOverflow中文版eleased incorrectly via another means (such as extracting the handle using DangerousGetHandle and closing it directly or building another SafeHandle around it.)
I have never seen anything like this. My program code is:
public partial class SmsEditorForm : Form
{
public SmsEditorForm()
{
InitializeComponent();
}
private void SmsEditorForm_Load(object sender, EventArgs e)
{
using (var ents = new TemplateEntities())
{
templateCombo.DataSource = ents.NotificationTemplates.OrderBy(nt => nt.TemplateName).ToList();
jobCardCombo.DataSource = ents.JobCards.Where(jc => !jc.JobDeleted && !jc.Archived).ToList();
}
}
private void smsText_TextChanged(object sender, EventArgs e)
{
charCountLabel.Text = smsText.Text.Trim().Length.ToString();
}
private void templateCombo_SelectedIndexChanged(object sender, EventArgs e)
{
using (var ents = new TemplateEntities())
{
smsText.Text = ents.NotificationTemplates.Single(nt => nt.TemplateId == (int) templateCombo.SelectedValue).ExternalRecipientSms;
}
}
}
Looks like a problem in your SMS library. In particular, whatever part of the code uses SafeCapiHashHandle
(this is an encryption handle, so, e.g., using a web service over SSL would cause this).
精彩评论