I'm building an OData response by throwing a standard HttpResponseException. The exception itself is built with an HttpResponseMessage based on ODataError.
new ODataError()
{
ErrorCode = code,
Message = message,
InnerError = new ODataInnerError()
{
Message = innerException.Message,
StackTrace = innerException.StackTrace,
TypeName = innerException.GetType().Name
},
InstanceAnnotations = annotations
});
The result rendered is correct when making the request on localhost.
However, Annotations are not rendered when the request is not made on the same server, is there a way to configure this behaviour?
Note: the nuget package currently used is Microsoft.OData.Core 6.12.0
Maybe it helps to set the
config.IncludeErrorDetailPolicy
to always. It is default set toIncludeErrorDetailPolicy.LocalOnly
: