7 Replies Latest reply on Dec 22, 2014 5:26 PM by Marcos Vainer Loeff

    PINotification-PISDK-Exception:"Database 'Configuration' has been disconnected. This is caused by using an object from a database after calling PISystem.Disconnect."

    gortega

      Hi all,

       

      I am having issues with the following logic, I am not sure what I am missing and why is that exception being thrown. Can you please advice?

       

                try
                 {
                      int id = int.Parse(instanceId);
                      AFNotification afNotification = GetNotificationByGuid(guid);//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<this logic success
                      AFTime afStartTime = new AFTime("*-100d");
                      AFTime afEndTime = new AFTime("*");
                      AFTimeRange afTimeRange = new AFTimeRange(afStartTime, afEndTime);
      // this line throws an exception>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                      anInstance = ANNotification.GetInstance(afNotification, id, afTimeRange);//<<<<<<<<<<<it throws an exception
                     
                  }
                  catch (Exception ex)
                  {
                   ///.....
                  }

       

       

      Message:

        Message "Database 'Configuration' has been disconnected. This is caused by using an object from a database after calling PISystem.Disconnect."

       

      StackTrace:

        StackTrace "   at OSIsoft.AF.AFDatabase.CheckDisconnected(AFObject item)\r\n   at OSIsoft.AF.AFObject.GetProxy(Boolean switchToPrimary)\r\n   at OSIsoft.AF.Asset.AFElement.RemoteUpdateData(Boolean checkOut, Boolean raiseEvents, Boolean inLoad, Boolean& alreadyCheckedOut)\r\n   at OSIsoft.AF.Support.AFTransactable.Refresh(Boolean deleteIfNew, Boolean inLoad)\r\n   at OSIsoft.AF.Asset.AFElement.Refresh()\r\n   at OSIsoft.AN.ANConfigurationManager.GetAttribute(String name) in c:\\Builds\\152\\PIANO\\Notifications 1.2.1205 Nightly\\Sources\\1.2.1205\\Library\\Common\\Library\\ANConfigurationManager.cs:line 806\r\n   at OSIsoft.AN.ANConfigurationManager.GetString(PISystem system, String name) in c:\\Builds\\152\\PIANO\\Notifications 1.2.1205 Nightly\\Sources\\1.2.1205\\Library\\Common\\Library\\ANConfigurationManager.cs:line 80\r\n   at OSIsoft.AN.Notification.ANNotificationHistoryManager.GetHistoryPIServer(PISDK rootPISDK, PISystem system) in c:\\Builds\\152\\PIANO\\Notifications 1.2.1205 Nightly\\Sources\\1.2.1205\\Library\\ANSDK\\Notification\\ANNotificationHistoryManager.cs:line 606\r\n   at OSIsoft.AN.Notification.ANNotificationHistoryManager.InitializeHistorizationServer(PISystem system) in c:\\Builds\\152\\PIANO\\Notifications 1.2.1205 Nightly\\Sources\\1.2.1205\\Library\\ANSDK\\Notification\\ANNotificationHistoryManager.cs:line 579\r\n   at OSIsoft.AN.Notification.ANNotificationHistoryManager.GetHistoryPIServer(PISystem piSystem) in c:\\Builds\\152\\PIANO\\Notifications 1.2.1205 Nightly\\Sources\\1.2.1205\\Library\\ANSDK\\Notification\\ANNotificationHistoryManager.cs:line 1237\r\n   at OSIsoft.AN.Notification.ANNotificationHistoryManager.InitializeHistoryTags(AFNotification notification) in c:\\Builds\\152\\PIANO\\Notifications 1.2.1205 Nightly\\Sources\\1.2.1205\\Library\\ANSDK\\Notification\\ANNotificationHistoryManager.cs:line 529\r\n   at OSIsoft.AN.Notification.ANNotificationHistoryManager.GetHistoryObject(AFNotification notification) in c:\\Builds\\152\\PIANO\\Notifications 1.2.1205 Nightly\\Sources\\1.2.1205\\Library\\ANSDK\\Notification\\ANNotificationHistoryManager.cs:line 1215\r\n   at OSIsoft.AN.Notification.ANNotificationHistoryManager.GetInstance(AFNotification notification, Int32 instanceID, AFTimeRange searchRange) in c:\\Builds\\152\\PIANO\\Notifications 1.2.1205 Nightly\\Sources\\1.2.1205\\Library\\ANSDK\\Notification\\ANNotificationHistoryManager.cs:line 246\r\n   at OSIsoft.AN.Notification.ANNotification.GetInstance(AFNotification notification, Int32 instanceID, AFTimeRange timeRange) in c:\\Builds\\152\\PIANO\\Notifications 1.2.1205 Nightly\\Sources\\1.2.1205\\Library\\ANSDK\\Notification\\ANNotification.cs:line 863\r\n   at Sams.ContactEventService.NotificationAgent.GetNotificationInstance(Guid guid, String instanceId) in c:\\_SunPower\\Sams\\Sams.Alarms\\Sams.Alarms\\Sams.ContactEventService\\NotificationAgent.cs:line 557" string