View Issue Details

IDProjectCategoryView StatusLast Update
0002141NoesisGUIUnity3Dpublic2022-01-03 11:17
Reporterstonstad Assigned Tosfernandez  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.1.1 
Target Version3.1.2Fixed in Version3.1.2 
Summary0002141: Noesis 3.1.1 Upgrade Stuck in Import Loop
DescriptionNot sure if this is intended or if it will ever end. I'm on "iteration 43" 24 minutes into an asset upgrade (screenshot). Eventually I am going to kill it but I'm not sure if it is actually doing work. I doubt any kind of import process for XAML would take longer than 20 seconds.
TagsNo tags attached.
PlatformAny

Activities

stonstad

stonstad

2021-10-06 20:17

reporter  

import.PNG (26,253 bytes)   
import.PNG (26,253 bytes)   
stonstad

stonstad

2021-10-06 21:13

reporter  

import2.PNG (5,274 bytes)   
import2.PNG (5,274 bytes)   
stonstad

stonstad

2021-10-06 21:27

reporter   ~0007505

I force quit unity and I'm continuing w/ the upgrade.

New Error: I'm going through the Unity console errors generated by Noesis. First one is below.
connection.png (93,668 bytes)   
connection.png (93,668 bytes)   
stonstad

stonstad

2021-10-06 21:30

reporter   ~0007506

Next error appears to be related to the prior behavior I saw in a 3.x upgrade. It says XAML is not found, but clearly it exists and should be found, maybe.
N1.PNG (136,764 bytes)   
N1.PNG (136,764 bytes)   
N2.PNG (161,872 bytes)   
N2.PNG (161,872 bytes)   
N3.PNG (210,875 bytes)   
N3.PNG (210,875 bytes)   
N4.PNG (42,896 bytes)   
N4.PNG (42,896 bytes)   
sfernandez

sfernandez

2021-10-08 11:16

manager   ~0007508

Hi, we fixed several things regarding upgrade in 3.1.1 but it seems there are still more issues.
Would it be possible to get a copy of your project before upgrading, so we can debug what is happening during the upgrade process?
sfernandez

sfernandez

2021-10-08 11:18

manager   ~0007509

And just as a confirmation, I guess you are installing NoesisGUI 3.1.1 using the Package Manager with our plugin unzipped outside your project Assets/ folder, right?
stonstad

stonstad

2021-10-08 18:43

reporter   ~0007511

> And just as a confirmation, I guess you are installing NoesisGUI 3.1.1 using the Package Manager with our plugin unzipped outside your project Assets/ folder, right?
Yes, I did it correctly this time around.

> Would it be possible to get a copy of your project before upgrading, so we can debug what is happening during the upgrade process?
Yes. I made a mistake rolling back changes and I'm pulling down my game repository (100+GB) from GitHub and it going to take a long time... After it completes I'll see if I can provide a version that is the game with just XAML and image assets + scripts. Not sure what that would look like yet in terms of size.
sfernandez

sfernandez

2021-11-16 13:12

manager   ~0007573

Hello, would still be possible to get a copy of your project before the upgrade to analyze this problem?
stonstad

stonstad

2021-11-17 00:12

reporter   ~0007578

Last edited: 2021-11-17 22:27

Yes, thank you for reaching out. I will work to upload a project.

sfernandez

sfernandez

2021-11-18 10:11

manager   ~0007587

Thanks a lot for the project, we will investigate what is happening to fix it as soon as possible.
sfernandez

sfernandez

2021-11-24 16:17

manager   ~0007607

Hi, I've been testing the upgrade with your project and detected a few issues that were invalidating the same items many times, causing the process to take a lot of time to finish.
I managed to fix those problems, could you please test it yourself with the attached patch (changes only affect the scripts included in the Unity plugin).
sfernandez

sfernandez

2021-11-24 16:18

manager  

