Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Issue: HttpError not getting serialized correctly when using DataContractJsonSerializer [242]

$
0
0
Modify JsonFormatter on the config to use DataContractJsonSerializer.

My action looks like this:
---------------------------

[HttpGet]
public string GetGreeting()
{
throw new InvalidOperationException("invalid operation is being performed");

return "Hello";
}

Response returned (NOTE: notice how the Error information looks like):
------------------------------------------------------------------------

HTTP/1.1 500 Internal Server Error
Content-Length: 1050
Content-Type: application/json; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 15 Jun 2012 16:42:53 GMT

"<Error><Message>An error has occurred.<\/Message><ExceptionMessage>invalid operation is being performed<\/ExceptionMessage><ExceptionType>System.InvalidOperationException<\/ExceptionType><StackTrace> at MvcWebApi.MainTests.Tests.BugReproTests.BugReproTestsController.GetGreeting() in C:\\Users\\kichalla\\Documents\\Visual Studio 2010\\Projects\\ClassLibrary3\\ClassLibrary3\\Class1.cs:line 71&#xD;\u000a at lambda_method(Closure , Object , Object[] )&#xD;\u000a at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.&lt;&gt;c__DisplayClass13.&lt;GetExecutor&gt;b__c(Object instance, Object[] methodParameters)&#xD;\u000a at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)&#xD;\u000a at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.&lt;&gt;c__DisplayClass5.&lt;ExecuteAsync&gt;b__4()&#xD;\u000a at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)<\/StackTrace><\/Error>"
Comments: This is the behavior from DCJS for serializing any type that implements IXmlSerializable.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>