# 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

![How hot reload works](/files/-M48n9lCXryQvkxE7MP6)

#### 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.

![Separate components assembly from the rest](/files/-M490LSyR4C1N2AvhuUY)

**NOTE**: Hot reload works only in **Debug** mode


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://adospace.gitbook.io/reactorui/hot-reload-trouble-shooting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
