From 002875823f4aa37d557bf8d4fb5053d0479f0c85 Mon Sep 17 00:00:00 2001 From: Badre BSAILA <54767641+pedrobsaila@users.noreply.github.com> Date: Wed, 15 Mar 2023 01:03:45 +0100 Subject: [PATCH] Misleading error "Cannot delete an already deleted object" (#83410) --- .../src/Resources/Strings.resx | 4 ++-- .../src/System/DirectoryServices/AccountManagement/Principal.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.DirectoryServices.AccountManagement/src/Resources/Strings.resx b/src/libraries/System.DirectoryServices.AccountManagement/src/Resources/Strings.resx index dbe197a..68c0ad1 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/src/Resources/Strings.resx +++ b/src/libraries/System.DirectoryServices.AccountManagement/src/Resources/Strings.resx @@ -149,8 +149,8 @@ Unpersisted Principal objects can not be deleted. - - Cannot delete an already deleted object + + Cannot access an already deleted object This Principal object represents a well-known SID and does not correspond to an actual store object. This operation is not supported on it. diff --git a/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Principal.cs b/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Principal.cs index d4cb34e..d0d1e95 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Principal.cs +++ b/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Principal.cs @@ -892,7 +892,7 @@ namespace System.DirectoryServices.AccountManagement if (_isDeleted) { GlobalDebug.WriteLineIf(GlobalDebug.Warn, "Principal", "CheckDisposedOrDeleted: accessing deleted object"); - throw new InvalidOperationException(SR.PrincipalDeleted); + throw new InvalidOperationException(SR.PrincipalAccessedAfterBeingDeleted); } } -- 2.7.4