anton.sodergren_pdx
Topic Author
Posts: 21
Joined: 24 Mar 2022, 17:10

Hot reload of global resources

10 May 2022, 17:53

Hi, I just wanted to check something about hot reloading.

Whenever a XAML file for a window is changed while the game is running, it is properly reloaded. However, when a XAML file containing global resources is changed, we do call RaiseXamlChanged, but nothing seems to happen.

Is this the expected behaviour? Is there simply no support for hot reloading global resource files? And if that is the case, are there any plans for implementing support for this?
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: Hot reload of global resources

12 May 2022, 19:02

Hi Anton,

Reloading ResourceDictionaries is not working yet, only xamls of objects connected to the visual tree are reloaded right now.
We have plans to implement support for that in the following major version.
 
anton.sodergren_pdx
Topic Author
Posts: 21
Joined: 24 Mar 2022, 17:10

Re: Hot reload of global resources

29 Oct 2024, 17:56

Hello again! It was a while since I made this thread, but I want to revive it since this is very much related.

Is it correct that hot reloading of global resources was implemented? The patch notes for 3.2 mentioned that the hot reload algorithm was reimplemented. And the documentation page for Hot Reload mentions resource dictionaries and theme modifications, so I would make the assumption that it is now supposed to work.

For quite a while now, we have had a file watcher that has manually brute force reloaded everything, including both resource dictionaries and all views, whenever any XAML file changes, since we couldn't rely on the built-in hot reload functionality due to the missing support for global resources. But as you can imagine, this is quite slow to do whenever a XAML file changes. So we wanted to do another attempt at making use of the built-in functionality instead. After having hooked up our file watcher to notify the XAML provider, hot reloading user controls or resource dictionaries that are referenced as merged dictionaries from the user controls work just as I would expect, and it is quite quick! However, for XAML files that are global resources, it seems like nothing is happening, and in the log file it doesn't look like it's trying to load the file.

Do we need to do something special for hot reloading of global resources, or is it still just not implemented? We are currently on version 3.2.3.
 
User avatar
jsantos
Site Admin
Posts: 4823
Joined: 20 Jan 2012, 17:18
Contact:

Re: Hot reload of global resources

30 Oct 2024, 18:52

Yes, this approach should work. If you manually merge the global dictionary XAML into one of your existing XAML files, do the resources reload correctly in that case?

Could you please create a ticket for this issue?
 
anton.sodergren_pdx
Topic Author
Posts: 21
Joined: 24 Mar 2022, 17:10

Re: Hot reload of global resources

31 Oct 2024, 11:13

Hey, indeed if I simply add it to a merged dictionary in the view, it does actually reload as expected for that view. But if it's just used as a global resource, the file doesn't reload (LoadXaml in the XAML provider doesn't get called even though the XAML provider is notified that the file has changed).

Sure, I can create a ticket.
 
anton.sodergren_pdx
Topic Author
Posts: 21
Joined: 24 Mar 2022, 17:10

Re: Hot reload of global resources

31 Oct 2024, 14:33

I created this ticket for the issue:

https://www.noesisengine.com/bugs/view.php?id=3765
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: Hot reload of global resources

05 Nov 2024, 12:16

Thanks!

Who is online

Users browsing this forum: Bing [Bot] and 5 guests