Browse Source

More docs

Custom CWT now does more null checks
4.0.0-beta
Anairkoen Schno 5 years ago
parent
commit
f0a5fe2d97
2 changed files with 15 additions and 3 deletions
  1. +5
    -0
      IPA.Loader/Loader/StateTransitionTransaction.cs
  2. +10
    -3
      Net3-Proxy/CompilerServices.cs

+ 5
- 0
IPA.Loader/Loader/StateTransitionTransaction.cs View File

@ -216,6 +216,11 @@ namespace IPA.Loader
/// </code>
/// If you are running in a coroutine, you can use <see cref="Utilities.Async.Coroutines.WaitForTask(Task)"/> instead of <see langword="await"/>.
/// </para>
/// <para>
/// If you are running on the Unity main thread, this will block until all enabling is done, and will return a task representing the disables.
/// Otherwise, the task returned represents both, and <i>will not complete</i> until Unity has done (possibly) several updates, depending on
/// the number of plugins being disabled, and the time they take.
/// </para>
/// </remarks>
/// <returns>a <see cref="Task"/> which completes whenever all disables complete</returns>
/// <exception cref="ObjectDisposedException">if this object has been disposed</exception>


+ 10
- 3
Net3-Proxy/CompilerServices.cs View File

@ -35,7 +35,9 @@ namespace System.Runtime.CompilerServices
}
public void Add(TKey key, TValue value)
{
{
if (key == null)
throw new ArgumentException("Null key", nameof(key));
lock (_lock)
items.Add(WeakRef(key), value);
}
@ -73,8 +75,13 @@ namespace System.Runtime.CompilerServices
public TValue GetOrCreateValue(TKey key)
=> GetValue(key, k => Activator.CreateInstance<TValue>());
public bool Remove(TKey key)
=> items.Remove(WeakRef(key));
public bool Remove(TKey key)
{
if (key == null)
throw new ArgumentException("Null key", nameof(key));
items.Remove(WeakRef(key));
}
public ConditionalWeakTable()
=> GCTracker.OnGC += OnGC;


Loading…
Cancel
Save