SlowUnityUpgrade.diff (1,960 bytes)   
Index: Unity/Editor/NoesisPostprocessor.cs
===================================================================
--- Unity/Editor/NoesisPostprocessor.cs	(revision 10931)
+++ Unity/Editor/NoesisPostprocessor.cs	(revision 10932)
@@ -10,6 +10,8 @@
 
 public class NoesisPostprocessor : AssetPostprocessor
 {
+    private static HashSet<string> _pendingXamls = new HashSet<string>();
+
     private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
     {
         string[] assets = importedAssets.Concat(movedAssets).ToArray();
@@ -16,7 +18,7 @@
 
         foreach (var asset in assets)
         {
-            if (IsXaml(asset))
+            if (IsXaml(asset) && !_pendingXamls.Contains(asset))
             {
                 EditorApplication.CallbackFunction d = null;
 
@@ -25,6 +27,7 @@
                 {
                     if (!EditorApplication.isCompiling && !EditorApplication.isUpdating)
                     {
+                        _pendingXamls.Remove(asset);
                         EditorApplication.update -= d;
 
                         try
@@ -54,6 +57,7 @@
                     }
                 };
 
+                _pendingXamls.Add(asset);
                 EditorApplication.update += d;
             }
         }
Index: Unity/Editor/NoesisUpdater.cs
===================================================================
--- Unity/Editor/NoesisUpdater.cs	(revision 10931)
+++ Unity/Editor/NoesisUpdater.cs	(revision 10932)
@@ -67,7 +67,10 @@
             AssetDatabase.DeleteAsset(Path.ChangeExtension(asset, ".asset"));
 
             // Reimport asset to assign proper importer
-            AssetDatabase.ImportAsset(asset);
+            if (AssetDatabase.GetImporterOverride(asset) == null)
+            {
+                AssetDatabase.ImportAsset(asset);
+            }
         }
     }
 
SlowUnityUpgrade.diff (1,960 bytes)   
stonstad

stonstad

2021-12-03 16:15

reporter   ~0007646

Hey Sergio -- I am circling back to this problem. Do you know if this fix is likely to address the issue of XAML files not being found by GUI.LoadComponent("path")?
sfernandez

sfernandez

2021-12-03 16:23

manager   ~0007647

The fix is only related to the upgrade process taking forever to finish.

The problem with xaml files not found it is more likely to be xamls that are being loaded in code and not referenced by the scene, so they are not available in the XamlProvider.
Are you instantiating UserControls in code?
stonstad

stonstad

2021-12-03 18:27

reporter   ~0007648

I'm instantiating user controls in code while making sure to forward declare an XAML dependency. With 3.1.x it seems like I received a large number of 'XAML not found' errors, when in fact the file path is correct. If pathing doesn't change between 3.0.x and 3.1.x, why would I get these errors?

Yesterday, I started getting the same behavior in 3.0.x, which is new for me. (screenshot below). You can see the XAML declaration, and the associated error message. What is perplexing is that if I manually reimport the asset it works until the next time Unity restarts.

I am posting screenshots of pathing so that I can double-check. Maybe it is a path length issue.
a.png (21,345 bytes)   
a.png (21,345 bytes)   
b.png (220,069 bytes)   
b.png (220,069 bytes)   
c.png (39,147 bytes)   
c.png (39,147 bytes)   
stonstad

stonstad

2021-12-03 18:31

reporter   ~0007649

Last edited: 2021-12-03 18:33

It is easy to misspell 'Communications' but if it is misspelled I am just not seeing it. To test pathing and rule out spelling I copied each path shown above and pasted them into the explorer to open the associated XAML file while navigated at the root folder of the project -- it works each time.

The complete file path length (C:\Users\stons\Source\StellarConquest\StellarConquest.Presentation.Unity\Assets\User Interface\Screens\Game\Overlay\Communications\CommunicationsControl.xaml.meta) is 163 characters. I guess we can rule that out.

stonstad

stonstad

2021-12-03 18:37

reporter   ~0007650

Last edited: 2021-12-03 18:44

OK, when I reimported the single control, this time Noesis dumped runtime (not compile time) exceptions to the window caused by bad runtime logic. The logic is not invariant -- and fails on XAML preview. So I think my reproduction workflow is something like this:

1) A user control exists in a working state.
2) I introduce a code change which messes up compilation or runtime logic during preview.
3) A code change kicks off reimport of the user control, but the bug associated with #2 is hit
4) The XAML for the user control cannot be found, due to #2.
5) It fails silently and I am hunting down unrelated pathing issues.
6) Lastly, if I manually reimport the error is shown, and I can fix it OR the error only occurs in preview, in which case I am required to reimport the control.

Lastly, in 3.1.x, maybe more of my controls are failing during the preview stage, and that is why I had so many XAML not found errors.

Note that all of the above is on 3.0.x, not 3.1.x. I am commenting on a behavior that I see in both 3.0.x and 3.1.x.

