Skip to content

Commit 75977d0

Browse files
author
rstam
committed
CSHARP-993: Ensure unique ObjectIds across AppDomains.
1 parent f40b821 commit 75977d0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

MongoDB.Bson/ObjectModel/ObjectId.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public struct ObjectId : IComparable<ObjectId>, IEquatable<ObjectId>, IConvertib
4747
// static constructor
4848
static ObjectId()
4949
{
50-
__staticMachine = GetMachineHash();
50+
__staticMachine = (GetMachineHash() + AppDomain.CurrentDomain.Id) & 0x00ffffff; // add AppDomain Id to ensure uniqueness across AppDomains
5151
__staticIncrement = (new Random()).Next();
5252

5353
try

0 commit comments

Comments
 (0)