From 0893d0dc852d5a8095f28a281477c6896da15d1a Mon Sep 17 00:00:00 2001 From: Mariusz Matysek Date: Thu, 7 Nov 2024 08:29:36 +0100 Subject: [PATCH] fix --- src/Migration/MigrationSerializer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Migration/MigrationSerializer.cs b/src/Migration/MigrationSerializer.cs index 6ddf126..ab2e172 100644 --- a/src/Migration/MigrationSerializer.cs +++ b/src/Migration/MigrationSerializer.cs @@ -17,6 +17,11 @@ public MigrationSerializer(EntityContext context) _context = context; _migrationRunner = new MigrationRunner(context); _baseSerializer = BsonSerializer.LookupSerializer(); + + if (_baseSerializer is MigrationSerializer) + { + throw new InvalidOperationException("The base serializer cannot be an instance of MigrationSerializer to prevent recursion."); + } } object IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)