public override DependencySnapshot Snapshot(bool useFallbacks)
        {
            if (SnapshotReady)
            {
                return(_snapshot);
            }


            var builder = ImmutableDictionary.CreateBuilder <Type, StackedDependency>();

            builder.AddRange(enumerateDependencies());

            IEnumerable <KeyValuePair <Type, StackedDependency> > enumerateDependencies()
            {
                foreach (var kvp in _dependencyStacks)
                {
                    if (kvp.Value.Count != 0)
                    {
                        yield return(new KeyValuePair <Type, StackedDependency>(
                                         kvp.Key,
                                         kvp.Value.Peek().RunOnSnapshot()
                                         ));
                    }
                }
            }

            var fb = this.Fallback;

            while (useFallbacks && fb != null)
            {
                DependencyLayer.AddAsFallbackToSnapshot(fb, builder);
                fb = fb.Fallback;
            }

            return(_snapshot = new DependencySnapshot(builder.ToImmutable()));
        }
 private void markSnapshotDirty() => _snapshot = DependencySnapshot.Null;