Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 'Inner exception. Could not cast or convert from System.String to FlaxEngine.Tag' in COOKED game only. #2560

Open
buzzdx opened this issue May 5, 2024 · 1 comment
Labels
bug Something isn't working level Level building tools and components.
Milestone

Comments

@buzzdx
Copy link

buzzdx commented May 5, 2024

I was following the instructions on how to play different footstep sounds on different materials from the manual. I set up the SoundPerSurfaceType as a Dictionary<Tag, AudioClip> in my charcontroller and i filled it with values within the editor.

When running it from the editor it works as expected. However when cooking and then running the game the following will be in the log file and it does not work. Since it's causing an exception other things also don't get set up correctly in the controller so it causes other errors, but this is the problem that is causing it:

================================================================
           Start of the log, 2024-05-05 22:55:29
================================================================
[ 00:00:00.001 ]: [Info] Flax Engine
[ 00:00:00.001 ]: [Info] Platform: Windows x64 (Development)
[ 00:00:00.001 ]: [Info] Version 1.8.6511.1
[ 00:00:00.003 ]: [Info] Compiled: Apr 26 2024 19:26:28 C++14
[ 00:00:00.003 ]: [Info] Compiled with Visual C++ 19.39.33523.00
[ 00:00:00.003 ]: [Info] Product: Our3DQuiz, Company: CJB Inc.
[ 00:00:00.003 ]: [Info] Current culture: de-DE
[ 00:00:00.003 ]: [Info] Command line: 
[ 00:00:00.003 ]: [Info] Base folder: C:\Users/buzzdx/Documents/Flax Projects/Our3DQuest/Output/Windows
[ 00:00:00.003 ]: [Info] Binaries folder: C:\Users/buzzdx/Documents/Flax Projects/Our3DQuest/Output/Windows/
[ 00:00:00.003 ]: [Info] Temporary folder: C:\Users/buzzdx/AppData/Local/Temp/bbc255a8-4165-cfe9-885f-728cb993cff1
[ 00:00:00.003 ]: [Info] Project folder: C:\Users/buzzdx/Documents/Flax Projects/Our3DQuest/Output/Windows
[ 00:00:00.003 ]: [Info] CPU package count: 1, Core count: 8, Logical processors: 16
[ 00:00:00.003 ]: [Info] CPU Page size: 4 Kb, cache line size: 64 bytes
[ 00:00:00.003 ]: [Info] L1 cache: 512 Kb, L2 cache: 4 Mb, L3 cache: 32 Mb
[ 00:00:00.003 ]: [Info] Clock speed: 10 MHz
[ 00:00:00.003 ]: [Info] Physical Memory: 15.92 Gb total, 7.86 Gb used (49.36%)
[ 00:00:00.003 ]: [Info] Virtual Memory: 128 Tb total, 4.29 Gb used (0%)
[ 00:00:00.003 ]: [Info] Main thread id: 0x4bdc, Process id: 9544
[ 00:00:00.003 ]: [Info] Desktop size: X:1920 Y:1080
[ 00:00:00.003 ]: [Info] Virtual Desktop size: X:0 Y:0 Width:1920 Height:1080
[ 00:00:00.003 ]: [Info] Screen DPI: 96
[ 00:00:00.003 ]: [Info] Microsoft Windows 10 Pro 64-bit (10.0.19045)
[ 00:00:00.003 ]: [Info] Initialize Objects Removal Service...
[ 00:00:00.003 ]: [Info] Initialize Thread Pool...
[ 00:00:00.003 ]: [Info] Spawning 7 Thread Pool workers
[ 00:00:00.003 ]: [Info] Thread 'Thread Pool 0' ID=0x45c0 started with priority Normal
[ 00:00:00.003 ]: [Info] Initialize Time...
[ 00:00:00.003 ]: [Info] Thread 'Thread Pool 4' ID=0x1478 started with priority Normal
[ 00:00:00.003 ]: [Info] Initialize ContentStorage...
[ 00:00:00.003 ]: [Info] Initialize JobSystem...
[ 00:00:00.003 ]: [Info] Thread 'Thread Pool 2' ID=0x3e3c started with priority Normal
[ 00:00:00.003 ]: [Info] Thread 'Thread Pool 3' ID=0x1de8 started with priority Normal
[ 00:00:00.003 ]: [Info] Thread 'Thread Pool 1' ID=0x4b34 started with priority Normal
[ 00:00:00.003 ]: [Info] Thread 'Thread Pool 5' ID=0x2e60 started with priority Normal
[ 00:00:00.003 ]: [Info] Thread 'Job System 4' ID=0x2dd4 started with priority AboveNormal
[ 00:00:00.003 ]: [Info] Thread 'Job System 0' ID=0x63c started with priority AboveNormal
[ 00:00:00.003 ]: [Info] Thread 'Job System 1' ID=0x2d38 started with priority AboveNormal
[ 00:00:00.003 ]: [Info] Thread 'Job System 2' ID=0x45a0 started with priority AboveNormal
[ 00:00:00.003 ]: [Info] Thread 'Job System 3' ID=0x2f78 started with priority AboveNormal
[ 00:00:00.003 ]: [Info] Thread 'Job System 12' ID=0x4114 started with priority AboveNormal
[ 00:00:00.003 ]: [Info] Initialize Font Manager...
[ 00:00:00.003 ]: [Info] Thread 'Job System 5' ID=0x3998 started with priority AboveNormal
[ 00:00:00.004 ]: [Info] FreeType initialized, version: 2.10.0
[ 00:00:00.004 ]: [Info] Initialize Content...
[ 00:00:00.004 ]: [Info] Loading Asset Cache C:\Users/buzzdx/Documents/Flax Projects/Our3DQuest/Output/Windows/Content/AssetsCache.dat...
[ 00:00:00.004 ]: [Info] Thread 'Job System 6' ID=0x3f7c started with priority AboveNormal
[ 00:00:00.004 ]: [Info] Thread 'Job System 8' ID=0x3e70 started with priority AboveNormal
[ 00:00:00.004 ]: [Info] Thread 'Job System 7' ID=0x3700 started with priority AboveNormal
[ 00:00:00.004 ]: [Info] Thread 'Job System 9' ID=0x950 started with priority AboveNormal
[ 00:00:00.004 ]: [Info] Thread 'Job System 10' ID=0x4b20 started with priority AboveNormal
[ 00:00:00.004 ]: [Info] Thread 'Job System 11' ID=0x406c started with priority AboveNormal
[ 00:00:00.004 ]: [Info] Thread 'Thread Pool 6' ID=0x9e4 started with priority Normal
[ 00:00:00.004 ]: [Info] Thread 'Job System 13' ID=0x354c started with priority AboveNormal
[ 00:00:00.004 ]: [Info] Thread 'Job System 14' ID=0x4184 started with priority AboveNormal
[ 00:00:00.004 ]: [Info] Thread 'Job System 15' ID=0x38c4 started with priority AboveNormal
[ 00:00:00.005 ]: [Info] Asset Cache loaded 447 entries in 1ms (0 rejected)
[ 00:00:00.005 ]: [Info] Initialize Content Loading Manager...
[ 00:00:00.005 ]: [Info] Creating 8 content loading threads...
[ 00:00:00.005 ]: [Info] Thread 'Load Thread 0' ID=0x4c2c started with priority Normal
[ 00:00:00.005 ]: [Info] Thread 'Load Thread 1' ID=0x4080 started with priority Normal
[ 00:00:00.005 ]: [Info] Thread 'Load Thread 4' ID=0x4fc8 started with priority Normal
[ 00:00:00.005 ]: [Info] Initialize Localization...
[ 00:00:00.005 ]: [Info] Thread 'Load Thread 3' ID=0x27f0 started with priority Normal
[ 00:00:00.005 ]: [Info] Thread 'Load Thread 2' ID=0x4980 started with priority Normal
[ 00:00:00.005 ]: [Info] Thread 'Load Thread 5' ID=0x3474 started with priority Normal
[ 00:00:00.006 ]: [Info] Thread 'Load Thread 6' ID=0x50b0 started with priority Normal
[ 00:00:00.006 ]: [Info] Thread 'Load Thread 7' ID=0x331c started with priority Normal
[ 00:00:00.017 ]: [Info] Initialize GameSettings...
[ 00:00:00.018 ]: [Warning] Missing Network settings
[ 00:00:00.018 ]: [Info] Initialize Input...
[ 00:00:00.018 ]: [Info] Initialize Audio...
[ 00:00:00.018 ]: [Info] Audio system initialization... (backend: OpenAL)
[ 00:00:00.054 ]: [Info] Rebuilding audio contexts
[ 00:00:00.054 ]: [Info] Enabling OpenAL HRTF
[ 00:00:00.067 ]: [Info] OpenAL Soft (1.1 ALSOFT 1.23.1)
[ 00:00:00.067 ]: [Info] [active] Kopfhörer (HyperX Virtual Surround Sound)
[ 00:00:00.067 ]: [Info] G276HL (NVIDIA High Definition Audio)
[ 00:00:00.067 ]: [Info] Line (Steinberg UR24C)
[ 00:00:00.067 ]: [Info] Realtek Digital Output (Realtek(R) Audio)
[ 00:00:00.067 ]: [Info] Initialize Graphics...
================================================================
[ 00:00:00.067 ]: [Info] Creating Graphics Device...
[ 00:00:00.180 ]: [Info] Adapter 0: 'NVIDIA GeForce RTX 3060 Ti', DirectX 11
[ 00:00:00.180 ]: [Info] 	Dedicated Video Memory: 7.84 Gb, Dedicated System Memory: 0 b, Shared System Memory: 7.96 Gb, Output(s): 1
[ 00:00:00.181 ]: [Info] Adapter 1: 'Microsoft Basic Render Driver', DirectX 11
[ 00:00:00.181 ]: [Info] 	Dedicated Video Memory: 0 b, Dedicated System Memory: 0 b, Shared System Memory: 7.96 Gb, Output(s): 0
[ 00:00:00.276 ]: [Info] Video output '\\.\DISPLAY1' 1920x1080 60 Hz
[ 00:00:00.358 ]: [Info] Total graphics memory: 7.84 Gb
[ 00:00:00.358 ]: [Info] Graphics Device created! Adapter: 'NVIDIA GeForce RTX 3060 Ti', Renderer: DirectX 11, Shader Profile: DirectX SM5, Feature Level: SM5
================================================================
[ 00:00:00.361 ]: [Info] Initialize Windows Manager...
[ 00:00:00.361 ]: [Info] Initialize Scripting...
[ 00:00:00.361 ]: [Info] Found hostfxr in C:\Users\buzzdx\Documents\Flax Projects\Our3DQuest\Output\Windows\Dotnet\host\fxr\8.0.3\hostfxr.dll
[ 00:00:00.423 ]: [Info] .NET runtime version: .NET 8.0.3
[ 00:00:00.426 ]: [Info] Assembly System.Private.CoreLib loaded in 2ms
[ 00:00:00.462 ]: [Info] Caching classes for assembly System.Private.CoreLib took 35ms
[ 00:00:00.462 ]: [Info] Assembly FlaxEngine.CSharp loaded in 0ms
[ 00:00:00.509 ]: [Info] Caching classes for assembly FlaxEngine.CSharp took 47ms
[ 00:00:00.522 ]: [Info] Using FlaxAPI in Development
[ 00:00:00.531 ]: [Info] Main render task created
[ 00:00:00.531 ]: [Info] Loading binary modules from build info file C:\Users/buzzdx/Documents/Flax Projects/Our3DQuest/Output/Windows/Game.Build.json
[ 00:00:00.531 ]: [Info] Loading binary module FlaxEngine
[ 00:00:00.532 ]: [Info] Module FlaxEngine loaded in 1ms
[ 00:00:00.532 ]: [Info] Loading binary module Game
[ 00:00:00.533 ]: [Info] Assembly Game.CSharp loaded in 0ms
[ 00:00:00.534 ]: [Info] Caching classes for assembly Game.CSharp took 1ms
[ 00:00:00.536 ]: [Info] Scripting Engine initializated! (time: 175ms)
[ 00:00:00.536 ]: [Info] Initialize Animations...
[ 00:00:00.536 ]: [Info] Initialize Behaviors...
[ 00:00:00.536 ]: [Info] Initialize Profiling Tools...
[ 00:00:00.536 ]: [Info] Initialize Prefab Manager...
[ 00:00:00.536 ]: [Info] Initialize Physics...
[ 00:00:00.536 ]: [Info] Setup NVIDIA PhysX 5.1.3
[ 00:00:00.537 ]: [Info] Initialize Render2D...
[ 00:00:00.537 ]: [Info] Initialize Renderer...
[ 00:00:00.538 ]: [Info] Initialize Terrain Manager...
[ 00:00:00.538 ]: [Info] Initialize Atmosphere Pre Compute...
[ 00:00:00.538 ]: [Info] Initialize Navigation...
[ 00:00:00.538 ]: [Info] Initialize Particle Manager...
[ 00:00:00.538 ]: [Info] Initialize Streaming...
[ 00:00:00.538 ]: [Info] Initialize Plugin Manager...
[ 00:00:00.540 ]: [Info] Loading plugin CrowdSystem
[ 00:00:00.540 ]: [Info] Initialize Scene Manager...
[ 00:00:00.540 ]: [Info] Initialize Online...
[ 00:00:00.540 ]: [Info] Initialize Screen...
[ 00:00:00.540 ]: [Info] Initialize Probes Renderer...
[ 00:00:00.540 ]: [Info] Initialize Network Manager...
[ 00:00:00.540 ]: [Info] Initialize Network Replication...
[ 00:00:00.540 ]: [Info] Engine services are ready!
[ 00:00:00.584 ]: [Info] Showing game window
[ 00:00:00.584 ]: [Info] Loading the first scene
================================================================
[ 00:00:00.589 ]: [Info] Loading scene...
[ 00:00:00.675 ]: [Info] Scene loaded in 85ms
[ 00:00:00.713 ]: [Info] Starting Atmosphere Pre Compute service
[ 00:00:03.283 ]: [Info] Loading scene...
[ 00:00:03.353 ]: [Warning] Inner exception. Error converting value "Surface.Grass" to type 'FlaxEngine.Tag'. Path 'SoundPerSurfaceType['Surface.Grass']', line 1, position 1362.
Stack strace:
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
 
