dimanche 1 mars 2015

SMTP Client gives the errror 'Instance names used for writing to custom counters must be 127 characters or less'

I'm getting a strange error trying to send an email a c# .NET 3.5 winforms application. When I start a new SMTPClient like this:



using System.Net;
using System.Net.Mail;

SmtpClient client = new SmtpClient();


I get this error:



System.InvalidOperationException occurred Message=Instance names used for writing to custom counters must be 127 characters or less. Source=System StackTrace: at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName, PerformanceCounterInstanceLifetime lifetime) InnerException:



I get the same line no matter how I start the new SMTPClient, e.g.


SmtpClient client = new SmtpClient("smtp.gmail.com", 587);


I read that this might have to do with a long directory structure but I can't change that. I also read it might be to do with unit testing, but I'm not doing any kind of unit testing.


Is there a way to fix this?


Aucun commentaire:

Enregistrer un commentaire