SiliconStudio / xenko

Old repo for Xenko Game Engine. Please use https://github.com/xenko3d/xenko instead.
http://xenko.com
1.54k stars 346 forks source link

Compilation fails when class is added on an entity #635

Open SeleDreams opened 6 years ago

SeleDreams commented 6 years ago

Hi, i have a weird problem, i have a class that doesn't contain errors and compiles perfectly, if i add this class to an entity and compile, the compilation will fail, however, if i add an other class to an entity and add the class i wanted to add, at runtime on the entity, it will this time work perfectly, but it's not optimized, and not really a great way to proceed, i think the problem may be related to the fact that the class contains a dictionary<int,dynamic> i think that this is a bug because i've some times been able to add the script and compile perfectly fine, but randomly it starts to stop working and it won't compile this is the compilation log

Restauration des packages NuGet... Pour empêcher NuGet de restaurer les packages lors de la génération, ouvrez la boîte de dialogue des options de Visual Studio, cliquez sur le nœud Gestionnaire de package et désactivez Autoriser NuGet à télécharger les packages manquants lors de la génération. 1>------ Début de la régénération globale : Projet : DreamOfMoonlight.Game, Configuration : Debug Any CPU ------ 1> Patch for assembly [DreamOfMoonlight.Game, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] 1> DreamOfMoonlight.Game -> C:\Users\Admin\Documents\Xenko Projects\Dream_of_Moonlight\dream-of-moonlight-official-source-code\DreamOfMoonlight\DreamOfMoonlight\Bin\Windows\Debug\DreamOfMoonlight.Game.dll 2>------ Début de la régénération globale : Projet : DreamOfMoonlight.Windows, Configuration : Debug Any CPU ------ 2> Impossible de résoudre le conflit entre "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" et "System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes". Choix arbitraire de "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". 2> Patch for assembly [DreamOfMoonlight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] 2> DreamOfMoonlight.Windows -> C:\Users\Admin\Documents\Xenko Projects\Dream_of_Moonlight\dream-of-moonlight-official-source-code\DreamOfMoonlight\DreamOfMoonlight\Bin\Windows\Debug\DreamOfMoonlight.exe 2> info 0.000s: [AssetCompiler] BuildEngine arguments: --disable-auto-compile --project-configuration Debug --platform=Windows --profile=Windows --project-configuration=Debug --output-path=C:\Users\Admin\Documents\Xenko Projects\Dream_of_Moonlight\dream-of-moonlight-official-source-code\DreamOfMoonlight\DreamOfMoonlight\Bin\Windows\Debug\data --build-path=C:\Users\Admin\Documents\Xenko Projects\Dream_of_Moonlight\dream-of-moonlight-official-source-code\DreamOfMoonlight\DreamOfMoonlight\DreamOfMoonlight.Windows..\Cache\data --package-file=C:\Users\Admin\Documents\Xenko Projects\Dream_of_Moonlight\dream-of-moonlight-official-source-code\DreamOfMoonlight\DreamOfMoonlight\DreamOfMoonlight.Windows..\DreamOfMoonlight.xkpkg --log-pipe= 2> info 0.000s: [AssetCompiler] Starting builder. 2>C:\Users\Admin\Documents\Xenko Projects\Dream_of_Moonlight\dream-of-moonlight-official-source-code\DreamOfMoonlight\DreamOfMoonlight\Assets\Shared\MainScene.xkscene(27,55): warning 2.356s: [AssetCompiler] Ignored dictionary item that could not be deserialized 2>C:\Users\Admin\Documents\Xenko Projects\Dream_of_Moonlight\dream-of-moonlight-official-source-code\DreamOfMoonlight\DreamOfMoonlight\Assets\Shared\MainScene.xkscene(16,21): warning 2.356s: [AssetCompiler] Ignored member [Entity.Components] that could not be deserialized: 2> (Lin: 15, Col: 20, Chr: 446) - (Lin: 15, Col: 20, Chr: 446): Error while deserializing node [Mapping start [anchor = , tag = , isImplicit = True, style = Normal]]: 2> La reference d'objet n'est pas definie a une instance d'un objet. 2> info 3.010s: [AssetCompiler] Processing convex hull generation, this might take a while! 2> info 3.010s: [AssetCompiler] Node generated 1 convex hulls 2> info 3.011s: [AssetCompiler] For a total of 19 vertexes 2> info 3.013s: [AssetCompiler] Processing convex hull generation, this might take a while! 2> info 3.013s: [AssetCompiler] Node generated 1 convex hulls 2> info 3.013s: [AssetCompiler] For a total of 114 vertexes 2> info 3.015s: [AssetCompiler] Processing convex hull generation, this might take a while! 2> info 3.015s: [AssetCompiler] Node generated 1 convex hulls 2> info 3.015s: [AssetCompiler] For a total of 110 vertexes 2>EXEC : error 3.017s: [AssetCompiler] Exception in command Scene command for asset 'MainScene'.: System.NullReferenceException: La reference d'objet n'est pas definie a une instance d'un objet. 2> a SiliconStudio.Xenko.Engine.EntityTransformExtensions.FindRoot(Entity entity) dans C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Engine\EntityTransformExtensions.cs:ligne 121 2> a SiliconStudio.Xenko.Engine.Scene.AddItem(Entity item) dans C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Engine\Scene.cs:ligne 164 2> a SiliconStudio.Xenko.Assets.Entities.SceneAssetCompiler.SceneCommand.DoCommandOverride(ICommandContext commandContext) dans C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Assets\Entities\SceneAssetCompiler.cs:ligne 37 2> a SiliconStudio.BuildEngine.CommandBuildStep.d20.MoveNext() dans C:\TeamCity\work\80a49494ba341a6a\sources\common\buildengine\SiliconStudio.BuildEngine.Common\CommandBuildStep.cs:ligne 0 2>EXEC : error 3.017s: [AssetCompiler] BuildStep Scene command for asset 'MainScene'. failed. 2>EXEC : error 3.017s: [AssetCompiler] Exception in command Scene command for asset 'MainScene'.: System.NullReferenceException: La reference d'objet n'est pas definie a une instance d'un objet. 2> a SiliconStudio.Xenko.Engine.EntityTransformExtensions.FindRoot(Entity entity) dans C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Engine\EntityTransformExtensions.cs:ligne 121 2> a SiliconStudio.Xenko.Engine.Scene.AddItem(Entity item) dans C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Engine\Scene.cs:ligne 164 2> a SiliconStudio.Xenko.Assets.Entities.SceneAssetCompiler.SceneCommand.DoCommandOverride(ICommandContext commandContext) dans C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Assets\Entities\SceneAssetCompiler.cs:ligne 37 2> a SiliconStudio.BuildEngine.CommandBuildStep.d20.MoveNext() dans C:\TeamCity\work\80a49494ba341a6a\sources\common\buildengine\SiliconStudio.BuildEngine.Common\CommandBuildStep.cs:ligne 0 2>EXEC : error 3.017s: [AssetCompiler] BuildStep Scene command for asset 'MainScene'. failed. 2>EXEC(1,1): error 3.017s: [AssetCompiler] Asset [MainScene] failed to compile 2>EXEC : error 3.017s: [AssetCompiler] BuildStep Asset build steps [SceneAsset:'MainScene'] (1 items) failed. 2>EXEC : error 3.040s: [AssetCompiler] BuildStep Build step list (408 items) failed. 2>EXEC : error 3.041s: [AssetCompiler] BuildStep Build step list (1 items) failed. 2>EXEC : error 3.042s: [AssetCompiler] Build finished in 869 steps. Command results: 0 succeeded, 865 up-to-date, 4 failed, 0 not triggered due to previous failure. 2>EXEC : error 3.042s: [AssetCompiler] Build failed. 2> info 3.073s: [AssetCompiler] Generate bundles: Scan assets and their dependencies... 2> info 3.073s: [AssetCompiler] Generate bundles: Assign assets to bundles... 2> info 3.239s: [AssetCompiler] Generate bundles: Compress and save bundles to HDD... 2> info 3.285s: [AssetCompiler] Generate bundles: Done 2> RunTime 00:00:03.56 2>C:\Program Files\Silicon Studio\Xenko\GamePackages\Xenko.2.1.0.3\Targets\Xenko.targets(360,5): error MSB3073: La commande ""C:\Program Files\Silicon Studio\Xenko\GamePackages\Xenko.2.1.0.3\Bin\Windows\SiliconStudio.Assets.CompilerClient.exe" --disable-auto-compile --project-configuration "Debug" --platform=Windows --profile=Windows --project-configuration=Debug --output-path="C:\Users\Admin\Documents\Xenko Projects\Dream_of_Moonlight\dream-of-moonlight-official-source-code\DreamOfMoonlight\DreamOfMoonlight\Bin\Windows\Debug\data" --build-path="C:\Users\Admin\Documents\Xenko Projects\Dream_of_Moonlight\dream-of-moonlight-official-source-code\DreamOfMoonlight\DreamOfMoonlight\DreamOfMoonlight.Windows..\Cache\data" --package-file="C:\Users\Admin\Documents\Xenko Projects\Dream_of_Moonlight\dream-of-moonlight-official-source-code\DreamOfMoonlight\DreamOfMoonlight\DreamOfMoonlight.Windows..\DreamOfMoonlight.xkpkg" --log-pipe=""" s'est arrêtée avec le code 1. ========== Régénération globale : 1 a réussi, 1 a échoué, 0 a été ignoré ==========`

EDIT : adding [DataMemberIgnore] to the variable seems to fix the problem, but it means that xenko should handle the dictionary<int,dynamic> problem by automatically ignoring it or managing this kind of dictionary

EDIT 2 : it fixed only one time the problem, i've recompiled a second time and i got the error

Kryptos-FR commented 6 years ago

Xenko can't handle dynamic dictionaries in the property grid because as their name suggest, there content is dynamic so there is no information about the type.

On the other hand are you sure you need a dictionary of dynamic? That will create a lot of overhead and usually there is a better way. Like using an interface or at the very least a dictionary of object.