ฉันเพิ่งอัปเกรดเว็บ API ของฉันจาก. Net core 2.2 เป็น .Net core 3.0 และพบว่าคำขอของฉันได้รับข้อผิดพลาดตอนนี้เมื่อฉันส่ง enum ในโพสต์ไปยังจุดสิ้นสุดของฉัน ตัวอย่างเช่น:
ฉันมีโมเดลดังต่อไปนี้สำหรับจุดปลาย api ของฉัน:
    public class SendFeedbackRequest
    {
        public FeedbackType Type { get; set; }
        public string Message { get; set; }
    }
ตำแหน่ง FeedbackType มีลักษณะอย่างไร:
    public enum FeedbackType
    {
        Comment,
        Question
    }
และนี่คือวิธีการควบคุม:
    [HttpPost]
    public async Task<IActionResult> SendFeedbackAsync([FromBody]SendFeedbackRequest request)
    {
        var response = await _feedbackService.SendFeedbackAsync(request);
        return Ok(response);
    }
ฉันจะส่งสิ่งนี้เป็นส่วนของการโพสต์ไปยังตัวควบคุม:
{
    message: "Test"
    type: "comment"
}
และตอนนี้ฉันได้รับข้อผิดพลาดต่อไปนี้ที่โพสต์ไปยังจุดสิ้นสุด
The JSON value could not be converted to MyApp.Feedback.Enums.FeedbackType. Path: $.type | LineNumber: 0 | BytePositionInLine: 13."
สิ่งนี้ทำงานใน 2.2 และเริ่มข้อผิดพลาดใน 3.0 ฉันเห็นการพูดคุยเกี่ยวกับ json serializer ที่เปลี่ยนแปลงใน 3.0 แต่ไม่แน่ใจว่าควรจัดการอย่างไร