[ 00:00:03.353 ]: [Warning] Inner exception. Could not cast or convert from System.String to FlaxEngine.Tag.
Stack strace:
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
 
[ 00:00:03.353 ]: [Warning] Exception has been thrown during ManagedSerialization::Deserialize. Could not convert string 'Surface.Grass' to dictionary key type 'FlaxEngine.Tag'. Path 'SoundPerSurfaceType['Surface.Grass']', line 1, position 1362.
Stack strace:
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Populate(JsonReader reader, Object target)
   at Newtonsoft.Json.JsonSerializer.PopulateInternal(JsonReader reader, Object target)
   at Newtonsoft.Json.JsonSerializer.Populate(JsonReader reader, Object target)
   at FlaxEngine.Json.JsonSerializer.Deserialize(Object input, Byte* jsonBuffer, Int32 jsonLength)
   at FlaxEngine.Interop.NativeInterop.Invoker.InvokerStaticNoRet3`3.MarshalAndInvoke(Object delegateContext, ManagedHandle instancePtr, IntPtr paramPtr)
   at FlaxEngine.Interop.NativeInterop.InvokeMethod(ManagedHandle instanceHandle, ManagedHandle methodHandle, IntPtr paramPtr, IntPtr exceptionPtr) 
[ 00:00:03.353 ]: [Error] Exception has been thrown during ManagedSerialization::Deserialize.
Could not convert string 'Surface.Grass' to dictionary key type 'FlaxEngine.Tag'. Path 'SoundPerSurfaceType['Surface.Grass']', line 1, position 1362. 
[ 00:00:03.365 ]: [Warning] Invalid or missing asset (908f603f4a4dd92221258bbbfcc5fcf3, FlaxEngine.Asset).
[ 00:00:03.365 ]: [Warning] Unable to find scripting object with ID=908f603f4a4dd92221258bbbfcc5fcf3. Required type FlaxEngine.AudioClip.
[ 00:00:03.427 ]: [Warning] Inner exception. Error converting value "Surface.Grass" to type 'FlaxEngine.Tag'. Path 'SoundPerSurfaceType['Surface.Grass']', line 1, position 1362.
Stack strace:
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
 
[ 00:00:03.427 ]: [Warning] Inner exception. Could not cast or convert from System.String to FlaxEngine.Tag.
Stack strace:
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
 
[ 00:00:03.428 ]: [Warning] Exception has been thrown during ManagedSerialization::Deserialize. Could not convert string 'Surface.Grass' to dictionary key type 'FlaxEngine.Tag'. Path 'SoundPerSurfaceType['Surface.Grass']', line 1, position 1362.
Stack strace:
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Populate(JsonReader reader, Object target)
   at Newtonsoft.Json.JsonSerializer.PopulateInternal(JsonReader reader, Object target)
   at Newtonsoft.Json.JsonSerializer.Populate(JsonReader reader, Object target)
   at FlaxEngine.Json.JsonSerializer.Deserialize(Object input, Byte* jsonBuffer, Int32 jsonLength)
   at FlaxEngine.Interop.NativeInterop.Invoker.InvokerStaticNoRet3`3.MarshalAndInvoke(Object delegateContext, ManagedHandle instancePtr, IntPtr paramPtr)
   at FlaxEngine.Interop.NativeInterop.InvokeMethod(ManagedHandle instanceHandle, ManagedHandle methodHandle, IntPtr paramPtr, IntPtr exceptionPtr) 
[ 00:00:03.428 ]: [Error] Exception has been thrown during ManagedSerialization::Deserialize.
Could not convert string 'Surface.Grass' to dictionary key type 'FlaxEngine.Tag'. Path 'SoundPerSurfaceType['Surface.Grass']', line 1, position 1362. 
[ 00:00:03.441 ]: [Info] null
[ 00:00:03.457 ]: [Info] Resizing navmesh Default from 0 to 512 tiles capacity
[ 00:00:03.468 ]: [Info] Scene loaded in 185ms

Flax version:
1.8.6511.1

@mafiesto4 mafiesto4 added the bug Something isn't working label May 6, 2024
@mafiesto4 mafiesto4 added this to the 1.9 milestone May 6, 2024
@mafiesto4
Copy link
Member

Probably we will need to use FlaxEngine.TypeConverters.TagConverter (and other type converters) in cooked build or find a way to do it other way via Json TagConverter

@mafiesto4 mafiesto4 added the level Level building tools and components. label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working level Level building tools and components.
Projects
None yet
Development

No branches or pull requests

2 participants