Update: the bad logic was when I called _Root.FindName("name") with an invalid name. This happens easily due to refactoring or changes in XAML. It is something of an error prone workflow and I think the take away here is that a failed preview or incremental import -- whatever it is -- should not prevent the XAML from generating. Or if generation previously failed, it should continue to report that XAML cannot be generated.

sfernandez

sfernandez

2021-12-07 17:31

manager   ~0007660

I think we should close this ticket about the import process.

And regarding the "XAML not found" issue, could you create a new ticket for that?
If you can provide reproduction steps in 3.1 version it would be better, becasue the code changed a lot from 3.0 and the import process is not the same.
stonstad

stonstad

2022-01-02 18:08

reporter   ~0007697

Specific to this issue, I can confirm the upgrade from 3.0.x to 3.1.2 worked smoothly. All XAML controls were properly upgraded and the XAML not found behavior is resolved. Thank you!
sfernandez

sfernandez

2022-01-03 11:17

manager   ~0007704

Glad to hear! thanks for the update.

Issue History

Date Modified Username Field Change
2021-10-06 20:17 stonstad New Issue
2021-10-06 20:17 stonstad File Added: import.PNG
2021-10-06 21:13 stonstad File Added: import2.PNG
2021-10-06 21:27 stonstad File Added: connection.png
2021-10-06 21:27 stonstad Note Added: 0007505
2021-10-06 21:30 stonstad File Added: N1.PNG
2021-10-06 21:30 stonstad File Added: N2.PNG
2021-10-06 21:30 stonstad File Added: N3.PNG
2021-10-06 21:30 stonstad File Added: N4.PNG
2021-10-06 21:30 stonstad Note Added: 0007506
2021-10-07 13:25 jsantos Assigned To => sfernandez
2021-10-07 13:25 jsantos Status new => assigned
2021-10-07 13:25 jsantos Product Version => 3.1.1
2021-10-07 13:25 jsantos Target Version => 3.1.2
2021-10-08 11:16 sfernandez Status assigned => feedback
2021-10-08 11:16 sfernandez Note Added: 0007508
2021-10-08 11:18 sfernandez Note Added: 0007509
2021-10-08 18:43 stonstad Note Added: 0007511
2021-10-08 18:43 stonstad Status feedback => assigned
2021-11-16 13:12 sfernandez Status assigned => feedback
2021-11-16 13:12 sfernandez Note Added: 0007573
2021-11-17 00:12 stonstad Note Added: 0007578
2021-11-17 00:12 stonstad Status feedback => assigned
2021-11-17 22:27 stonstad Note Edited: 0007578
2021-11-18 10:11 sfernandez Note Added: 0007587
2021-11-24 16:17 sfernandez Status assigned => feedback
2021-11-24 16:17 sfernandez Note Added: 0007607
2021-11-24 16:18 sfernandez File Added: SlowUnityUpgrade.diff
2021-12-03 16:15 stonstad Note Added: 0007646
2021-12-03 16:15 stonstad Status feedback => assigned
2021-12-03 16:23 sfernandez Status assigned => feedback
2021-12-03 16:23 sfernandez Note Added: 0007647
2021-12-03 18:27 stonstad File Added: a.png
2021-12-03 18:27 stonstad File Added: b.png
2021-12-03 18:27 stonstad File Added: c.png
2021-12-03 18:27 stonstad Note Added: 0007648
2021-12-03 18:27 stonstad Status feedback => assigned
2021-12-03 18:31 stonstad Note Added: 0007649
2021-12-03 18:33 stonstad Note Edited: 0007649
2021-12-03 18:37 stonstad Note Added: 0007650
2021-12-03 18:38 stonstad Note Edited: 0007650
2021-12-03 18:42 stonstad Note Edited: 0007650
2021-12-03 18:43 stonstad Note Edited: 0007650
2021-12-03 18:44 stonstad Note Edited: 0007650
2021-12-07 17:31 sfernandez Status assigned => feedback
2021-12-07 17:31 sfernandez Note Added: 0007660
2021-12-10 14:21 sfernandez Status feedback => resolved
2021-12-10 14:21 sfernandez Resolution open => fixed
2021-12-10 14:21 sfernandez Fixed in Version => 3.1.2
2022-01-02 18:08 stonstad Status resolved => feedback
2022-01-02 18:08 stonstad Resolution fixed => reopened
2022-01-02 18:08 stonstad Note Added: 0007697
2022-01-03 11:17 sfernandez Status feedback => resolved
2022-01-03 11:17 sfernandez Resolution reopened => fixed
2022-01-03 11:17 sfernandez Note Added: 0007704