© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•11mo ago•
7 replies
morry329#

Cannot return null from an action method with a return type of 'Microsoft.AspNetCore.Mvc.JsonResult'

Context: I created a simple app which displays card view items on view. I have added a file picker in there. Once the file picker selected an image and the save button has been clicked, my code triggered the exception
System.InvalidOperationException: Cannot return null from an action method with a return type of 'Microsoft.AspNetCore.Mvc.JsonResult'.
System.InvalidOperationException: Cannot return null from an action method with a return type of 'Microsoft.AspNetCore.Mvc.JsonResult'.


My Rider does not let me debug like this (as per attached screenshot) so I have no idea what caused this exception.


My full code here. Could anyone kindly point me in the right direction?
https://paste.mod.gg/bnhhtfmvhaku/0
Bildschirmfoto_2025-03-30_um_13.45.18.png
BlazeBin - bnhhtfmvhaku
A tool for sharing your source code with the world!
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

AspNetCore Null Exception
C#CC# / help
2y ago
✅ Error submitting answers: Exception of type 'Microsoft.AspNetCore.Components.NavigationException'
C#CC# / help
2y ago
✅ Return List<Entity> from method with return type of List<T> where T : Entity
C#CC# / help
3y ago
❔ AspNetCore web MVC app - Authentication
C#CC# / help
3y ago