Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom debug logging for SerializationException. #40

Merged
merged 1 commit into from
Oct 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
namespace NewPlatform.Flexberry.ORM.ODataService.Formatter
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.OData;
using System.Web.OData.Formatter.Serialization;

using ICSSoft.STORMNET;

using Microsoft.OData.Edm;

/// <summary>
Expand Down Expand Up @@ -43,6 +43,12 @@ public override ODataEdmTypeSerializer GetEdmTypeSerializer(IEdmTypeReference ed
serializer = _feedSerializer;
}

if (serializer == null)
{
EdmTypeKind edmKind = edmType.TypeKind();
LogService.LogDebug($"'{edmType.ToTraceString()}' ({nameof(EdmTypeKind)}='{edmKind.ToString()}') cannot be serialized using the '{nameof(CustomODataSerializerProvider)}'");
}

return serializer;
}

Expand All @@ -61,7 +67,14 @@ public override ODataSerializer GetODataPayloadSerializer(IEdmModel model, Type
return _feedSerializer;
}

return base.GetODataPayloadSerializer(model, type, request);
ODataSerializer serializer = base.GetODataPayloadSerializer(model, type, request);

if (serializer == null)
{
LogService.LogDebug($"'{type.Name}' ({nameof(IEdmModel)} type='{model.GetType().Name}') cannot be serialized using the '{nameof(CustomODataSerializerProvider)}'");
}

return serializer;
}
}
}