From a2d2337dc367f0453d7472037fecfbb33f6bb2be Mon Sep 17 00:00:00 2001 From: Slendy Date: Fri, 24 Feb 2023 20:17:44 -0600 Subject: [PATCH] Fix photo uploading and add more detailed logging to deserialization --- ProjectLighthouse/Extensions/ControllerExtensions.cs | 11 +++++++---- ProjectLighthouse/Types/Entities/Profile/Photo.cs | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ProjectLighthouse/Extensions/ControllerExtensions.cs b/ProjectLighthouse/Extensions/ControllerExtensions.cs index 9c561116..1afd3085 100644 --- a/ProjectLighthouse/Extensions/ControllerExtensions.cs +++ b/ProjectLighthouse/Extensions/ControllerExtensions.cs @@ -102,8 +102,9 @@ public static partial class ControllerExtensions if (matchedRoot == null) { Logger.Error($"[{controller.ControllerContext.ActionDescriptor.ActionName}] " + - $"Failed to deserialize {typeof(T).Name}: Unable to match root element", LogArea.Deserialization); - Logger.Error($"{bodyString}", LogArea.Deserialization); + $"Failed to deserialize {typeof(T).Name}: Unable to match root element\n" + + $"xmlData: '{bodyString}'", + LogArea.Deserialization); return default; } root = new XmlRootAttribute(matchedRoot); @@ -116,8 +117,10 @@ public static partial class ControllerExtensions catch (Exception e) { Logger.Error($"[{controller.ControllerContext.ActionDescriptor.ActionName}] " + - $"Failed to deserialize {typeof(T).Name}: {e.Message}", LogArea.Deserialization); - Logger.Error($"{bodyString}", LogArea.Deserialization); + $"Failed to deserialize {typeof(T).Name}:\n" + + $"xmlData: '{bodyString}'\n" + + $"detailedException: '{e.ToDetailedException()}", + LogArea.Deserialization); } return default; } diff --git a/ProjectLighthouse/Types/Entities/Profile/Photo.cs b/ProjectLighthouse/Types/Entities/Profile/Photo.cs index 10651d3e..a6d8c797 100644 --- a/ProjectLighthouse/Types/Entities/Profile/Photo.cs +++ b/ProjectLighthouse/Types/Entities/Profile/Photo.cs @@ -60,6 +60,7 @@ public class Photo [XmlElement("plan")] public string PlanHash { get; set; } = ""; + [XmlIgnore] public virtual ICollection PhotoSubjects { get; set; } = new HashSet(); public int CreatorId { get; set; }