Hot reload troubleshooting

Hot reload in ReactorUI works reloading your Xamarin Forms assembly at run-time. When a component is reloaded, it "lives" in a new assembly that is different from the previous one. Component state is "copied" from the old assembly to the new one.

At given time when you trigger an hot reload operation this things happen: 1. The Xamarin Forms project where the component is defined is built 2. New assembly is transferred to device or emulator through a adb connection 3. ReactorUI hot reload module (XamarinReactorUI.HotReload) load the new assembly in memory 4. The new component version is loaded (that it's actually a different .NET type from the component is currently running) 5. Eventually component state is migrated in a state living in the new assembly copy over all properties from old to new state object. 6. New component is finally attached to visual tree replacing the old one

Best Practices

  1. Component state class should contains only public properties whose types are value-type or string.

  2. If you need a component state with properties other than value-type/string (i.e. classes), host them in a separate assembly (project) that it's not hot reloaded.

NOTE: Hot reload works only in Debug mode

Last updated