{
  "id": "dotnet/ef-core-value-conversion-failure",
  "signature": "System.InvalidOperationException: The value converter for property 'PropertyName' threw an exception. See inner exception for details.",
  "signature_zh": "System.InvalidOperationException: 属性 'PropertyName' 的值转换器引发了异常。请参阅内部异常了解详细信息。",
  "regex": "value converter for property.*threw an exception",
  "domain": "dotnet",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Entity Framework Core's value converter fails during query or save because the conversion logic between CLR type and database type is incorrect or throws an unhandled exception.",
  "root_cause_type": "generic",
  "root_cause_zh": "Entity Framework Core 的值转换器在查询或保存期间失败，因为 CLR 类型和数据库类型之间的转换逻辑不正确或引发了未处理的异常。",
  "versions": [
    {
      "version": "Entity Framework Core 6.0.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Entity Framework Core 7.0.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Entity Framework Core 8.0.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Removing the value conversion entirely changes data type semantics and may break existing data.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using a generic ValueConverter without proper null handling causes NullReferenceException.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Changing the database column type without migration leads to data truncation or errors.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Inspect the inner exception to identify the exact conversion failure (e.g., FormatException, NullReferenceException).",
      "success_rate": 0.9,
      "how": "Inspect the inner exception to identify the exact conversion failure (e.g., FormatException, NullReferenceException).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Implement a robust value converter with null checks and error handling, then register it via HasConversion.",
      "success_rate": 0.88,
      "how": "Implement a robust value converter with null checks and error handling, then register it via HasConversion.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a custom ValueConverter class that logs or handles exceptions gracefully during conversion.",
      "success_rate": 0.8,
      "how": "Use a custom ValueConverter class that logs or handles exceptions gracefully during conversion.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Inspect the inner exception to identify the exact conversion failure (e.g., FormatException, NullReferenceException).",
    "Implement a robust value converter with null checks and error handling, then register it via HasConversion.",
    "Use a custom ValueConverter class that logs or handles exceptions gracefully during conversion."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://learn.microsoft.com/en-us/ef/core/modeling/value-conversions?view=efcore-8.0",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-11-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}