From e718687c6abff0689a06a8ed8461d8cb0a73b50a Mon Sep 17 00:00:00 2001 From: Ebere Abanonu Date: Wed, 26 Apr 2023 11:00:37 +0100 Subject: [PATCH 1/2] [CS0420] `ActorCell` Warning Disable --- src/core/Akka/Actor/ActorCell.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/Akka/Actor/ActorCell.cs b/src/core/Akka/Actor/ActorCell.cs index 2e4c59a154f..f76c08073f1 100644 --- a/src/core/Akka/Actor/ActorCell.cs +++ b/src/core/Akka/Actor/ActorCell.cs @@ -91,7 +91,9 @@ public ActorCell(ActorSystemImpl system, IInternalActorRef self, Props props, Me /// /// TBD /// +#pragma warning disable CS0420 // A reference to a volatile field will not be treated as volatile public Mailbox Mailbox => Volatile.Read(ref _mailboxDoNotCallMeDirectly); +#pragma warning restore CS0420 // A reference to a volatile field will not be treated as volatile /// /// TBD From 85bac30edd0cf9d814fbe410dbce66ebd05b9bc1 Mon Sep 17 00:00:00 2001 From: Ebere Abanonu Date: Thu, 4 May 2023 11:58:22 +0100 Subject: [PATCH 2/2] [fix] Removed the `Volatile.Read` --- src/core/Akka/Actor/ActorCell.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/Akka/Actor/ActorCell.cs b/src/core/Akka/Actor/ActorCell.cs index f76c08073f1..14b3cae2513 100644 --- a/src/core/Akka/Actor/ActorCell.cs +++ b/src/core/Akka/Actor/ActorCell.cs @@ -91,9 +91,7 @@ public ActorCell(ActorSystemImpl system, IInternalActorRef self, Props props, Me /// /// TBD /// -#pragma warning disable CS0420 // A reference to a volatile field will not be treated as volatile - public Mailbox Mailbox => Volatile.Read(ref _mailboxDoNotCallMeDirectly); -#pragma warning restore CS0420 // A reference to a volatile field will not be treated as volatile + public Mailbox Mailbox => _mailboxDoNotCallMeDirectly; /// /// TBD