NotImplementedException
C# Programming Language
Severity: ModerateWhat Does This Error Mean?
NotImplementedException is thrown when a method has been defined (has a signature and body) but the body just contains 'throw new NotImplementedException()' — meaning the actual code was never written. This is a placeholder developers use when scaffolding code. It means: 'this method needs to be written, but has not been yet'. If you are seeing this in a running application, it means someone forgot to implement the method before shipping. The fix is to replace the placeholder with actual working code.
Affected Models
- .NET Framework
- .NET Core
- .NET 5+
- All C# versions
Common Causes
- Visual Studio's 'Implement Interface' feature generates stub methods with 'throw new NotImplementedException()' as placeholders
- A developer added a method signature but forgot to write the implementation
- A third-party library has stub methods that were not implemented in the version you are using
- An abstract class method was overridden with a stub that was never completed
- Code was copied and the 'TODO: implement' placeholder was never replaced
How to Fix It
-
Find the method that throws NotImplementedException. The stack trace will show the class and method name.
In Visual Studio: use Find in Files (Ctrl+Shift+F) and search for 'NotImplementedException' to find all unfilled stubs in your project.
-
Replace 'throw new NotImplementedException();' with the actual code the method should perform.
Look at the method name and signature to understand what it should do. Look at where it is called to understand what result is expected.
-
If you are implementing an interface and generated stubs, go through each stub and write the implementation. Do not ship code with NotImplementedException stubs still in it.
Visual Studio marks these with TODO comments when you use Quick Actions to implement an interface — search for 'TODO' to find them all.
-
If the method should truly do nothing (a no-op implementation), replace the throw with an empty method body or a comment: // Intentionally empty — do not leave the throw.
An empty method body is not the same as NotImplementedException — the empty body runs fine and does nothing; NotImplementedException crashes.
-
If the method is being called in a code path you did not expect, investigate why. The exception might be revealing a design gap — a code path that was assumed would never run.
Sometimes NotImplementedException reveals missing features rather than missing code — a feature was planned but not built.
When to Call a Professional
NotImplementedException means code is incomplete. This is something you need to implement yourself — or report to the library author if it is in a third-party library. Search your codebase for 'throw new NotImplementedException()' to find all incomplete methods.
Frequently Asked Questions
Is NotImplementedException the same as NotSupportedException?
They are different in intent. NotImplementedException means the feature has not been coded yet — it is a placeholder for future work. NotSupportedException means the feature will never be supported in this context — it is intentionally unavailable. For example, a read-only collection might throw NotSupportedException on its Add() method because it deliberately does not support adding items.
Should I ship code that has NotImplementedException?
No — NotImplementedException should never exist in production code. It means the code is incomplete. If that method is ever called in production, your application will crash. Use TODO comments or a tracking system to track incomplete methods, and implement them before release.
What if I inherit from a class that has a method I do not need to override?
If the base class has a method with NotImplementedException and you need to call it, you must override it in your subclass. If you override it and the method should do nothing in your case, just leave the override body empty (or return the default value) instead of calling base.Method() which would throw. Empty implementations are valid and safe — they just do nothing.