Skip to content

Comment an adding HashtableConverter - #227

Merged
yallie merged 2 commits into
theRainbird:masterfrom
seatlemorning:patch-2
Aug 7, 2026
Merged

Comment an adding HashtableConverter#227
yallie merged 2 commits into
theRainbird:masterfrom
seatlemorning:patch-2

Conversation

@seatlemorning

@seatlemorning seatlemorning commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Can you please remove HastableConveter from the adapter settings, as it does solve a lot of problems, but it also causes some serious ones like #224 . That would help us to switch directly to your package.

P.S. Previously, on revision 1.2.3, the behavior of the hashtable was acceptable and we could adapt to it, but after adding the HastableConveter, we are unable to handle its behavior.

Thank you in advance! 👉👈(ಥ_ಥ)

This conveter causes more problems than  solves
@sancheolz

Copy link
Copy Markdown
Contributor

I am trying to solve this problem without modifying the CoreRemoting code in the following way:

new BsonSerializerAdapter(new BsonSerializerConfig([
            new ObjectTypeSlotConverter(),
            new DataSetDiffGramJsonConverter(),
            new RegionInfoConverter(),
            new EncodingConverter(),
            new IPAddressConverter(),
            new IPEndPointConverter(),
            new IsoDateTimeConverter(),
            //new HashtableConverter()
        ]) { AddCommonJsonConverters = false });

The idea is to select only your own converters.
But first I get a compilation error that the ObjectTypeSlotConverter type is not public,
and secondly an exception because of trying to insert an element at a non-existent index:

System.ArgumentOutOfRangeException : Index must be within the bounds of the List. (Parameter 'index')
   at System.Collections.Generic.List`1.Insert(Int32 index, T item)
   at CoreRemoting.Serialization.Bson.BsonSerializerAdapter..ctor(BsonSerializerConfig config)

There is no working way to influence the converters collection.

@sancheolz

Copy link
Copy Markdown
Contributor

This could only be done by creating my own implementation of ISerializerAdapter and copying some of the internal classes.

image

@yallie

yallie commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Hello!

Looks like this PR breaks because of the failing tests for the hashtable serialization.
The tests break when HashtableConverter is commented out.

@yallie
yallie merged commit 9d65f54 into theRainbird:master Aug 7, 2026
5 of 11 checks passed
{
var config = new BsonSerializerConfig();
config.AddCommonJsonConverters = true;
config.JsonConverters.Add(new HashtableConverter());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yallie graceful fix for falling tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants