Hi,
I noticed something weird with latest mail.dll (3.0.21231.1234) from nuget package -- is that an expected behavior?
If the instance of Smtp class is created and viewed in Visual Studio - Quick Watch, before Connect(...) is called, then the call to synchronous Connect method fails with "Command in progress. Make sure you await async methods."
In the below console C# program targeting .NET 4.8 FW, place a breakpoint on assignment to SendTimeout and when stopped on this breakpoint, either view the instance of smtp variable in VS' QuickWatch or view smtp.CommandGuard in QuickWatch.
Then, continue execution of the program.
Connect call fails with "Command in progress. Make sure you await async methods." exception.
The same does not appear to happen if I do not view the smtp instance in VS' QuickWatch, but it is quite inconvenient, not being able to view Smtp class instances under debugger.
I did not experiment with POP3/IMAP the same way.
Call Stack:
Mail.dll!Limilabs.Client.ClientBase.000_() Unknown
Mail.dll!Limilabs.Client.ClientBase.0_00() Unknown
Mail.dll!Limilabs.Client.ClientBase.CommandGuardToken.CommandGuardToken(Limilabs.Client.ClientBase client = {Limilabs.Client.SMTP.Smtp}) Unknown
Mail.dll!Limilabs.Client.ClientBase.CommandGuard.get() Unknown
Mail.dll!Limilabs.Client.SMTP.Smtp.SendCommand(string command = "EHLO [10.43.20.133]", bool throwException = false) Unknown
Mail.dll!Limilabs.Client.SMTP.Smtp.__00(______0_0_ _0 = __0, string __ = "[10.43.20.133]") Unknown
Mail.dll!Limilabs.Client.SMTP.Smtp._0() Unknown
Mail.dll!Limilabs.Client.SMTP.Smtp.GetServerGreeting() Unknown
Mail.dll!Limilabs.Client.ClientBase.Connect(string host = "mail.epicor.net", int port = 0x00000019, bool useSSL = false) Unknown
ConsoleApp10.exe!ConsoleApp10.Program.Main(string[] args = {string[0x00000000]}) Line 26 C#
using System;
using Limilabs.Client.SMTP;
namespace ConsoleApp10
{
class Program
{
static string server = "my.mail.server.name";
static int port = 25;
static int Main(string[] args)
{
using (var smtp = new Smtp())
{
smtp.Configuration.AllowPartialSending = true;
// <-- Place a breakpoint here
smtp.SendTimeout = TimeSpan.FromSeconds(10);
// Select the text below and view it in VS - Debug-Quick Watch
// smtp.CommandGuard
smtp.Connect(Program.server, Program.port, false);
return 0;
}
}
}
}