private Assert ( bool condition, string messageFormat ) : void | ||
condition | bool | |
messageFormat | string | |
return | void |
public static void Assert(bool condition, string messageFormat, params object[] data)
{
if (!condition)
{
string fullMessage = string.Format(CultureInfo.InvariantCulture, messageFormat, data);
int pipeIndex = fullMessage.IndexOf('|');
if (pipeIndex == -1)
{
Assert(fullMessage);
}
else
{
int detailLength = fullMessage.Length - pipeIndex - 1;
Assert(fullMessage.Substring(0, pipeIndex), detailLength > 0 ? fullMessage.Substring(pipeIndex + 1, detailLength) : null);
}
}
}
internal void PostPop(object newOwner) { GlobalLog.Assert(!IsEmancipated, "Pooled object not in pool."); GlobalLog.Assert(CanBePooled, "Pooled object is not poolable."); lock (this) { if (null == m_Owner) { m_Owner = new WeakReference(newOwner); } else { if (null != m_Owner.Target) { throw new InternalException(); // pooled connection already has an owner! } m_Owner.Target = newOwner; } m_PooledCount--; if (null != Pool) { if (0 != m_PooledCount) { throw new InternalException(); // popping object off stack with multiple pooledCount } } else { if (-1 != m_PooledCount) { throw new InternalException(); // popping object off stack with multiple pooledCount } } } }