View Issue Details

IDProjectCategoryView StatusLast Update
0002704NoesisGUIC# SDKpublic2025-06-03 11:36
Reporterai_enabled Assigned Tojsantos  
PrioritynormalSeverityminor 
Status resolvedResolutionfixed 
Product Version3.2.1 
Summary0002704: RaiseTextureChanged doesn't update image source with relative path
Description

Hi guys,
if I have a texture placed in a subfolder and reference it like this:

<Image Source="Images/Player.png" />

the texture reloading with RaiseTextureChanged doesn't work.
The workaround is to use the full path to the image file, e.g.:

<Image Source="/UI/Controls/Game/Map/Images/Player.png" />

Regards!

PlatformAny

Relationships

related to 0003765 resolvedjsantos Hot reloading of global resources does not work 

Activities

jsantos

jsantos

2023-10-04 13:43

manager   ~0008788

Providers know nothing about relative paths. They always work in absolute paths (relatives to their own base root).

'RaiseTextureChanged' must provide the same path that was used when previously loading the resource.

ai_enabled

ai_enabled

2023-10-04 14:21

updater   ~0008789

Hi Jesus,
thank you for the clarification!
Right, I'm always calling RaiseTextureChanged with the absolute path (starting with the / slash) as I don't keep the original Uri provided by NoesisGUI (I convert it to the file path and use it to asynchronously load the texture, then build an absolute Uri from this file path).
I've expected that the absolute path will always work. Hmm.

So, the problem is that when I use the relative path (Source="Images/Player.png") I get this output:

LoadTexture: UI/Controls/Game/Map/Images/Player.png
RaiseTextureChanged: /UI/Controls/Game/Map/Images/Player.png
Apparently the path doesn't match due to the missing slash and the RaiseTextureChanged call has no effect.

For comparison, when I use the absolute path (Source="/UI/Controls/Game/Map/Images/Player.png") I get this output:

LoadTexture: /UI/Controls/Game/Map/Images/Player.png
RaiseTextureChanged: /UI/Controls/Game/Map/Images/Player.png
So it works properly.

I think it will be better if the TextureProvider provided an identical path in the both cases for the sake of consistency.

Regards!

jsantos

jsantos

2023-10-05 12:25

manager   ~0008793

You are totally right, this should be fixed.

jsantos

jsantos

2024-01-25 00:49

manager   ~0009117

Last edited: 2025-06-03 11:31

LoadTexture: UI/Controls/Game/Map/Images/Player.png
RaiseTextureChanged: /UI/Controls/Game/Map/Images/Player.png

I think this is happening because the XAML containing the texture has a URI that doesn't start with "/", for example: "Game/UI/Panel.xaml". If you change this to "/Game/UI/Panel.xaml" it should work. Relative texture URIs are just using the base URI of the XAML.

We normalize the URI as much as possible, but the first '/' is quite tricky to remove, because it changes the meaning of the path ("Game/UI/Panel.xaml" is a path relative to your provider, but "/Game/UI/Panel.xaml" may be interpreted as a global filesystem path.

Please, let me know if this makes sense to you.

ai_enabled

ai_enabled

2024-01-26 12:48

updater   ~0009130

Hi Jesús,
I thought about this but it doesn't make any sense to me regarding the TextureProvider—in particularly the part about "path relative to your provider".
As I see you're already resolving the path used in XAML: (as in my first example above)

XAML Source="Images/Player.png"
results in LoadTexture "UI/Controls/Game/Map/Images/Player.png" parameter
which is basically an absolute path (with missing "/" prefix). And my TextureProvider treat it as an absolute path.
Obviously I don't take into account the inner workings and can consider the situation only from my point of view so forgive me if I'm missing something. But I cannot simply comprehend why someone may treat this resolved path as a non-absolute path even if it's missing the "/" prefix.

I think it will be correct (and perfect) if TextureProvider always receives an absolute path in the LoadTexture method (and so the same absolute path is provided on RaiseTextureChanged). So, just add the "/" prefix and voila, the issue is resolved!

Regards!

jsantos

jsantos

2024-01-26 20:16

manager   ~0009132

Last edited: 2024-01-26 20:16

If the XAML is loaded with a 'prefix' (like for example /Game/UI/Panel.xaml) and it contains a "Images/Player.png", the texture provider should receive this uri = "/Game/UI/Images/Player.png". Could you verify this?

We can't add/remove automatically the prefix because it changes the meaning. Imagine I have my own provider with a root set at (/home/game/UI). If I receive a request for loading "Main.xaml" I will open the file at "/home/game/UI/Main.xaml" but if I receive the request "/Main.xaml" I should load (/Main.xaml, root of the filesystem, ignoring my root path).

Not sure if this is clear, I can train with a better example, but I first I want to understand if loading your XAMLs with prefix fixes the issue.

ai_enabled

ai_enabled

2025-06-03 11:22

updater   ~0010769

Hi Jesús!

I'm sorry for replying so late.

The issue was indeed related to the XAML loading without the prefix / (we always provided paths without it when loading XAML, including when loading UserControls). I was unaware of this nuance as in our case it made zero difference in practice. The only difference was related to the RaiseTextureChanged.

I've verified and everything related to XAML and Texture loading works exactly as you've described so there is no issue.

Please close this ticket.

Regards!
Vladimir

jsantos

jsantos

2025-06-03 11:36

manager   ~0010770

Thanks!

By the way, in 3.2.8 we implemented a few URI normalizations (like A//B.png -> A/B.png). More information in 0003765

Issue History

Date Modified Username Field Change
2023-09-29 00:59 ai_enabled New Issue
2023-10-04 13:42 jsantos Assigned To => jsantos
2023-10-04 13:42 jsantos Status new => assigned
2023-10-04 13:43 jsantos Note Added: 0008788
2023-10-04 13:43 jsantos Status assigned => feedback
2023-10-04 14:21 ai_enabled Note Added: 0008789
2023-10-04 14:21 ai_enabled Status feedback => assigned
2023-10-05 12:25 jsantos Note Added: 0008793
2023-10-05 12:25 jsantos Target Version => 3.2.3
2024-01-22 11:46 sfernandez Target Version 3.2.3 => 3.2.4
2024-01-22 11:59 jsantos Target Version 3.2.4 => 3.2.3
2024-01-25 00:49 jsantos Note Added: 0009117
2024-01-25 00:50 jsantos Status assigned => feedback
2024-01-25 00:50 jsantos Target Version 3.2.3 =>
2024-01-25 00:50 jsantos Note Edited: 0009117
2024-01-25 00:50 jsantos Note Edited: 0009117
2024-01-25 00:51 jsantos Note Edited: 0009117
2024-01-26 12:48 ai_enabled Note Added: 0009130
2024-01-26 12:48 ai_enabled Status feedback => assigned
2024-01-26 20:16 jsantos Note Added: 0009132
2024-01-26 20:16 jsantos Status assigned => feedback
2024-01-26 20:16 jsantos Note Edited: 0009132
2025-06-03 11:22 ai_enabled Note Added: 0010769
2025-06-03 11:22 ai_enabled Status feedback => assigned
2025-06-03 11:31 jsantos Description Updated
2025-06-03 11:31 jsantos Note Edited: 0009117
2025-06-03 11:35 jsantos Relationship added related to 0003765
2025-06-03 11:36 jsantos Status assigned => resolved
2025-06-03 11:36 jsantos Resolution open => fixed
2025-06-03 11:36 jsantos Note Added: 0010770