File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,6 @@ static ObjectId()
5555
5656 try
5757 {
58- // we are testing for FullTrust here and, if we have it, then we use the current process' id.
59- new PermissionSet ( PermissionState . Unrestricted ) . Demand ( ) ;
6058 SetPidToCurrentProcessId ( ) ;
6159 }
6260 catch ( SecurityException )
@@ -377,6 +375,11 @@ private static int GetTimestampFromDateTime(DateTime timestamp)
377375 return ( int ) Math . Floor ( ( BsonUtils . ToUniversalTime ( timestamp ) - BsonConstants . UnixEpoch ) . TotalSeconds ) ;
378376 }
379377
378+ /// <summary>
379+ /// Sets the pid to current process id. This method exists because of how CAS operates on the call stack, checking
380+ /// for permissions before executing the method. Hence, if we inlined this call, the calling method would not execute
381+ /// before throwing an exception requiring the try/catch at an even higher level that we don't necessarily control.
382+ /// </summary>
380383 [ MethodImpl ( MethodImplOptions . NoInlining ) ]
381384 private static void SetPidToCurrentProcessId ( )
382385 {
You can’t perform that action at this time.
0 commit comments