TypeLoadException was unhandled

Dec 9, 2011 at 9:17 PM

Hello Everyone,

I'm using WINCE 6.0 on ARM based computer. I'm trying to execute a very simple sending email code, but I'm running into this problem using CF 2.0 or 3.5:     

using Higuchi.Net.Smtp;

using Higuchi.Net.Pop3;

using Higuchi.Net.Mail;

        void email(string SmtpServer, string smtpuser, string smtppw, string FromEmailAddress, string ToEmailAddress, string subject, string body)
        {
            //Send mail
            
            SmtpClient cl = new SmtpClient();
            cl.ServerName = SmtpServer;
            cl.UserName = smtpuser;
            cl.Password = smtppw;
            cl.Port = 2525;
            cl.Ssl = true;
            SmtpMessage mg = new SmtpMessage();
            mg.Subject = subject;
            mg.BodyText = body;
            mg.From = FromEmailAddress;
            mg.To.Add(new MailAddress(ToEmailAddress));

            try { cl.SendMail(mg); }
            catch
            {
                MessageBox.Show("SMTP Timeout!", "SMTP Error!", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }

Whenever I call this function, I get this error message description:
The version of the assembly System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089 cannot be loaded by this version of the Microsoft .NET Compact Framework.
System.TypeLoadException was unhandled  Message="The version of the assembly System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089 cannot be loaded by this 
version of the Microsoft .NET Compact Framework."  StackTrace: at SmartDeviceProject1.Email.menuItem4_Click(Object sender, EventArgs e) 
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.Menu.ProcessMnuProc(Control ctlThis, WM wm, Int32 wParam, Int32 lParam) 
at System.Windows.Forms.Form.WnProc(WM wm, Int32 wParam, Int32 lParam) 
at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)       
at System.Windows.Forms.Application.Run(Form fm)       
at SmartDeviceProject1.Program.Main()

I've tried everything. I even commented out everything except for SmtpClient cl = new SmtpClient(); and still get the same error. This is using the lastest dll under Downloads. Does anybody
know what I'm doing wrong?

Thanks!

 

Coordinator
Dec 12, 2011 at 4:36 AM

Perhaps framework version issue.
I only check this library work on general .net framework.
Since you can get source code,please recompile C#Mail for your environment(compact framework?) and use it.
It may solve your problem.