Skip to content

Whitelist System.Threading.ReaderWriterLockSlim#9950

Open
Copilot wants to merge 2 commits intomasterfrom
copilot/whitelist-readerwriterlockslim
Open

Whitelist System.Threading.ReaderWriterLockSlim#9950
Copilot wants to merge 2 commits intomasterfrom
copilot/whitelist-readerwriterlockslim

Conversation

Copy link

Copilot AI commented Feb 2, 2026

Adds ReaderWriterLockSlim to the Sandbox.Access API whitelist to enable multi-reader/single-writer lock patterns.

Changes

  • Added System.Private.CoreLib/System.Threading.ReaderWriterLockSlim* to Rules/BaseAccess.cs alongside existing threading primitives (SemaphoreSlim, Monitor, Interlocked)

Developers can now use:

private readonly ReaderWriterLockSlim _lock = new();

// Multiple readers
_lock.EnterReadLock();
try { /* read data */ }
finally { _lock.ExitReadLock(); }

// Single writer
_lock.EnterWriteLock();
try { /* modify data */ }
finally { _lock.ExitWriteLock(); }
Original prompt

This section details on the original issue you should resolve

<issue_title>[Whitelist] System.Threading.ReaderWriterLockSlim</issue_title>
<issue_description>### What it is?

08:20:23   Compiler [SB1000](https://sbox.game/dev/doc/code/code-basics/api-whitelist/) 'System.Private.CoreLib/System.Threading.ReaderWriterLockSlim.TryEnterReadLock( System.Int32 )' is not allowed when whitelist is enabled
 08:20:23   Compiler [SB1000](https://sbox.game/dev/doc/code/code-basics/api-whitelist/) 'System.Private.CoreLib/System.Threading.ReaderWriterLockSlim.EnterWriteLock()' is not allowed when whitelist is enabled
 08:20:23   Compiler [SB1000](https://sbox.game/dev/doc/code/code-basics/api-whitelist/) 'System.Private.CoreLib/System.Threading.ReaderWriterLockSlim.EnterReadLock()' is not allowed when whitelist is enabled
 08:20:23   Compiler [SB1000](https://sbox.game/dev/doc/code/code-basics/api-whitelist/) 'System.Private.CoreLib/System.Threading.ReaderWriterLockSlim.ExitWriteLock()' is not allowed when whitelist is enabled
 08:20:23   Compiler [SB1000](https://sbox.game/dev/doc/code/code-basics/api-whitelist/) 'System.Private.CoreLib/System.Threading.ReaderWriterLockSlim.ExitReadLock()' is not allowed when whitelist is enabled
 08:20:23   Compiler [SB1000](https://sbox.game/dev/doc/code/code-basics/api-whitelist/) 'System.Private.CoreLib/System.Threading.ReaderWriterLockSlim.TryEnterWriteLock( System.Int32 )' is not allowed when whitelist is enabled
 08:20:23   Compiler [SB1000](https://sbox.game/dev/doc/code/code-basics/api-whitelist/) 'System.Private.CoreLib/System.Threading.ReaderWriterLockSlim.get_CurrentReadCount()' is not allowed when whitelist is enabled
 08:20:23   Compiler [SB1000](https://sbox.game/dev/doc/code/code-basics/api-whitelist/) 'System.Private.CoreLib/System.Threading.ReaderWriterLockSlim..ctor()' is not allowed when whitelist is enabled
 08:20:23   Compiler [SB1000](https://sbox.game/dev/doc/code/code-basics/api-whitelist/) 'System.Private.CoreLib/System.Threading.ReaderWriterLockSlim..ctor()' is not allowed when whitelist is enabled
 08:20:23   Compiler [SB1000](https://sbox.game/dev/doc/code/code-basics/api-whitelist/) 'System.Private.CoreLib/System.Threading.ReaderWriterLockSlim.Dispose()' is not allowed when whitelist is enabled

Why do you need to use this?

Sometimes you need to allow lock memory for multiple readers or only for one writer
It is really helpfull for voxel games to run smooth

https://learn.microsoft.com/en-us/dotnet/api/system.threading.readerwriterlockslim?view=net-10.0</issue_description>

<agent_instructions>Add to whitelist in Sandbox.Access</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: handsomematt <1388267+handsomematt@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix whitelist issues for ReaderWriterLockSlim methods Whitelist System.Threading.ReaderWriterLockSlim Feb 2, 2026
Copilot AI requested a review from handsomematt February 2, 2026 09:57
@handsomematt handsomematt marked this pull request as ready for review February 2, 2026 10:00
Copilot AI review requested due to automatic review settings February 2, 2026 10:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR whitelists the ReaderWriterLockSlim class in the Sandbox.Access API, enabling developers to use multi-reader/single-writer lock patterns in their code. This addresses issue #9932 where developers received compiler errors when attempting to use ReaderWriterLockSlim methods.

Changes:

  • Added System.Threading.ReaderWriterLockSlim* to the BaseAccess whitelist alongside existing threading primitives

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@handsomematt handsomematt added the triaged triaged pull-requests are replicated on the internal sbox repo label Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triaged triaged pull-requests are replicated on the internal sbox repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Whitelist] System.Threading.ReaderWriterLockSlim

2 participants