/// <summary>
            /// Resolves the specified tag.
            /// </summary>
            /// <param name="context">The context.</param>
            /// <param name="chunk">The chunk.</param>
            /// <returns>A <see cref="Resolution" />.</returns>
            // ReSharper disable once CodeAnnotationAnalyzer
            public override object Resolve(FormatWriteContext context, FormatChunk chunk)
            {
                Resolution resolution;
                // ReSharper disable once PossibleNullReferenceException
                string tag = chunk.Tag;

                Debug.Assert(tag != null);

                if (ResolveControls || !chunk.IsControl)
                {
                    if ((_values == null || !_values.TryGetValue(tag, out resolution)))
                    {
                        // Get the resolution using the resolver.
                        object result = _resolver(context, chunk);
                        resolution = result as Resolution? ?? new Resolution(result);

                        if (!resolution.NoCache)
                        {
                            // Cache the resolution.
                            if (_values == null)
                            {
                                _values =
                                    new Dictionary <string, Resolution>(
                                        IsCaseSensitive
                                            ? StringComparer.CurrentCulture
                                            : StringComparer.CurrentCultureIgnoreCase);
                            }

                            // ReSharper disable once AssignNullToNotNullAttribute
                            _values[tag] = resolution;
                        }
                    }
                }
                else
                {
                    resolution = (Resolution)Resolution.Unknown;
                }

                // If we don't have a resolution, ask the parent.
                if (!resolution.IsResolved &&
                    ResolveOuterTags &&
                    Parent != null)
                {
                    // ReSharper disable once PossibleNullReferenceException
                    resolution = (Resolution)Parent.Resolve(context, chunk);
                }
                return(resolution);
            }