Skip to content

Commit

Permalink
Add some more missing 'readonly' modifiers (#1707)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 authored Aug 6, 2024
1 parent d008663 commit b9fb45d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/WinRT.Runtime/ComWrappersSupport.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private static DefaultComWrappers DefaultComWrappersInstance
internal static Type CreateRCWType;

private static ComWrappers _comWrappers;
private static object _comWrappersLock = new object();
private static readonly object _comWrappersLock = new object();
private static ComWrappers ComWrappers
{
get
Expand Down
6 changes: 3 additions & 3 deletions src/WinRT.Runtime/Marshalers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ internal struct HSTRING_HEADER

public ref struct Pinnable
{
private HSTRING_HEADER _header;
private string _value;
private readonly HSTRING_HEADER _header;
private readonly string _value;
#if DEBUG
private bool _pinned;
#endif
Expand Down Expand Up @@ -116,7 +116,7 @@ public unsafe IntPtr GetAbi()
Marshal.ThrowExceptionForHR(Platform.WindowsCreateStringReference(
(ushort*)Unsafe.AsPointer(ref Unsafe.AsRef(in GetPinnableReference())),
_value.Length,
(IntPtr*)Unsafe.AsPointer(ref _header),
(IntPtr*)Unsafe.AsPointer(ref Unsafe.AsRef(in _header)),
&hstring));
return hstring;
}
Expand Down
4 changes: 2 additions & 2 deletions src/WinRT.Runtime/MonoSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace WinRT
{
internal static class Mono
{
static unsafe Lazy<bool> _usingMono = new Lazy<bool>(() =>
static readonly unsafe Lazy<bool> _usingMono = new Lazy<bool>(() =>
{
IntPtr modulePtr = Platform.LoadLibraryExW("mono-2.0-bdwgc.dll", IntPtr.Zero, 0);
if (modulePtr == IntPtr.Zero) return false;
Expand Down Expand Up @@ -75,7 +75,7 @@ struct MonoInternalThread_x64

public sealed class ThreadContext : IDisposable
{
static Lazy<HashSet<IntPtr>> _foreignThreads = new Lazy<HashSet<IntPtr>>();
static readonly Lazy<HashSet<IntPtr>> _foreignThreads = new Lazy<HashSet<IntPtr>>();

readonly IntPtr _threadPtr = IntPtr.Zero;

Expand Down
2 changes: 1 addition & 1 deletion src/WinRT.Runtime/Projections/Bindable.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ public IEnumerator GetEnumerator()
public sealed class ToAbiHelper : IBindableVector
#pragma warning restore CA2257
{
private global::System.Collections.IList _list;
private readonly global::System.Collections.IList _list;

public ToAbiHelper(global::System.Collections.IList list) => _list = list;

Expand Down

0 comments on commit b9fb45d

Please sign in to comment.