miantalha45 commented on issue #3386:
URL: https://github.com/apache/fory/issues/3386#issuecomment-3976568379

   Hi @chaokunyang 
   
   I looked into the delegate concern around Dictionary<K,V>.Comparer. It turns 
out it’s not a delegate, it’s an IEqualityComparer<TKey> (same for 
SortedDictionary, which uses IComparer<TKey>). So we are dealing with regular 
objects, not function pointers.
   
   My thinking is to handle it in a few simple cases:
   
   If it is the default comparer (EqualityComparer<TKey>.Default), we don’t 
serialize anything extra. Just write a small flag and reconstruct normally.
   
   For well-known StringComparer singletons (e.g., Ordinal, OrdinalIgnoreCase), 
we can write a flag + small ID and recreate them on read.
   
   For custom comparer classes, we serialize them as normal objects via Fory’s 
type resolver (assuming the type is registered).
   
   If the comparer is compiler-generated or wraps a delegate, we reject it with 
a clear NotSupportedException.
   
   In cross-language mode, I would skip comparer serialization entirely since 
it’s runtime-specific.
   
   Let me know if this sounds reasonable or if you would prefer limiting 
support further.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to