From: Badre BSAILA <54767641+pedrobsaila@users.noreply.github.com>
Date: Wed, 15 Mar 2023 00:03:45 +0000 (+0100)
Subject: Misleading error "Cannot delete an already deleted object" (#83410)
X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~3481
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=002875823f4aa37d557bf8d4fb5053d0479f0c85;p=platform%2Fupstream%2Fdotnet%2Fruntime.git
Misleading error "Cannot delete an already deleted object" (#83410)
---
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);
}
}