Enable CA2019 and fix noncompliance

"`ThreadStatic` fields should not use inline initialization"
This commit is contained in:
YoshiRulz 2025-03-29 07:40:24 +10:00
parent 8cfb0599e5
commit c5d4e8b783
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 15 additions and 2 deletions

View File

@ -98,6 +98,11 @@ dotnet_diagnostic.CA1860.severity = error
# Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
dotnet_diagnostic.CA1862.severity = error
## Reliability rules
# `ThreadStatic` fields should not use inline initialization
dotnet_diagnostic.CA2019.severity = error
## Usage rules
# Call GC.SuppressFinalize correctly

View File

@ -35,9 +35,17 @@ namespace BizHawk.Emulation.DiscSystem
public MednadiscTOC TOC;
public MednadiscTOCTrack[] TOCTracks;
[ThreadStatic] private static byte[] buf2442 = new byte[2448];
[ThreadStatic] private static byte[] buf96 = new byte[96];
[ThreadStatic]
private static byte[] _buf2442;
private static byte[] buf2442
=> _buf2442 ??= new byte[2448]; // misnomer?
[ThreadStatic]
private static byte[] _buf96;
private static byte[] buf96
=> _buf96 ??= new byte[96];
public void Read_2442(int LBA, byte[] buffer, int offset)
{