Closed Anandir closed 8 years ago
Can you paste the full exception message? I'm on OS X so can't test it myself at the moment.
My system is in italian, but I think I've done a quite correct translation (according to similar exceptions).
NBug.Core.Util.Exceptions.NBugConfigurationException was unhandled
HResult=-2146233088
Message=Cannot parse the connection string supplied. The connection string may be malformed: Type=Mail;CustomBody=My fancy body.;CustomSubject=Crash Report;From=from@example.com;FromName=Bugreport - Me & my friends;Password=mysecredpassword;Port=587;Priority=Low;SmtpServer=mailserver.example.com;To=me@example.com;UseAttachment=True;UseAuthentication=True;UseSsl=False;Username=mymailusername;
MisconfiguredProperty=""
Source=NBug
StackTrace:
in NBug.Core.Util.ConnectionStringParser.Parse(String connectionString)
in NBug.Settings.AddDestinationFromConnectionString(String connectionString)
in 2.Insert(TKey key, TValue value, Boolean add) in System.Collections.Generic.Dictionary
2.Add(TKey key, TValue value)
in NBug.Core.Util.ConnectionStringParser.Parse(String connectionString)
InnerException:
Ok it's a documentation issue rather than a parser issue. You can't have semicolon inside the connection strings except for separators. Replace &
with &\;
or just use the word and
and try.
Meanwhile I'll improve the docs on this.
Good :). It wasn't something "big", but a minor thing. Thanks a lot for your time/work!
:+1:
I think this issue can be closed? The exception message is clear: Cannot parse the connection string supplied. The connection string may be malformed.
Or should the program check for a ; character and show a specific message like
The connection string {0} contains a ; character please remove this character from the connection string.
For me yes.
Anandir you have that power! Please close this issue!
Ups! Immediately !
I've found a pretty funny bug inside the ConnectionStringParser and I'm not sure if there is a "elegant way" for solve it. If in the connection string you have an HTML entity you got a NBugConfigurationException.
For example: NBug.Settings.AddDestinationFromConnectionString("Type=Mail;CustomBody=My fancy body.;CustomSubject=Crash Report;" + "From=from@example.com;FromName=Bugreport - Me & my friends;" + "Password=mysecredpassword;Port=587;Priority=Low;SmtpServer=mailserver.example.com;To=me@example.com;" + "UseAttachment=True;UseAuthentication=True;UseSsl=False;Username=mymailusername;");
is a valid connection string, but it doesn't work because of the & in the FromName field. Maybe in the .conf file it work, but not if you put in the code directly and I'm not sure it's safe put the entities in the "normal" form (like & for the &).
Thanks a lot in advance!