提示错误:
检测到 CallbackOnCollectedDelegate
Message: 已在型別 'TaiHingFTP!TaiHingFTP.Ras+RasDialEvent::Invoke' 的記憶體回收委派上進行回呼。這樣可能導致應用程式無法運作、損毀或遺失資料。傳遞委派到 Unmanaged 程式碼時,必須由 Managed 應用程式讓它們保持運作,直到確定不會再呼叫它們為止。
网上说的 设置成全局变量我已经试过了。没有用。 连设置成不被垃圾回收机制处理我都使用了。。但是还是错误,只是报错的时间变长了using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;namespace TaiHingFTP
{    public partial class Mian : Form
    {
        private FTP_Oeration ftp_form;
        private  Ras.ConnectionNotify _connectionnotify=null;
        System.Threading.Thread _ftpUpload;
        public Mian()
        {
            InitializeComponent();
        }
        public void RasConnectNotify(string strNotify, int Connect)
        {
        }        private void TimeCheck_Tick(object sender, EventArgs e)
        {
            string time = DateTime.Now.ToString("HH:mm");            if (time == ConfigurationManager.AppSettings["Time"])
            {
                string[] url = ConfigurationManager.AppSettings["ftpIP"].Split(',');
                if (!Ras.CheckServeStatus(url))
                {
                    _connectionnotify = new Ras.ConnectionNotify(RasConnectNotify);
                   
                    FtpUpDown ftp = new FtpUpDown(_connectionnotify);
                    GC.KeepAlive(_connectionnotify);
                    
                    ftp.IsDowUpland = true;
                    _ftpUpload = new System.Threading.Thread(new System.Threading.ThreadStart(ftp.Connection));
                    _ftpUpload.IsBackground = true;
                    _ftpUpload.Start();
                }
                else
                {
                    FtpUpDown ftp = new FtpUpDown();
                    ftp.IsDowUpland = true;
                    ftp.FileUpload();
                }
            }
        }        private void TimePiece_Tick(object sender, EventArgs e)
        {
            string[] url = ConfigurationManager.AppSettings["ftpIP"].Split(',');
            if (!Ras.CheckServeStatus(url))
            {
                _connectionnotify = new Ras.ConnectionNotify(RasConnectNotify);
                
                FtpUpDown ftp = new FtpUpDown(_connectionnotify);
                GC.KeepAlive(_connectionnotify);
                ftp.IsDowUpland = false;
                _ftpUpload = new System.Threading.Thread(new System.Threading.ThreadStart(ftp.Connection));
                _ftpUpload.IsBackground = true;
                _ftpUpload.Start();
            }
            else
            {
                FtpUpDown ftp = new FtpUpDown();
                ftp.IsDowUpland = false;
                ftp.FileDownload();
            }
        }        private void Mian_Load(object sender, EventArgs e)
        {
            notifyIcon1.Visible = true;
            this.TimePiece.Interval = int.Parse(ConfigurationManager.AppSettings["TimeNumber"]) * 60000;
            this.TimePiece.Start();
            this.TimeCheck.Start();
        }        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            System.Environment.Exit(0);
        }        private void 設置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SetConfig setConfig = new SetConfig();
            setConfig.Show();
        }        private void 手動操作ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ftp_form == null || ftp_form.IsDisposed)
            {
                ftp_form = new FTP_Oeration();
                ftp_form.Show();
            }
            else
            {
                ftp_form.Activate();
                ftp_form.Show();
            }
        }
    }
}