View Issue Details

IDProjectCategoryView StatusLast Update
0001388NoesisGUIUnity3Dpublic2019-07-18 21:18
ReporterasusralisAssigned Tosfernandez 
PrioritynormalSeverityblockReproducibilityunable to reproduce
Status resolvedResolutionfixed 
Product Version2.1.0f1 
Target Version2.2.4Fixed in Version2.2.4 
Summary0001388: XAML freezes Unity on Begin MonoManager ReloadAssembly
DescriptionForum reference: https://www.noesisengine.com/forums/viewtopic.php?f=3&p=8910#p8910

After dealing with random freezing in Unity for a week, we think we've pinned it down to an XAML change.

<ItemsControl Grid.Row="2" Grid.RowSpan="2" ItemsSource="{Binding Character.Specialty.Skills}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Image Source="{Binding Icon}" Margin="5"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>

Code:
[JsonIgnore]
        public Noesis.TextureSource Icon
        {
            get
            {
                return new Noesis.TextureSource(Resources.Load<Texture2D>("Icons/Icon.1_01"));
            }
        }

The icon shows, but after the instance of the game in the editor is closed and then opened again, it freezes before it can start. The last lines in the editor logs reads:
Reloading assemblies for play mode.
Begin MonoManager ReloadAssembly

The engine will also not compile after the game has played once. It will also get stuck on Begin MonoManager ReloadAssembly. Calling the Icon property anywhere else will not freeze the editor - only after the binding is binded to the Icon property. The freeze will also not happen if the texture itself is null.
Steps To ReproduceCannot reproduce in a new project. Binding needs to bind to a TextureSource and the texture itself cannot null. No runtime freezes, but after you close the instance of the game in the editor it can either freeze by clicking play again, compiling, or importing something.
TagsNo tags attached.
PlatformAny

Activities

nokola

nokola

2019-01-11 04:16

reporter   ~0005393

I have a similar problem (Unity hangs up) when assigning Texture2D to Image.Source in C#. Very open to testing a fix in a private build once you have it :) Or can wait for the public new version.
sfernandez

sfernandez

2019-01-30 14:01

manager   ~0005426

Last edited: 2019-01-30 14:02

View 2 revisions

I created a test following the indications and I'm not able to reproduce the freezing.
@asusralis Could you please attach Visual Studio debugger to Unity process when it is frozen, pause the process and generate a Minidump (Debug menu > Save Dump As...)?

@nokola Do you have a deterministic way of reproducing the hangs? Would it be possible to share with us in private your project to see if we can reproduce it ourselves and debug it?

sfernandez

sfernandez

2019-04-05 12:32

manager   ~0005594

Any chance to generate a mini-dump when the Unity process is frozen?
NirHasson

NirHasson

2019-05-16 12:20

reporter   ~0005680

Last edited: 2019-05-16 12:27

View 2 revisions

Hi,

I've stumbled with the same issue.
Was able to reproduce in your Inventory sample, see attached sources.
You'll have to run the sample and drag an item just to run my code that triggers image source property changed notification



Inventory.zip (12,308 bytes)
NirHasson

NirHasson

2019-05-16 12:21

reporter   ~0005681

In General, to solve it now you can use a utility class that returns cached Noesis.TextureSource for any existing UnityEngine.Texture2D
asusralis

asusralis

2019-07-11 23:55

reporter   ~0005843

I've ran into this problem again with a separate project. As soon as Unity froze I realized this was it!

"Save Dump as..." is grayed out. How would I be able to do that?
sfernandez

sfernandez

2019-07-12 13:10

manager   ~0005845

In windows Task Manager, expand "Unity Editor", right click on the process "Unity Editor 2019.1.....", and then "Create dump file".
It should be enabled for that inner process.
asusralis

asusralis

2019-07-13 06:10

reporter   ~0005848

Here it is! https://drive.google.com/open?id=1BHwP0Zj4LNxlapWST0HqFOWeTyJ5qLqS
stonstad

stonstad

2019-07-13 17:16

reporter   ~0005849

I'm running into an issue where, after ReloadAssembly, Unity is running but cannot be focused. I try to alt-tab to Unity but it does not gain keyboard or mouse input focus. Is this how your Unity "freezes" or is the freeze behavior different?
asusralis

asusralis

2019-07-15 00:28

reporter   ~0005850

That's the problem I have. This is what the task manager looks like: https://i.imgur.com/ovJeLOv.png
sfernandez

