I had a problem with the silent failure of deserialization in the ASP.NET Web API (version 5.1.2). I would like deserialization to throw an error, but I cannot find a configuration for it.
My specific (simplified) case is this. The client application (AngularJS) sends an HTTP POST request to the ASP.NET web API backend. As a payload there is a string chain:
["ABC100", "ABC200", "ABC300"]
However, the server expects a list of integers:
List<int> Ids { get; set; }
As a result, deserialization occurs, the list of identifiers will be empty and there will be no errors.
Ids: []
Of course, it is also necessary to eliminate the discrepancy, but it seems obvious to me that the POST request in this case should fail. How can I do this by default?