Stack overflow .NET Origin: Application & API Last updated 12 Oct 2026

.NET: Stack overflow. / Process is terminated due to StackOverflowException

Infinite or very deep recursion exhausted the thread’s stack; .NET can’t catch it and terminates the process.

Exact message you may see Stack overflow.Process is terminated due to StackOverflowExceptionRepeat 10000 times
Seen on: .NET

Meaning

Property getters calling themselves, recursive ToString/Equals, circular object graphs in custom serializers, or DI registrations resolving each other in loops are typical.

Common causes

  • Property that returns itself (get => Name;)
  • Recursive method without a base case
  • Circular references in serialization/ToString
  • Infinite event loops

⚡ Quick fix

  1. Look at the repeating frames in the crash output
  2. Use backing fields for properties
  3. Convert deep recursion to iteration

Detailed fix by platform

C#

  1. csharp
    private string _name = "";
    public string Name { get => _name; set => _name = value; }   // not: get => Name;

How to diagnose

  1. Frames — Which method repeats?
  2. Recursion — Base case present?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

0xC0000142 — The application was unable to start correctly (0xc0000142) (Windows)0xC0000142attempted to access privacy-sensitive data without a usage description — This app has crashed because it attempted to access privacy-sensitive data without a usage description (iOS)attempted to access p…Could not cast value of type — Swift: Could not cast value of type 'X' to 'Y' (iOS)Could not cast value …double free or corruption — C/C++: free(): double free detected / double free or corruption (out) — Aborted (core dumped) (C/C++)double free or corrup…dyld: Library not loaded — dyld: Library not loaded: @rpath/X.framework/X — Reason: image not found (crash on launch) (iOS)dyld: Library not loa…EXC_BAD_ACCESS — Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) (iOS)EXC_BAD_ACCESSIllegal instruction — Illegal instruction (core dumped) (SIGILL) (Linux)Illegal instructionIndex out of range — Swift: Fatal error: Index out of range (iOS)Index out of rangeStack ove…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.