sfernandez

2019-07-16 12:06

manager   ~0005860

Found a workaround to avoid Unity lock-ups, it is not the final solution but will improve your productivity until we release the fix.
Just overwrite the attached files.

NoesisView.cs (42,094 bytes)
NoesisTexture.cs (963 bytes)
asusralis

asusralis

2019-07-16 12:40

reporter   ~0005862

I think the NoesisView file is extremely different from mine - that has 1,200 lines of code, but mine has 600. The file you sent me also doesn't have NoesisView in the Noesis namespace so I have 228 errors about ambiguity. Even when I put it in the Noesis namespace there are are 9 errors: https://i.imgur.com/14U6f5Y.png

The NoesisTexture seemed to not have any errors.
sfernandez

sfernandez

2019-07-16 14:03

manager   ~0005863

Sorry, I forgot to mention that attached files correspond to the ones found under Assets/NoesisGUI/Plugins folder.
Don't overwrite NoesisView.cs inside API/Core folder.
sfernandez

sfernandez

2019-07-16 14:07

manager   ~0005864

Also remark that these files are for NoesisGUI 2.2.3 version.
In case you are using an older version, go to NoesisGUI/Plugins/NoesisView.cs file and modify the function DestroyView() as follows:
private void DestroyView()
{
    if (_uiView != null)
    {
        lock (Noesis.Texture.Textures)
        {
            foreach (Noesis.Texture tex in Noesis.Texture.Textures)
            {
                tex.SetPrivateData(null);
            }
            Noesis.Texture.Textures.Clear();
        }

        // ...
    }
}
asusralis

asusralis

2019-07-16 14:25

reporter   ~0005865

Oh, sorry! I replaced the two files. That's awesome you found the problem!

Issue History

Date Modified Username Field Change
2019-01-10 19:38 asusralis New Issue
2019-01-10 19:39 asusralis Description Updated View Revisions
2019-01-11 04:16 nokola Note Added: 0005393
2019-01-15 17:10 jsantos Target Version => 2.2.0
2019-01-15 17:10 jsantos Assigned To => sfernandez
2019-01-15 17:10 jsantos Status new => assigned
2019-01-30 14:01 sfernandez Status assigned => feedback
2019-01-30 14:01 sfernandez Note Added: 0005426
2019-01-30 14:02 sfernandez Note Edited: 0005426 View Revisions
2019-03-18 22:08 sfernandez Target Version 2.2.0 => 2.2.1
2019-04-05 12:32 sfernandez Target Version 2.2.1 => 2.2.2
2019-04-05 12:32 sfernandez Note Added: 0005594
2019-04-30 10:58 sfernandez Target Version 2.2.2 => 2.2.3
2019-05-16 12:20 NirHasson File Added: Inventory.zip
2019-05-16 12:20 NirHasson Note Added: 0005680
2019-05-16 12:21 NirHasson Note Added: 0005681
2019-05-16 12:27 NirHasson Note Edited: 0005680 View Revisions
2019-06-18 16:59 sfernandez Target Version 2.2.3 => 2.2.4
2019-07-11 23:55 asusralis Note Added: 0005843
2019-07-11 23:55 asusralis Status feedback => assigned
2019-07-12 13:10 sfernandez Status assigned => feedback
2019-07-12 13:10 sfernandez Note Added: 0005845
2019-07-13 06:10 asusralis Note Added: 0005848
2019-07-13 06:10 asusralis Status feedback => assigned
2019-07-13 17:16 stonstad Note Added: 0005849
2019-07-15 00:28 asusralis Note Added: 0005850
2019-07-16 12:06 sfernandez File Added: NoesisView.cs
2019-07-16 12:06 sfernandez File Added: NoesisTexture.cs
2019-07-16 12:06 sfernandez Note Added: 0005860
2019-07-16 12:40 asusralis Note Added: 0005862
2019-07-16 14:03 sfernandez Status assigned => feedback
2019-07-16 14:03 sfernandez Note Added: 0005863
2019-07-16 14:07 sfernandez Note Added: 0005864
2019-07-16 14:25 asusralis Note Added: 0005865
2019-07-16 14:25 asusralis Status feedback => assigned
2019-07-18 21:18 sfernandez Status assigned => resolved
2019-07-18 21:18 sfernandez Resolution open => fixed
2019-07-18 21:18 sfernandez Fixed in Version => 2.2.4