Nebula
Loading...
Searching...
No Matches
Nebula.HotReloadState Class Referencesealed

Detailed Description

Migrates a live object graph between two versions of a plugin assembly.

Classes

class  ReferenceComparer
class  ManagedCallback
class  PropertyReplacement

Package Functions

 HotReloadState (Assembly oldAssembly, Assembly newAssembly)
void RegisterReplacement (object oldValue, object newValue)
void Migrate (object oldPlugin, object newPlugin, object oldApplication, object newApplication)
void Complete ()
void PrepareProperties ()

Properties

IReadOnlyList< PropertyReplacement > Properties [get]

Private Member Functions

bool TryMigrateCollectionValue (object oldValue, Type newType, out object result)
object MigrateArray (Array oldArray, Type newType)
void PopulateArray (Array source, Array destination, Type elementType, int[] lengths, int[] lowerBounds, int[] indices)
object MigrateList (IList oldList, Type newType)
void QueueListContents (IList source, IList destination)
object MigrateDictionary (IDictionary oldDictionary, Type newType)
void QueueDictionaryContents (IDictionary source, IDictionary destination)
bool TryMigrateGenericDictionary (object oldValue, Type newType, out object result)
bool TryMigrateEnumerableCollection (object oldValue, Type newType, out object result)
object MigrateComparer (object collection)
bool MigrateIntoReadonlyContainer (object source, object destination)
object ConstructCollection (Type type, object comparer)
void DrainWork ()
void NotifyFailure ()
object MigrateValue (object oldValue, Type destinationType)
object MigrateResetValue (object oldValue, Type newType)
object MigrateObject (object oldValue, Type oldType, Type newType)
void QueueObjectFields (object oldValue, object newValue)
void RecordCallback (object oldValue, object newValue)
void CopyObjectFields (object oldValue, object newValue)
void CopyDeclaredFields (object oldValue, object newValue, Type oldLevel, Type newLevel)
void PrepareProperty (Nebula.Game.Entity entity, Nebula.Game.Property oldProperty)
bool TryMigrateReflectionValue (object oldValue, Type newType, out object result)
object MigrateModule (Module module)
object MigrateDelegate (Delegate oldDelegate, Type newType)
object MigrateMember (MemberInfo member)
object MigrateParameter (ParameterInfo parameter)
MethodInfo FindMethod (Type declaringType, MethodInfo oldMethod)
bool ParametersMatch (ParameterInfo[] oldParameters, ParameterInfo[] newParameters)
bool AreEquivalentTypes (Type oldType, Type newType)
ConstructorInfo FindConstructor (Type declaringType, ConstructorInfo oldConstructor)
Type GetNewType (Type oldType)
object Construct (Type type)
bool IsSwappedAssembly (Assembly assembly)
Assembly GetNewAssembly (Assembly assembly)
bool TryMigrateRuntimeValue (object oldValue, Type newType, out object result)
object MigrateWeakReference (WeakReference oldReference)
object MigrateGenericWeakReference (object oldReference, Type newType)
object MigrateTask (Task oldTask, Type newType)
void MigrateStaticFields ()
void MigrateStaticFields (Type oldType, Type newType)

Static Private Member Functions

static object GetComparer (object collection)
static Type[] GetCollectionArguments (Type type, Type contract)
static MethodInfo FindCollectionMethod (Type type, string name)
static Type FindGenericInterface (Type type, Type genericDefinition)
static bool IsSetType (Type type)
static void ValidateDestinationType (Type newType, Type destinationType)
static object MigrateEnum (object oldValue, Type oldType, Type newType)
static bool ShouldSkip (FieldInfo field)
static bool BackingPropertyHasNoHotReload (FieldInfo field)
static void RequireExported (Type type)
static bool IsExportedOrGenerated (Type type)
static bool IsStaticExportType (Type type)
static bool IsImmutable (Type type)
static object ConstructWithFactory (Type type, HotReloadFactoryAttribute attribute)
static bool IsGenericType (Type type, Type definition)

Private Attributes

readonly Assembly oldAssembly
readonly Assembly newAssembly
readonly AssemblyLoadContext oldLoadContext
readonly AssemblyLoadContext newLoadContext
readonly Dictionary< object, object > replacements = new Dictionary<object, object>(ReferenceComparer.Instance)
readonly Queue< Action > work = new Queue<Action>()
readonly Queue< Action > lateWork = new Queue<Action>()
readonly List< ManagedCallback > callbacks = []
readonly HashSet< object > queuedObjects = new HashSet<object>(ReferenceComparer.Instance)
readonly HashSet< object > persistedObjects = new HashSet<object>(ReferenceComparer.Instance)
readonly List< PropertyReplacement > properties = []

Constructor & Destructor Documentation

◆ HotReloadState()

Nebula.HotReloadState.HotReloadState ( Assembly oldAssembly,
Assembly newAssembly )
inlinepackage

Member Function Documentation

◆ AreEquivalentTypes()

bool Nebula.HotReloadState.AreEquivalentTypes ( Type oldType,
Type newType )
inlineprivate

