Symptoms
Whenever a newly altered workflow (altered to have a new email event) was executed it would through the following error upon reaching that email event:
Method not found: 'Void SourceCode.Workflow.Common.SmtpMail.Send(System.Net.Mail.MailMessage, SourceCode.KO.K2LoggerProxy, System.String)'
That error was being caught by workspace.
Diagnoses
Using justdecompile I cracked open 4 different copies of the SourceCode.Workflow.Common.dll and here are the relevant excerpts:
My 4.6.7 VM
----------------------
public static void Send(MailMessage mailMessage, K2LoggerProxy logger)
{
using (WindowsImpersonationContext windowsImpersonationContext = WindowsIdentity.Impersonate(IntPtr.Zero))
{
string str = SmtpMail.LocateSmtpConnectionString(mailMessage.From.Address)
if (!string.IsNullOrEmpty(str))
{
SmtpConnection smtpConnection = new SmtpConnection(str)
try
{
My 4.6.11 VM
--------------------------
public static void Send(MailMessage mailMessage, K2LoggerProxy logger)
{
SmtpMail.Send(mailMessage, logger, null)
}
public static void Send(MailMessage mailMessage, K2LoggerProxy logger, string SmartObjectServerConnectionString)
{
using (WindowsImpersonationContext windowsImpersonationContext = WindowsIdentity.Impersonate(IntPtr.Zero))
{
string str = SmtpMail.LocateSmtpConnectionString(mailMessage.From.Address)
if (!string.IsNullOrEmpty(str))
{
SmtpConnection smtpConnection = new SmtpConnection(str)
try
{
Client's client Machine
---------------------------
public static void Send(MailMessage mailMessage, K2LoggerProxy logger)
{
SmtpMail.Send(mailMessage, logger, null)
}
public static void Send(MailMessage mailMessage, K2LoggerProxy logger, string SmartObjectServerConnectionString)
{
using (WindowsImpersonationContext windowsImpersonationContext = WindowsIdentity.Impersonate(IntPtr.Zero))
{
string str = SmtpMail.LocateSmtpConnectionString(mailMessage.From.Address)
if (!string.IsNullOrEmpty(str))
{
SmtpConnection smtpConnection = new SmtpConnection(str)
try
Client's Host Server
---------------------
public static void Send(MailMessage mailMessage, K2LoggerProxy logger)
{
using (WindowsImpersonationContext windowsImpersonationContext = WindowsIdentity.Impersonate(IntPtr.Zero))
{
string str = SmtpMail.LocateSmtpConnectionString(mailMessage.From.Address)
if (!string.IsNullOrEmpty(str))
{
SmtpConnection smtpConnection = new SmtpConnection(str)
try
The workflows were being developed on a client machine with 4.6.10 client tools and being deployed to a 4.6.7 machine. So the assemblies being used to form the code for the email events where looking at a 4.6.10 version of the assembly, which contains the 'SmtpMail.Send' and then getting deployed to a K2 server that had no understanding of this method.
Resolution
The user upgraded his K2 server and client machines to 4.6.11.