The Wizards Engine : Hotloading

Simple

This describes the simple form of hotloading. It requires some manual work and is not perfect, but should allow to speed up development by writing some manual hotload code once.

This type of hotloading is actually reloading, but with some extra tricks to make it look a bit like hotloading.

Description

  • HotloadedAssembly
    • Adapter for accessing the assembly
    • Watches changes to the source assembly
    • Makes shadow copy
  • IHotloadCore is created and invoked on each hotload
  • Data can be bound to the HotloadedAssembly and retrieved in the IHotloadCore
  • The IHotloadCore has a method which can provide serialized data to the next IHotloadCore instance

Advanced

The main idea here is to have an aspect applied to all hotloadable classes. This aspect redirects method/fields/property calls. A filesystem watcher tracks which classes are changed by watching the source files. If a class is changed, a the new dll is compiled and loaded alongside the old dlls.

Note that if compilation fails, the changed classes should be tracked until compilation succeeds again.

On each call to a hotloadable class, a check is first made to see if the instance called is the newest implementation of this type. If it is not, the newest instance is retrieved, and the method call is redirected.

  • If the method/field/property doesn't exist anymore, the old method is called. A warning should be added in this case, or maybe this is an invalid scenario?
  • If the newest instance doesn't exist yet, it is created first. All fields which still exist are copied to the newest object.

Note, class tracking is an extension, one could simply mark all classes as changed.

Description

TODO