I am using DotNetOpenAuth in conjunction with Mono 2.10. When context.Application.Unlock() is called, an exception is thrown indicating the lock was never acquired in the first place. I've modified the code as shown below.
My question is, does the code serve the same purpose, and does mono under Apache even support locking in this way?
Original
context.Application.Lock();
try
{
if ((store = (IRelyingPartyApplicationStore)context.Application[ApplicationStoreKey]) == null)
{
context.Application[ApplicationStoreKey] = store = new StandardRelyingPartyApplicationStore();
}
}
finally
{
context.Application.UnLock();
}
My Modifications
lock (app)
{
try
{
if ((store = (IRelyingPartyApplicationStore)context.Application[ApplicationStoreKey]) == null)
{
context.Application[ApplicationStoreKey] = store = new StandardRelyingPartyApplicationStore();
}
}
finally
{
//context.Application.UnLock();
}
}