I have a piece of code when I debug/run locally, it works fine. However, when I deploy it on server, I got the following error.
Message: Object reference not set to an instance of an object.
at Svcs.Provider.Hosted.AgentState.RemoteIntegration.GenesysAgentState.GenesysDataMockup.ProcessChange()
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
According to the error, the relative code is
public static void StartThreadProcessing()
{
if ((null == mProcessingThread) || (false == mProcessingThread.IsAlive))
{
mThreadStop = false;
mProcessingThread = new Thread(new ThreadStart(ProcessChange));
mProcessingThread.Start();
}
mProcessingSignal = new AutoResetEvent(false);
}
public static void ProcessChange()
{
try
{
while (false == mProcessingSignal.WaitOne(freq) && false == mThreadStop)
{
List<ChangeOV> listChange = ChangeValidStatus();
if (listChange.Count != 0)
ServiceInterface.GetInstance().ProcessUpdate(listChange);
}
}
catch (Exception ex)
{
..... //Log the ex.message;
}
}
I do have the same error with another thread. That makes me think my thread has some issue. However, as I said, when I debug/run on local, it works fine without error. Please help. Thanks in advance.