未触发Opc数据更改事件C#

未触发Opc数据更改事件C#,c#,events,memory,opc,C#,Events,Memory,Opc,我正在创建一个需要与PLC通信的C#应用程序。我正在将Kepserver与OPCAutomation.dll一起使用 代码: public void Create() { OPCAutomation.OPCGroup oGroup1 = this._oServer.OPCGroups.Add("Group1"); oGroup1.DeadBand = 0; oGroup1.UpdateRate = 100; oGroup1.IsSubscribed = true

我正在创建一个需要与PLC通信的C#应用程序。我正在将Kepserver与OPCAutomation.dll一起使用

代码:

public void Create()
{
    OPCAutomation.OPCGroup oGroup1 = this._oServer.OPCGroups.Add("Group1");

    oGroup1.DeadBand = 0;
    oGroup1.UpdateRate = 100;
    oGroup1.IsSubscribed = true;
    oGroup1.IsActive = true;

    oGroup1.OPCItems.AddItem("Channel1.Plc1.Group1.Tag1", 1);
    oGroup1.OPCItems.AddItem("Channel1.Plc1.Group1.Tag2", 2);
    ...

    oGroup1.DataChange += new OPCAutomation.DIOPCGroupEvent_DataChangeEventHandler(Notify);
}

public void Notify(int TransactionID, int ModifiedTagsCount, ref Array ClientHandles, ref Array ItemValues, ref Array Qualities, ref Array TimeStamps)
{
    Console.WriteLine("Notification!");
}
我的问题是,如果我的应用程序中只有这段代码,一切都很好,但只要我添加一些其他代码(没有与OPC的链接),比如创建其他类等等,我就不会再收到通知,我也不知道为什么

为了验证这一点,我只是在初始化OPC部件后进行了以下操作:

List<RandomClass> test = new List<RandomClass>();

for (int i = 0; i < 9999; i++)
{
    Console.WriteLine(i);
    test.Add(new RandomClass());
    Task.Delay(10).Wait();
}
List test=newlist();
对于(int i=0;i<9999;i++)
{
控制台写入线(i);
test.Add(新的RandomClass());
Task.Delay(10.Wait();
}
我在开始时收到通知,但在达到特定数量的I(平均1XXX,每个应用程序启动时的数量几乎相同)后,没有收到更多通知,我不知道为什么

谢谢你的帮助