◆ BackingPropertyHasNoHotReload()

bool Nebula.HotReloadState.BackingPropertyHasNoHotReload ( FieldInfo field)
inlinestaticprivate

◆ Complete()

void Nebula.HotReloadState.Complete ( )
inlinepackage

◆ Construct()

object Nebula.HotReloadState.Construct ( Type type)
inlineprivate

◆ ConstructCollection()

object Nebula.HotReloadState.ConstructCollection ( Type type,
object comparer )
inlineprivate

◆ ConstructWithFactory()

object Nebula.HotReloadState.ConstructWithFactory ( Type type,
HotReloadFactoryAttribute attribute )
inlinestaticprivate

◆ CopyDeclaredFields()

void Nebula.HotReloadState.CopyDeclaredFields ( object oldValue,
object newValue,
Type oldLevel,
Type newLevel )
inlineprivate

◆ CopyObjectFields()

void Nebula.HotReloadState.CopyObjectFields ( object oldValue,
object newValue )
inlineprivate

◆ DrainWork()

void Nebula.HotReloadState.DrainWork ( )
inlineprivate

◆ FindCollectionMethod()

MethodInfo Nebula.HotReloadState.FindCollectionMethod ( Type type,
string name )
inlinestaticprivate

◆ FindConstructor()

ConstructorInfo Nebula.HotReloadState.FindConstructor ( Type declaringType,
ConstructorInfo oldConstructor )
inlineprivate

◆ FindGenericInterface()

Type Nebula.HotReloadState.FindGenericInterface ( Type type,
Type genericDefinition )
inlinestaticprivate

◆ FindMethod()

MethodInfo Nebula.HotReloadState.FindMethod ( Type declaringType,
MethodInfo oldMethod )
inlineprivate

◆ GetCollectionArguments()

Type[] Nebula.HotReloadState.GetCollectionArguments ( Type type,
Type contract )
inlinestaticprivate

◆ GetComparer()

object Nebula.HotReloadState.GetComparer ( object collection)
inlinestaticprivate

◆ GetNewAssembly()

Assembly Nebula.HotReloadState.GetNewAssembly ( Assembly assembly)
inlineprivate

◆ GetNewType()

Type Nebula.HotReloadState.GetNewType ( Type oldType)
inlineprivate

◆ IsExportedOrGenerated()

bool Nebula.HotReloadState.IsExportedOrGenerated ( Type type)
inlinestaticprivate

◆ IsGenericType()

bool Nebula.HotReloadState.IsGenericType ( Type type,
Type definition )
inlinestaticprivate

◆ IsImmutable()

bool Nebula.HotReloadState.IsImmutable ( Type type)
inlinestaticprivate

◆ IsSetType()

bool Nebula.HotReloadState.IsSetType ( Type type)
inlinestaticprivate

◆ IsStaticExportType()

bool Nebula.HotReloadState.IsStaticExportType ( Type type)
inlinestaticprivate

◆ IsSwappedAssembly()

bool Nebula.HotReloadState.IsSwappedAssembly ( Assembly assembly)
inlineprivate

◆ Migrate()

void Nebula.HotReloadState.Migrate ( object oldPlugin,
object newPlugin,
object oldApplication,
object newApplication )
inlinepackage

◆ MigrateArray()

object Nebula.HotReloadState.MigrateArray ( Array oldArray,
Type newType )
inlineprivate

◆ MigrateComparer()

object Nebula.HotReloadState.MigrateComparer ( object collection)
inlineprivate

◆ MigrateDelegate()

object Nebula.HotReloadState.MigrateDelegate ( Delegate oldDelegate,
Type newType )
inlineprivate

◆ MigrateDictionary()

object Nebula.HotReloadState.MigrateDictionary ( IDictionary oldDictionary,
Type newType )
inlineprivate

◆ MigrateEnum()

object Nebula.HotReloadState.MigrateEnum ( object oldValue,
Type oldType,
Type newType )
inlinestaticprivate

◆ MigrateGenericWeakReference()

object Nebula.HotReloadState.MigrateGenericWeakReference ( object oldReference,
Type newType )
inlineprivate

◆ MigrateIntoReadonlyContainer()

bool Nebula.HotReloadState.MigrateIntoReadonlyContainer ( object source,
object destination )
inlineprivate

◆ MigrateList()

object Nebula.HotReloadState.MigrateList ( IList oldList,
Type newType )
inlineprivate

◆ MigrateMember()

object Nebula.HotReloadState.MigrateMember ( MemberInfo member)
inlineprivate

◆ MigrateModule()

object Nebula.HotReloadState.MigrateModule ( Module module)
inlineprivate

◆ MigrateObject()

object Nebula.HotReloadState.MigrateObject ( object oldValue,
Type oldType,
Type newType )
inlineprivate

◆ MigrateParameter()

object Nebula.HotReloadState.MigrateParameter ( ParameterInfo parameter)
inlineprivate

◆ MigrateResetValue()

object Nebula.HotReloadState.MigrateResetValue ( object oldValue,
Type newType )
inlineprivate

