Sybaris
Topic Author
Posts: 39
Joined: 21 Feb 2019, 10:13

Freezable object cannot be made unmodifiable

03 Aug 2022, 11:09

I'm getting errors like this:

[NOESIS/E] Freezable object cannot be made unmodifiable
UnityEngine.Debug:LogError (object,UnityEngine.Object)
[NOESIS/E] Can't Freeze 'SolidColorBrush'
UnityEngine.Debug:LogError (object,UnityEngine.Object)

I have no idea where they come from. There is no file name or line number. And I'm freezing nothing (at least not knowingly).
Could you give me a hint?

G.

PS: Maybe this helps:

Unhandled log message: '[Error] [NOESIS/E] Freezable object cannot be made unmodifiable'. Use UnityEngine.TestTools.LogAssert.Expect
---
NoesisUnity:UnityLog (int,string) (at NoesisGUI-Unity-3.1.4-Indie/Runtime/NoesisUnity.cs:357)
Noesis.View:CreateCPtr (System.Type,bool&) (at NoesisGUI-Unity-3.1.4-Indie/Runtime/API/Core/View.cs:535)
Noesis.BaseComponent:.ctor () (at NoesisGUI-Unity-3.1.4-Indie/Runtime/API/Proxies/BaseComponentExtend.cs:17)
Noesis.DispatcherObject:.ctor () (at NoesisGUI-Unity-3.1.4-Indie/Runtime/API/Proxies/DispatcherObject.cs:30)
Noesis.View:.ctor (System.Runtime.InteropServices.HandleRef) (at NoesisGUI-Unity-3.1.4-Indie/Runtime/API/Core/View.cs:519)
Noesis.View:.ctor (Noesis.FrameworkElement) (at NoesisGUI-Unity-3.1.4-Indie/Runtime/API/Core/View.cs:492)
NoesisView:CreateView (Noesis.FrameworkElement) (at NoesisGUI-Unity-3.1.4-Indie/Runtime/NoesisView.cs:1497)
NoesisView:LoadXaml (bool) (at NoesisGUI-Unity-3.1.4-Indie/Runtime/NoesisView.cs:485)
NoesisView:OnEnable () (at NoesisGUI-Unity-3.1.4-Indie/Runtime/NoesisView.cs:609)
UnityEngine.Object:Instantiate<UnityEngine.GameObject> (UnityEngine.GameObject)
NewTestScript/<NewTestScriptWithEnumeratorPasses>d__1:MoveNext () (at Assets/NewTests/NewTestScript.cs:25)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: Noesis crashes Unity when using Unit Tests and forgetting Noesis.GUI.Init()

03 Aug 2022, 12:16

In Noesis Settings you can change "General Log Level" to "Information" to print the xaml files being loaded, that can narrow the error to a specific file.
It would be great if you can provide a sample xaml to reproduce this issue so we can debug it.
In theory our code only freezes the brushes that are returned in the Brushes static class (but those are newly created so they should be able to freeze), and resources shared in a template (but we check if they can be frozen before any attempt to freeze).
 
Sybaris
Topic Author
Posts: 39
Joined: 21 Feb 2019, 10:13

Re: Noesis crashes Unity when using Unit Tests and forgetting Noesis.GUI.Init()

03 Aug 2022, 15:11

The information log didn't help much but I figured that VS in the WPF solution also complains with the same error message.
And it marks the specific line: ("Setter" is underlined)

<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />

The referenced resource is defined like this:

<FontFamily x:Key="ContentControlThemeFontFamily">#Segoe UI</FontFamily>

But even if I replace the DynamicResource with a text constant, the problem still remains. I believe that it has to do with the style and not the references.

It's close to impossible to give you a reference solution for debugging, because the solution is pretty big and pretty chaotic and it only seems to happen in this - very big - context.
And I believe that this is the problem: there are somewhere some misplaced references that crash the system.
But till now I can't see how to identify the problematic definitions...

EDIT: The error message that I get is pretty weird (originally it's in german): "As soon as a Style-object is frozen, it cannot be changed"...
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: Freezable object cannot be made unmodifiable

03 Aug 2022, 19:26

This error (FontFamily setter) does not seem the same as the previous message (SolidColorBrush), but may be related, probably something in the same Style.
But I don't understand how a sealed Style can be modified without coding, just using it in xaml. To get some context, is that Style part of the App.xaml resources (ApplicationResources)? What control type is targeting?

P.S.: If you intend to use a local font of your project (instead of a system installed font), you are missing the folder part before the hash. It should be "./#Segoe UI" or if it is in a subfolder "Fonts/#Segoe UI" for example.

Who is online

Users browsing this forum: Bing [Bot] and 5 guests