Skip to content

Commit 9398c9a

Browse files
committed
more fixes to the docs
1 parent e92795a commit 9398c9a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/DryIoc/Container.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -3199,7 +3199,6 @@ public Expression ToExpression<S>(S state, Func<S, object, Expression> fallbackC
31993199
///<summary>Hides/wraps object with disposable interface.</summary>
32003200
public sealed class HiddenDisposable
32013201
{
3202-
// todo: @perf use UnsafeAccessAttribute to avoid reflection
32033202
internal static ConstructorInfo Ctor = typeof(HiddenDisposable).GetConstructors()[0];
32043203
internal static FieldInfo ValueField = typeof(HiddenDisposable).GetField(nameof(Value));
32053204
/// <summary>Wrapped value</summary>
@@ -3236,7 +3235,7 @@ public static bool TryInterpretAndUnwrapContainerException(IResolverContext r, E
32363235
// and we will be operating with its Value only).
32373236
//
32383237
// Then traverse the scope items and find the first NoItem entry for the exceptional dependency.
3239-
// The first NoItem entry will be the one for the exception because Scope (except for the Singletons Scope) is
3238+
// The first NoItem entry will be the one for the exception because Scope is
32403239
// not supposed to be modified concurrently - so only one NoItem entry is expected. Read-on for more the details.
32413240
//
32423241
// If found, then try to set the exception into the entry Value,
@@ -3247,17 +3246,16 @@ public static bool TryInterpretAndUnwrapContainerException(IResolverContext r, E
32473246
// but it is not a problem, because it will be overriden by the successful resolution - right?
32483247
// Or if unsuccessful, we may get the wrong exception, but it is even more unlikely the case.
32493248
// It is unlikely in the first place because the majority of cases the scope access is not concurrent.
3250-
// Comparing to the singletons where it is expected to be concurrent, but it does not addressed here.
32513249
//
3252-
var exSet = TrySetScopedItemException(r, ex);
3250+
var exSet = TrySetScopedOrSingletonItemException(r, ex);
32533251
Debug.Assert(!exSet, $"The exception was not set in the scope item entry, ex message: {ex.Message}");
32543252

32553253
// todo: @improve should we try to `(ex as ContainerException)?.TryGetDetails(container)` here and include it into the cex message?
32563254
throw ex.TryRethrowWithPreservedStackTrace();
32573255
}
32583256
}
32593257

3260-
private static bool TrySetScopedItemException(IResolverContext r, Exception ex)
3258+
private static bool TrySetScopedOrSingletonItemException(IResolverContext r, Exception ex)
32613259
{
32623260
ScopedItemException sex = null;
32633261
for (var s = r.CurrentScope; s != null; s = s.Parent)
@@ -3286,7 +3284,7 @@ static bool TryFindNoItemAndStoreWrappedException(IScope scope, Exception ex, re
32863284
// because the other thread has no way to notify us here of the wrong, because we are done already.
32873285

32883286
// So, slowing down and given a chance for the other thread to set the NoItem entry to the value.
3289-
Thread.Sleep(1); // per design, because Thead.Sleep(0) or Thread.Yield() are not reliable.
3287+
Thread.Sleep(1); // per design, because Thead.Sleep(0) or Thread.Yield() are not reliable enough.
32903288

32913289
var actualValueWas = Interlocked.CompareExchange(ref entry.Value, sex, Scope.NoItem);
32923290
if (actualValueWas == Scope.NoItem)

0 commit comments

Comments
 (0)