Globally replace obsolete NLog.WarnException using regular expression

I’ve updated NLog ver 2.0 to 4.3.5. After this I’ve noticed a compiler warning that 
WarnException(msg,exc) is obsolete and should be replaced by Warn(exc,msg)

It could be globally replaced using regular expressions 

WarnException\((.*),(.*)\);
to 

Warn($2, $1);

See saved regex in https://regex101.com/r/kL8cR4/1

#nlog, #regex

FromToRange generic class

Quite often you need to return from method 2 values that describe the range, e.g. From/To or Min/Max. You could use standard MS classes Pair or Tuple https://msdn.microsoft.com/en-us/library/system.tuple.aspx. However the names of properties are not describe the meaning of the values.
So I am using own class FromToRange. It is done similar to Pair(from http://blog.o-x-t.com/2007/07/16/generic-pair-net-class/)

///<summary>
/// similar to Pair(from http://blog.o-x-t.com/2007/07/16/generic-pair-net-class/"
///See also  DateTimeRange ( https://github.com/MNF/CommonDotNetHelpers/blob/master/src/Dates/DateTimeRange.cs)
///</summary>

public class FromToRange
{
public T From { get; set; }
public T To { get; set; }

public FromToRange()
{
}

public FromToRange(T from, T to)
{
this.From = from;
this.To = to;
}
public override string ToString()
{
string sRet = String.Format("From {0} to {1}", From, To);
return sRet;
}
public override bool Equals(object obj)
{
if (this == obj) return true;
FromToRange pair = obj as FromToRange;
if (pair == null) return false;
return Equals(From, pair.From) && Equals(To, pair.To);
}

public override int GetHashCode()
{
return (From != null ? From.GetHashCode() : 0) + 29 * (To != null ? To.GetHashCode() : 0);
}

}

Changes in .psproj do not cause re-build

With PostSharp I  am using .psproj files 
If I did changes in .psproj file,  simple build didn’t recognize that the project has been changed and skipped the project.

 I had to manually Rebuild the project.

The fix is to change build type of the .psproj file from none to ‘content’ ( may be other types also will work)

#build, #postsharp

GMail considered “unsubscribe” at the end of email as spam

I’ve created a new email account @gmail.com to communicate with members of Russian Bards Songs Club . When I sent the first email to 15 people, it was rejected with the message:

Delivery to the following recipient failed permanently:

Technical details of permanent failure:

Message rejected.  See https://support.google.com/mail/answer/69585 for more information.

I’ve sent the same email to a single person and it was successful. I’ve wrote a small program to  vary some details and number of addressees, but the emails were continue to be blocked. I wasn’t able to send the email even to a single recipient. It means that gmail has more strict anti-spam criteria for smtp  clients then for gmail senders.

The email I was trying to send was written in Russian with some words in English and contained a few links. I didn’t know, what else make my email suspicious and submitted a question to Google. But they normally do not respond.

I’ve decided to test smaller emails to identify if particular part of content flags the email as spam. After a few attempts I found, that the trouble caused  the phrase

If you don’t want to receive more emails from us, please reply with the word ‘Unsubscribe’ in the subject.

I’ve seen multiple recommendations to include unsubscribe information in emails to bypass anti-spam filters. It seems that too many spammers started to add such sentences, that Google now consider it as a spam indication.

Maybe  they didn’t like that I have an instruction to unsubscribe via email instead of providing link to website.

For now, I removed the sentence from the email and finally was able to send it.

Update:

Couple weeks later I added a message “If you don’t want to receive emails any more, click on this link”( in Russian), but the actual URL contained the word “unsubscribe”. I’ve sent emails to 3 big groups of people(about 100 each). Two of them were sent successfully, but one was rejected(actually the first one).
I split the failed group in three smaller ones, and tried to send them. They were rejected again.

Additional annoyance was that “delivery failed” notifications were received slowly within 5 minutes, and initially I had an impression that some emails succeeded, and only some were rejected. However according to timestamp all emails were rejected at the same time.

Then I renamed the target URL to not use “unsubscribe” word, updated the link in email signature, and was able to send emails successfully.