ConfigAPI Client - No Alarm Definitions

The alarm definitions are not loading in the example. I saw them appear once yesterday but today they are not there. All I did since was activate/deactivate some plugins but now I can’t get the list back anymore. How can I debug this?

Listing the alarm definitions require the Event Server to be running so make sure that is the case. Also please check whether they are listed in Management Client.

Finally, try debug config API client to see if it receives any exceptions (and silently catches them) while fetching.

-Event server is on

-They are listed in the management client

-No app crashing exceptions

-Got this from debug output when clicking on alarm definitions:

(should be fine, it would just show to node without an icon)

Unknown itemType for GetImageIndex: ArchiveStorageFolder

Unknown itemType for GetImageIndex: ArchiveStorageFolder

Unknown itemType for GetImageIndex: AutoDetectConfigurationFolder

Unknown itemType for GetImageIndex: AutoDetectConfigurationFolder

  e4391ae5-7d96-4a0f-835a-9019a73f269a,

  da344fbc-2607-47aa-9660-c562f536f48a,

<82 more lines of GUID>

This is a bit of a mystery. Is the Alarm definitions top node there in the config API client?

Btw you are also aware that we did a change so that sub nodes are not populated in Config API until you select the top node for that category, right?

Finally, assuming you are running 2018 R2?

Yes to all unfortunately…

How can I delete all alarm definitions from SQL? Maybe that would reset it… The idea is that maybe some plugins that aren’t there anymore are bugging because of custom alarm definitions

I would not recommend deleting them directly in SQL. There might be dependencies I am not aware of. You can of course try deleting them in the Management Client, but I doubt that would help since you are also not able to add new ones.

If you run config API client from debugger can you then try to put a break point where the exception is handled and have a look at the stack trace? The server side of it would be quite interesting to see.

I deleted all of them from management client. New ones don’t show up.

I can’t find the logs for it server side, where would they be?

There is no exception, its just a missing icon message:

internal static int GetImageIndex(String itemType)
{
	int index = 0;
	if (itemType!=null &&                UI.Icons.ObjectTypeToIndex.ContainsKey(itemType))
        index = UI.Icons.ObjectTypeToIndex[itemType];
        else
	{
                Debug.WriteLine("Unknown itemType for GetImageIndex: " + 
                itemType);
	}
	return index;
}

P.S. The code snippet really needs an upgrade :slight_smile:

I am not sure which log it would be since I am not entirely sure of what is happening, but one of the logs in [c:\ProgramData\Milestone\XProtect](file:c:/ProgramData/Milestone/XProtect) Management Server\Logs\

Regarding the exception I meant the one you got when pressing the Add alarm definition button in config API client. You showed a screenshot of that a few posts ago. That looks very much like a null reference exception.

Oh yeah that one.

Yes it is a null ref

Nothing popping up in that log folder (I delete all logs before rerunning and checking)

Exception thrown: ‘System.Net.WebException’ in System.dll

Exception thrown: ‘System.Net.WebException’ in System.dll

Exception thrown: ‘System.ServiceModel.FaultException`1’ in System.ServiceModel.dll

Exception thrown: ‘System.ServiceModel.FaultException`1’ in mscorlib.dll

Exception thrown: ‘System.Net.WebException’ in System.dll

Exception thrown: ‘System.Net.WebException’ in System.dll

Exception thrown: ‘System.ServiceModel.FaultException`1’ in System.ServiceModel.dll

Exception thrown: ‘System.ServiceModel.FaultException`1’ in mscorlib.dll

InvokeMethod:Object reference not set to an instance of an object.

Exception thrown: ‘System.ServiceModel.FaultException`1’ in ConfigAPIClient.exe

Exception thrown: ‘System.Net.Sockets.SocketException’ in System.dll

Exception thrown: ‘System.IO.IOException’ in System.dll

Exception thrown: ‘System.Net.WebException’ in System.dll

Exception thrown: ‘System.Net.WebException’ in System.dll

Exception thrown: ‘System.Net.WebException’ in System.Web.Services.dll

ConnectionCheck for:https://labo02/, Took:15450ms

It is the FaultException that is quite interesting. Can you try finding the try/catch that shows the messagebox, set a breakpoint there and then see the details of the exception. It would be really nice to see the server side exception leading to the fault exception.

I can’t find the server side exception…

item and methodId params are both non null.

_client is non null.

The error occurs here in ConfigApiClient.cs (line 349):

snippet line 5

internal ConfigurationItem InvokeMethod(ConfigurationItem item, String methodId)
        {
            try
            {
                return _client.InvokeMethod(item, methodId);
            }
            catch (Exception ee)
            {
                InitializeClientProxy();
                Debug.WriteLine("InvokeMethod(Outer): " + ee.Message);
                try
                {
                    return _client.InvokeMethod(item, methodId);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("InvokeMethod:" + ex.Message);
                    throw;
                }
                
            }
        }

I would rather expect it to be in SimpleUserControl.PerformAction method due to the MessageBox and the “Unable to perform action” text. If you put a breakpoint in the exception handler (SimpleUserControl.cs line 203) you will hopefully be able to see an inner exception (if I am correct) - it would be really helpful to get the details (e.g. call stack) of that.

Ok il take a look tomorrow

Sorry, took me a while to get back to this. Here is the exception on line 203:

Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.ServiceModel.FaultException`1' in System.ServiceModel.dll
Exception thrown: 'System.ServiceModel.FaultException`1' in mscorlib.dll
InvokeMethod(Outer): Object reference not set to an instance of an object.
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
Exception thrown: 'System.ServiceModel.FaultException`1' in System.ServiceModel.dll
Exception thrown: 'System.ServiceModel.FaultException`1' in mscorlib.dll
InvokeMethod:Object reference not set to an instance of an object.
Exception thrown: 'System.ServiceModel.FaultException`1' in ConfigAPIClient.exe

Eric, Please try to set a BreakPoint at line 203, and see what the InnerException explains. Could be Communication from Management Server to Event Server is not working?

Hi Anders,

I can’t see any inner exceptions.

All the other configuration items are coming through just fine…

no, but now you have a NullReference Exception - what is the stack trace showing?

“System.ServiceModel.FaultException`1[VideoOS.ConfigurationAPI.ConfigurationFaultException.ServerExceptionFault]: Object reference not set to an instance of an object. (Fault Detail is equal to VideoOS.ConfigurationAPI.ConfigurationFaultException.ServerExceptionFault).”