◆ MigrateStaticFields() [1/2]

void Nebula.HotReloadState.MigrateStaticFields ( )
inlineprivate

◆ MigrateStaticFields() [2/2]

void Nebula.HotReloadState.MigrateStaticFields ( Type oldType,
Type newType )
inlineprivate

◆ MigrateTask()

object Nebula.HotReloadState.MigrateTask ( Task oldTask,
Type newType )
inlineprivate

◆ MigrateValue()

object Nebula.HotReloadState.MigrateValue ( object oldValue,
Type destinationType )
inlineprivate

◆ MigrateWeakReference()

object Nebula.HotReloadState.MigrateWeakReference ( WeakReference oldReference)
inlineprivate

◆ NotifyFailure()

void Nebula.HotReloadState.NotifyFailure ( )
inlineprivate

◆ ParametersMatch()

bool Nebula.HotReloadState.ParametersMatch ( ParameterInfo[] oldParameters,
ParameterInfo[] newParameters )
inlineprivate

◆ PopulateArray()

void Nebula.HotReloadState.PopulateArray ( Array source,
Array destination,
Type elementType,
int[] lengths,
int[] lowerBounds,
int[] indices )
inlineprivate

◆ PrepareProperties()

void Nebula.HotReloadState.PrepareProperties ( )
inlinepackage

◆ PrepareProperty()

void Nebula.HotReloadState.PrepareProperty ( Nebula.Game.Entity entity,
Nebula.Game.Property oldProperty )
inlineprivate

◆ QueueDictionaryContents()

void Nebula.HotReloadState.QueueDictionaryContents ( IDictionary source,
IDictionary destination )
inlineprivate

◆ QueueListContents()

void Nebula.HotReloadState.QueueListContents ( IList source,
IList destination )
inlineprivate

◆ QueueObjectFields()

void Nebula.HotReloadState.QueueObjectFields ( object oldValue,
object newValue )
inlineprivate

◆ RecordCallback()

void Nebula.HotReloadState.RecordCallback ( object oldValue,
object newValue )
inlineprivate

◆ RegisterReplacement()

void Nebula.HotReloadState.RegisterReplacement ( object oldValue,
object newValue )
inlinepackage

◆ RequireExported()

void Nebula.HotReloadState.RequireExported ( Type type)
inlinestaticprivate

◆ ShouldSkip()

bool Nebula.HotReloadState.ShouldSkip ( FieldInfo field)
inlinestaticprivate

◆ TryMigrateCollectionValue()

bool Nebula.HotReloadState.TryMigrateCollectionValue ( object oldValue,
Type newType,
out object result )
inlineprivate

◆ TryMigrateEnumerableCollection()

bool Nebula.HotReloadState.TryMigrateEnumerableCollection ( object oldValue,
Type newType,
out object result )
inlineprivate

◆ TryMigrateGenericDictionary()

bool Nebula.HotReloadState.TryMigrateGenericDictionary ( object oldValue,
Type newType,
out object result )
inlineprivate

◆ TryMigrateReflectionValue()

bool Nebula.HotReloadState.TryMigrateReflectionValue ( object oldValue,
Type newType,
out object result )
inlineprivate

◆ TryMigrateRuntimeValue()

bool Nebula.HotReloadState.TryMigrateRuntimeValue ( object oldValue,
Type newType,
out object result )
inlineprivate

◆ ValidateDestinationType()

void Nebula.HotReloadState.ValidateDestinationType ( Type newType,
Type destinationType )
inlinestaticprivate

Member Data Documentation

◆ callbacks

readonly List<ManagedCallback> Nebula.HotReloadState.callbacks = []
private

◆ lateWork

readonly Queue<Action> Nebula.HotReloadState.lateWork = new Queue<Action>()
private

◆ newAssembly

readonly Assembly Nebula.HotReloadState.newAssembly
private

◆ newLoadContext

readonly AssemblyLoadContext Nebula.HotReloadState.newLoadContext
private

◆ oldAssembly

readonly Assembly Nebula.HotReloadState.oldAssembly
private

◆ oldLoadContext

readonly AssemblyLoadContext Nebula.HotReloadState.oldLoadContext
private

◆ persistedObjects

readonly HashSet<object> Nebula.HotReloadState.persistedObjects = new HashSet<object>(ReferenceComparer.Instance)
private

◆ properties

readonly List<PropertyReplacement> Nebula.HotReloadState.properties = []
private

◆ queuedObjects

readonly HashSet<object> Nebula.HotReloadState.queuedObjects = new HashSet<object>(ReferenceComparer.Instance)
private

◆ replacements

readonly Dictionary<object, object> Nebula.HotReloadState.replacements = new Dictionary<object, object>(ReferenceComparer.Instance)
private

◆ work

readonly Queue<Action> Nebula.HotReloadState.work = new Queue<Action>()
private

Property Documentation

◆ Properties

IReadOnlyList<PropertyReplacement> Nebula.HotReloadState.Properties
getpackage

The documentation for this class was generated from the following files: