dotnet/wpf · error · FontCacheFullException

FontCacheFullException

Error message

FontCacheFullException

What it means

FontCacheFullException thrown from FontCacheLogic.Alloc when an allocation request would grow the shared font cache mapping past its fixed capacity — i.e. the aligned new size exceeds the maximum cache size, so there is no room for the requested entry.

Solutions

  1. Increase the font cache size (cache size registry/machine.config setting) so working sets fit
  2. Reduce the number of installed fonts or font families that must be cached
  3. Evict the cache (restart the WPF font cache service) so stale entries are released and retry the allocation
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FontCacheLogic.cs:415 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/79fa2dc14f5f078d. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FontCacheLogic.cs:415

        /// </summary>
        /// <param name="size"></param>
        /// <returns></returns>
        internal int Alloc(int size)
        {
            Invariant.Assert(size >= 0);

            // If the requested size is zero, we can return any offset within the file.
            if (size == 0)
                return 0;

            lock(_cacheLock)
            {
                int oldSize = CurrentSize;
                Util.AssertAligned8(oldSize);
                int newSize = Util.Align8(oldSize + size);
                Invariant.Assert(newSize > oldSize);
                if (newSize > MaxCacheSize)
                    throw new FontCacheFullException();


                //commit the memory for the new data
                _mfile.Commit(newSize);

                //Now, update the size entry in the cache header
                GetCacheHeader()->CurSize = newSize;

                Thread.MemoryBarrier();
                return oldSize;
            }
        }

        /// <summary>
        /// IFontCacheElement lookup
        /// </summary>
        /// <param name="e"></param>
        /// Adds the element if it doesn't exist in the cache.

View on GitHub (pinned to 81131a70a4)