Closed
Description
Hello,
I am using latest stable release 2016.1.0 on Windows 10 with Visual Studio 2017 within a desktop application.
ReleaseSemaphore sometimes throws a SystemNullReference exception. To circumvent that issue I had to modify the function to:
private void ReleaseSemaphore()
{
if (Interlocked.CompareExchange(ref _sessionSemaphoreObtained, 0, 1) == 1)
{
SemaphoreLight sem = SessionSemaphore;
if (sem != null)
sem.Release();
else
System.Diagnostics.Trace.WriteLine("*** SessionSemaphore NULL");
}
}
Digging a little bit, I found that in fact the issue came from Channel SessionSemaphore property. I also had to change it a little bit as below:
protected SemaphoreLight SessionSemaphore
{
get
{
ISession s = _session;
if (s != null)
return s.SessionSemaphore;
System.Diagnostics.Trace.WriteLine("*** session NULL");
return null;
}
}
Running my app with those changes, I sometimes get the below trace output, but no more exception:
*** session NULL
*** SessionSemaphore NULL
Metadata
Metadata
Assignees
Labels
No labels