- Heia Samahi
- Posts: 8
- Joined:
[Unity][Bug?] Missing xaml exception - But it works... sort of...
Hello,
I've run into an annoying bug.
Every time I restart the unity editor. All non-root XAML "paths" files "breaks". And, I can build but not run the build.
Only when I retrigger the XAML import likely by adding a space in the XAML, it works again.
Noesis throws an exception which usually happens only with missing XAML. But, the XAMLs works if I retrigger the import. It looks like that NoesisXaml.cs loss some important data.
It happens currently only to XAMLs who are nested in the root XAML.
Executable small demo project
http://www.mediafire.com/file/ltajyir5c ... UI_Bug.rar
If you have a problem with rars. Let me know, and I will upload it as a zip.
Open the master scene under CaveDigger/Scenes/
I hope you can it reproduce and it's not just my pc. I mean, I could hardly live with that problem in the editor ... nah probably not. But Runtime? I think you know what I mean.
I post this here because I am not sure if your bug tracker is ready to use... looks so empty^^ and I need attention.
Video demonstration
https://www.youtube.com/watch?v=xhjz9OT ... HbDo3AVdlQ
Regards,
Heia Samahi
I've run into an annoying bug.
Every time I restart the unity editor. All non-root XAML "paths" files "breaks". And, I can build but not run the build.
Only when I retrigger the XAML import likely by adding a space in the XAML, it works again.
Noesis throws an exception which usually happens only with missing XAML. But, the XAMLs works if I retrigger the import. It looks like that NoesisXaml.cs loss some important data.
It happens currently only to XAMLs who are nested in the root XAML.
Executable small demo project
http://www.mediafire.com/file/ltajyir5c ... UI_Bug.rar
If you have a problem with rars. Let me know, and I will upload it as a zip.
Open the master scene under CaveDigger/Scenes/
I hope you can it reproduce and it's not just my pc. I mean, I could hardly live with that problem in the editor ... nah probably not. But Runtime? I think you know what I mean.
I post this here because I am not sure if your bug tracker is ready to use... looks so empty^^ and I need attention.
Video demonstration
https://www.youtube.com/watch?v=xhjz9OT ... HbDo3AVdlQ
- 0:00-0:30 Working GUI
- 0:30 Restarting Editor
- 0:45 Not working anymore
- 1:00 Retrigger XAML import.
- 1:15 Error changed from ChunkEditView.xaml to TileEditView.xaml
- 1:40 After several reimports .. GUI working again.
- 1:50 Funny thing: Normally I must retriggering the DialogBasic & DialogList XAML as well. But not this time.
- 2:00-2:30 Restart Unity
- 2:30 Retriggering, just the Root Xaml, does not help at all.
- 2:50 Showing Noesis View Component
- Unity Version 2017.4.0f1 (b5bd171ee9ba)
- Noesis Version 2.1.0f1
Code: Select all
NoesisException: Xaml not found 'Assets/CaveDigger/UI/DialogSystem/DialogListView.xaml'
Rethrow as NoesisException
Noesis.Error.Check () (at Assets/NoesisGUI/Plugins/API/Core/NoesisError.cs:17)
Noesis.GUI.Noesis_LoadXaml_ (System.String xaml) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:275)
Noesis.GUI.LoadXaml (System.String xaml) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:125)
HeiKyu.Framework.XAML.DialogSystem.DialogList..ctor (HeiKyu.Framework.XAML.DialogSystem.DialogServices services, System.String title, System.String text, System.String buttonOk, System.String buttonCancel) (at Assets/CaveDigger/UI/DialogSystem/DialogList.cs:55)
HeiKyu.Framework.XAML.DialogSystem.DialogList..ctor (HeiKyu.Framework.XAML.DialogSystem.DialogServices services, System.String title, System.String text, System.String buttonOk, System.String buttonCancel, System.Action`1 buttonOkAction, System.Action`1 buttonCancelAction) (at Assets/CaveDigger/UI/DialogSystem/DialogList.cs:22)
CaveDigger.Scripts.UI.MainEditorViewModel.OnButtonClickMenuBarFileLoad () (at Assets/CaveDigger/Scripts/UI/MainEditorViewModel.cs:406)
CaveDigger.Scripts.UI.MainEditorViewModel.<Start>m__5 (System.Object o) (at Assets/CaveDigger/Scripts/UI/MainEditorViewModel.cs:153)
CaveDigger.Scripts.UI.DelegateCommand.Execute (System.Object parameter) (at Assets/CaveDigger/Scripts/UI/DelegateCommand.cs:42)
Noesis.Extend.CommandExecute (IntPtr cPtr, IntPtr paramType, IntPtr paramPtr) (at Assets/NoesisGUI/Plugins/API/Core/NoesisExtend.cs:1874)
Rethrow as NoesisException
Noesis.Error.Check () (at Assets/NoesisGUI/Plugins/API/Core/NoesisError.cs:17)
Noesis.View.Noesis_View_MouseButtonUp_ (HandleRef view, Int32 x, Int32 y, Int32 button) (at Assets/NoesisGUI/Plugins/API/Core/NoesisView.cs:457)
Noesis.View.MouseButtonUp (Int32 x, Int32 y, MouseButton button) (at Assets/NoesisGUI/Plugins/API/Core/NoesisView.cs:161)
NoesisView.ProcessEvent (UnityEngine.Event ev, Boolean enableKeyboard, Boolean enableMouse, Boolean emulateTouch) (at Assets/NoesisGUI/Plugins/NoesisView.cs:878)
NoesisView.OnGUI () (at Assets/NoesisGUI/Plugins/NoesisView.cs:950)
Heia Samahi
Last edited by Heia Samahi on 11 Apr 2018, 10:28, edited 1 time in total.
Re: [Unity][Bug?] Missing xaml exception - But it works... sort of...
As explained in the Unity tutorial, non roots XAMLs need to be referenced somewhere or Unity will discard them. You can use the Preloaded Xamls list for that purpose.
We are working in an automatic way to detect this (by inspecting the XAML and detecting user controls) but it is not going not be a perfect solution. So it is better if you do it manually.
We are working in an automatic way to detect this (by inspecting the XAML and detecting user controls) but it is not going not be a perfect solution. So it is better if you do it manually.
- Heia Samahi
- Posts: 8
- Joined:
Re: [Unity][Bug?] Missing xaml exception - But it works... sort of...
Hello,
This is not really explained on the tutorial page. This should be described in more detail in the documentation. Because I read this.
If I want to load XAML from the code, yes, this is explained and looks very familiar in the Unity environment.
But I thought wrong. I thought, I don't need to do that because I don't load XAML from code.
Why did I think that? That non-root XAML is embedded in the root XAML.
But yes, I understand it now. Noesis "ignore" that and don't reference the sub XAML.assets in editor time and don't save the reference in the root XAML.asset. Of course, then it's not possible that Unity holds the reference at runtime.
I read about the problem already in another thread. But I didn't expect my problem is the same.
So, sorry for the fussiness and thank you for your time. I haven't tested it yet. But, it sounds already that I was the problem.
I mark that thread as answered, as soon as I have tested it.
Thank you.
This is not really explained on the tutorial page. This should be described in more detail in the documentation. Because I read this.
If I want to load XAML from the code, yes, this is explained and looks very familiar in the Unity environment.
But I thought wrong. I thought, I don't need to do that because I don't load XAML from code.
Why did I think that? That non-root XAML is embedded in the root XAML.
But yes, I understand it now. Noesis "ignore" that and don't reference the sub XAML.assets in editor time and don't save the reference in the root XAML.asset. Of course, then it's not possible that Unity holds the reference at runtime.
I read about the problem already in another thread. But I didn't expect my problem is the same.
So, sorry for the fussiness and thank you for your time. I haven't tested it yet. But, it sounds already that I was the problem.
I mark that thread as answered, as soon as I have tested it.
Thank you.
Re: [Unity][Bug?] Missing xaml exception - But it works... sort of...
You are totally right, the documentation is not clear about this, sorry about it. We will fix it and also will try to autodetect XAML dependencies when using UserControls.
Thanks for your feedback and your awesome repro project and included video.
Thanks for your feedback and your awesome repro project and included video.
- Heia Samahi
- Posts: 8
- Joined:
Re: [Unity][Bug?] Missing xaml exception - But it works... sort of...
Thanks, but I am still struggling.Thanks for your feedback and your awesome repro project and included video.
What do I write into the InitializeComponent() method in a non-root XAML?
I mean, it's a UserControl. It has only on the XAML side a reference.
In the XAML it looks like this:
Code: Select all
<dialogsystem:DialogView x:Name="DialogView"/>
I have tried following things:
Method 1: Of course this work only for root xamls
Code: Select all
Noesis.GUI.LoadComponent(this, "Assets/CaveDigger/Resources/UI/DialogSystem/DialogView.xaml");
Code: Select all
NoesisXaml xaml = (NoesisXaml)UnityEngine.Resources.Load("UI/DialogSystem/DialogView", typeof(NoesisXaml))
xaml.LoadComponent(this);
Code: Select all
Exception: Unexpected empty XAML. Please reimport again
NoesisXaml.LoadComponent (object) (at Assets/NoesisGUI/Plugins/NoesisXaml.cs:38)
HeiKyu.Framework.XAML.DialogSystem.DialogView.InitializeComponent () (at Assets/CaveDigger/Resources/UI/DialogSystem/DialogView.xaml.cs:32)
Method 3: Total failure. Deathlock into infinitely load-cycle. But makes sense. It loads the XAML with the cs file. What ends up here again.
Code: Select all
NoesisXaml xaml = (NoesisXaml)UnityEngine.Resources.Load("UI/DialogSystem/DialogView", typeof(NoesisXaml))
Content = xaml.Load();
https://github.com/Noesis/Tutorials/tre ... serControl
So what do I wrong?
You wrote in the section "Loading XAML by Code"
Mean this, it's currently not possible?Problem with this approach is that it is not compatible with WPF.
Also that I just insert a UserControl via XAML? Or is there a solution?
I mean, I could load the UserControls from hand (in the root XAML class) and set the Content into placeholders. But it's more a ducktape solution.
Regards,
Heia Samahi
Re: [Unity][Bug?] Missing xaml exception - But it works... sort of...
The recommended way right now is writing this in the InitializeComponent() (by the way we recommend following the Blend convention of naming the class DialogView.xaml.cs to indicate it is the code-behind):Thanks, but I am still struggling.
What do I write into the InitializeComponent() method in a non-root XAML?
I mean, it's a UserControl. It has only on the XAML side a reference.
In the XAML it looks like this:Code: Select all<dialogsystem:DialogView x:Name="DialogView"/>
Code: Select all
Noesis.GUI.LoadComponent(this, "Assets/CaveDigger/Resources/UI/DialogSystem/DialogView.xaml");
- Heia Samahi
- Posts: 8
- Joined:
Re: [Unity][Bug?] Missing xaml exception - But it works... sort of...
Thanks, I know that. I just forgot it to write it here.by the way we recommend following the Blend convention of naming the class DialogView.xaml.cs to indicate it is the code-behind
I will use the list. I thought there is maybe another way. But it would be nice if the autodetect comes in near future.
And I found it very strange that Method 2. does not work.
But if someday I change my other project with mod support to noesis, I just have to write myself a XAML importer that can do that during the runtime, for the mod UI's. Then the method will work too, I think.
That's the good thing, the whole XAML / Texture / Font Processor comes with source code. Thanks for that. It would be annoying to decompile a DLL for that.
Regards,
Heia Samahi
Re: [Unity][Bug?] Missing xaml exception - But it works... sort of...
Yes, we are working on it.I will use the list. I thought there is maybe another way. But it would be nice if the autodetect comes in near future.
It should work, are you sure you moved both the .xaml and corresponding .asset inside a /Resources/ folder? I will try to reproduce the issue as soon as possible.And I found it very strange that Method 2. does not work.
- Heia Samahi
- Posts: 8
- Joined:
Re: [Unity][Bug?] Missing xaml exception - But it works... sort of...
Yes, the whole UI folder is under Resources. Unity seems not the problem.It should work, are you sure you moved both the .xaml and corresponding .asset inside a /Resources/ folder? I will try to reproduce the issue as soon as possible.
This is working. I get the NoesisXaml from Resources folder.
Code: Select all
NoesisXaml xaml = (NoesisXaml)UnityEngine.Resources.Load("UI/Views/Controls/ChunkEditView", typeof(NoesisXaml));
Code: Select all
xaml.LoadComponent(this);
Code: Select all
Exception: Unexpected empty XAML. Please reimport again
NoesisXaml.LoadComponent (object) (at Assets/NoesisGUI/Plugins/NoesisXaml.cs:38)
HeiKyu.Framework.XAML.DialogSystem.DialogView.InitializeComponent () (at Assets/CaveDigger/Resources/UI/DialogSystem/DialogView.xaml.cs:32)
Code: Select all
#if UNITY_5_3_OR_NEWER
#define NOESIS
using Noesis;
#else
using System.Windows.Controls;
#endif
namespace CaveDigger.UI.Views.Controls
{
/// <summary>
/// Interaktionslogik für ChunkEditView.xaml
/// </summary>
public partial class ChunkEditView : UserControl
{
public ChunkEditView()
{
InitializeComponent();
}
#if NOESIS
private void InitializeComponent()
{
//GUI.LoadComponent(this, "Assets/CaveDigger/Resources/UI/Views/Controls/ChunkEditView.xaml");
NoesisXaml xaml = (NoesisXaml)UnityEngine.Resources.Load("UI/Views/Controls/ChunkEditView", typeof(NoesisXaml));
xaml.LoadComponent(this);
}
#endif
}
}
New, updated demo project.
http://www.mediafire.com/file/tr7tua3zg ... ug%202.rar
(Open the master scene under CaveDigger/Scene/)
- EspiraPhoenix
- Posts: 1
- Joined:
- Location: Australia
- Contact:
Re: [Unity][Bug?] Missing xaml exception - But it works... sort of...
Hello, I'm a bit new to NoesisGUI, but I might be able to help here as I had encountered this issue too.And here it throws the exception:Code: Select allxaml.LoadComponent(this);
Code: Select allException: Unexpected empty XAML. Please reimport again NoesisXaml.LoadComponent (object) (at Assets/NoesisGUI/Plugins/NoesisXaml.cs:38) HeiKyu.Framework.XAML.DialogSystem.DialogView.InitializeComponent () (at Assets/CaveDigger/Resources/UI/DialogSystem/DialogView.xaml.cs:32)
The exception is being thrown because of a minor bug with the IF statement inside the LoadComponent method (at Assets/NoesisGUI/Plugins/NoesisXaml.cs, line 36).
Replacing:
Code: Select all
if (CanLoad())
Code: Select all
if (!CanLoad())
Who is online
Users browsing this forum: Google [Bot] and 90 guests