-
- Nir Hasson
- Posts: 71
- Joined:
- Contact:
Resource Management
On our product we use multiple xaml files and renderes for each active state in the application (I.E Splash, Main Menu, "Game" etc).
When a state starts it loads all data, creates the xaml and renderer and when it ends it release it by resseting the main xaml FrameworkElement and the renderer.
On first run of the "Game" state everything runs as expected.
On the second run of the "Game" state I'm getting the follwoing error:
"NsCore/DelegateGeneratorSeveralParams.h line 411 Delegate already exists"
This happens when I try to add handler method to one of my Storyboards in the scene.
It looks like that on exit some of the xaml resources remains alive.
How can I verify that the Frameworkelement and the renderer a completely destroyed?
When a state starts it loads all data, creates the xaml and renderer and when it ends it release it by resseting the main xaml FrameworkElement and the renderer.
On first run of the "Game" state everything runs as expected.
On the second run of the "Game" state I'm getting the follwoing error:
"NsCore/DelegateGeneratorSeveralParams.h line 411 Delegate already exists"
This happens when I try to add handler method to one of my Storyboards in the scene.
It looks like that on exit some of the xaml resources remains alive.
How can I verify that the Frameworkelement and the renderer a completely destroyed?
-
-
sfernandez
Site Admin
- Posts: 3235
- Joined:
Re: Resource Management
Hi,
First thing I would recommend is to use a unique Renderer with a master XAML (a root Grid or Decorator) where you set the XAML tree you want to load (splash, main menu, ...). This way you can load your resources (styles, brushes, ...) and they will be shared and only created once for that main renderer.
About the error I guess that you are not unsubscribing from the Storyboard.Completed event before exiting the state, and unfortunately a new element could be created with the same pointer. Please create a ticket in our bugtracker because we should detect when the subscribed element gets destroyed to remove it from the event.
Meanwhile you have several options (if I am correct you are working with 1.1 version).
- Try to unsubscribe the elements from the Storyboard.Completed event.
- Or if the storyboard is defined in a ResourceDictionary XAML file, as they are cached in the ResourceSystem, try to clear the cache when exiting the state:
I hope this helps.
First thing I would recommend is to use a unique Renderer with a master XAML (a root Grid or Decorator) where you set the XAML tree you want to load (splash, main menu, ...). This way you can load your resources (styles, brushes, ...) and they will be shared and only created once for that main renderer.
About the error I guess that you are not unsubscribing from the Storyboard.Completed event before exiting the state, and unfortunately a new element could be created with the same pointer. Please create a ticket in our bugtracker because we should detect when the subscribed element gets destroyed to remove it from the event.
Meanwhile you have several options (if I am correct you are working with 1.1 version).
- Try to unsubscribe the elements from the Storyboard.Completed event.
- Or if the storyboard is defined in a ResourceDictionary XAML file, as they are cached in the ResourceSystem, try to clear the cache when exiting the state:
Code: Select all
#include <NsGui/UIPtr.h>
#include <NsResource/IResourceSystem.h>
#include <NsResource/BaseResourceManager.h>
...
NsGetSystem<IResourceSystem>()->GetManager(UI::Id)->ClearCache();
-
- Nir Hasson
- Posts: 71
- Joined:
- Contact:
Re: Resource Management
I'll consider your recommendation for future releases, but since I don't have common resources between states I prefer to load and unload resources by demand.
The actual change that cause this issue to appear was that I've separated my Styles, Resources and Storyboard from the main XAML to different XAML files, that's the point where your cache system might be involved in.
I've added unsubscribing calls for all Storyboards and that fixed the issue.
I'll open a ticket anyway for the scenario you've described.
On a related subject, is there any official doc that specifies the steps needed to be taken in order to move from 1.1 to 1.2+? I've noticed that the build tool is different and that there are no tbb dlls..
The actual change that cause this issue to appear was that I've separated my Styles, Resources and Storyboard from the main XAML to different XAML files, that's the point where your cache system might be involved in.
I've added unsubscribing calls for all Storyboards and that fixed the issue.
I'll open a ticket anyway for the scenario you've described.
On a related subject, is there any official doc that specifies the steps needed to be taken in order to move from 1.1 to 1.2+? I've noticed that the build tool is different and that there are no tbb dlls..
-
-
sfernandez
Site Admin
- Posts: 3235
- Joined:
Re: Resource Management
Apart from performance improvements and the new BuildTool, the most important changes affect the C# API. If you take a look at the 1.2.0 changelog you will find what is new in the C++ API:
And as always, if you find trouble doing anything, you can ask here in the forums and we will be glad to answer
- NoesisGUI.h, a header with all the API (under Noesis namespace). To be used as Precompiled Header.
- We have reduced the exposed API. All integration functionality is under Noesis::GUI.
- XCode library built with RTTI enabled.
- Dependency properties of type NsString are now set and get using const char*.
- ObservableCollection implemented in C++ (for symmetry with C#).
And as always, if you find trouble doing anything, you can ask here in the forums and we will be glad to answer

-
- Nir Hasson
- Posts: 71
- Joined:
- Contact:
Re: Resource Management
Sounds good 
We will integrate it and test in the next couple of weeks.
Thanks !

We will integrate it and test in the next couple of weeks.
Thanks !
Who is online
Users browsing this forum: Google [Bot] and 1 guest