stride3d / stride

Stride Game Engine (formerly Xenko)
https://stride3d.net
MIT License
6.46k stars 934 forks source link

Xenko.Core.Serialization.Contents.ContentManagerException when trying to run project #299

Closed justStand closed 5 years ago

justStand commented 5 years ago

Release Type: Official Release

Version: 3.1.0.1-beta01-0313

Platform(s): Windows

Describe the bug Whenever I try to run my project, I am met with an exception.

Log and callstacks

Xenko.Core.Serialization.Contents.ContentManagerException
  HResult=0x80131500
  Message=Unexpected exception while loading asset [GameSettings]. Reason: No serializer available for type id f6e78a35184f6fe1d27096e38ec09340 and base type Xenko.Data.Configuration. Check inner-exception for details.
  Source=Xenko.Core.Serialization
  StackTrace:
   at Xenko.Core.Serialization.Contents.ContentManager.DeserializeObject(Queue`1 serializeOperations, Reference parentReference, String url, Type objType, Object obj, ContentManagerLoaderSettings settings)

Inner Exception 1:
ArgumentException: No serializer available for type id f6e78a35184f6fe1d27096e38ec09340 and base type Xenko.Data.Configuration
xen2 commented 5 years ago

Could you attach your Game.csproj and your GameSettings.xkgamesettings ?

This error might happen if your asset reference an assembly not part of your game.

Since package upgrader doesn't know what is used, it is supposed to add references to all Xenko "plugins" (physics, particles, etc...) to avoid this error:

    <PackageReference Include="Xenko.Engine" Version="3.1.0.1-beta01-0313" PrivateAssets="contentfiles;analyzers" />

    <PackageReference Include="Xenko.Video" Version="3.1.0.1-beta01-0313" PrivateAssets="contentfiles;analyzers" />
    <PackageReference Include="Xenko.Physics" Version="3.1.0.1-beta01-0313" PrivateAssets="contentfiles;analyzers" />
    <PackageReference Include="Xenko.Navigation" Version="3.1.0.1-beta01-0313" PrivateAssets="contentfiles;analyzers" />
    <PackageReference Include="Xenko.Particles" Version="3.1.0.1-beta01-0313" PrivateAssets="contentfiles;analyzers" />
    <PackageReference Include="Xenko.UI" Version="3.1.0.1-beta01-0313" PrivateAssets="contentfiles;analyzers" />
    <PackageReference Include="Xenko.Core" Version="3.1.0.1-beta01-0313" PrivateAssets="contentfiles;analyzers" />

    <PackageReference Include="Xenko.Core.Assets.CompilerApp" Version="3.1.0.1-beta01-0313" PrivateAssets="contentfiles;analyzers" IncludeAssets="build" />

Not sure if something went wrong with the update process, or something else is missing.

justStand commented 5 years ago

You're right about that. I had removed physics because I wasn't using it. Adding it fixed the issue, but gave me another one because I use the debug profiler script found in the documentation. (I could also remove the physics package and delete the physics configuration settings from the GameSettings file.)

Xenko.Core.Serialization.Contents.ContentManagerException: 'The asset 'XenkoDebugSpriteFont' could not be found. Asset path should be 'MyFolder/MyAssetName'. Check that the path is correct and that the asset has been included into the build.'

Removing the script fixes this issue. I'm going to close this comment, but I have a question: How do you know what packages you need? If I wanted to use the debugging script again, I'm guessing that I'm missing a nuget package. So I'll try adding Xenko.Debugger (Not even sure if this would be the required fix) . Now I get a different error

[AssetCompiler] Error while pre-loading package [Xenko.Core.Assets.Package]. Exception: Error when serializing reference.

Which I'm not sure if it's because the debugger package requires a dependency, or if I'm even going in the right direction towards fixing the original problem.

xen2 commented 5 years ago

You can also remove physics once you removed the settings section from GameSettings.

The idea will be later to deal with that by adding proper editor support (ask to clear asset from parts using a specific assembly when removing a package reference).

Also the problem should happen at compile time by simply the fact you don't have this reference, but it doesn't happen yet because Xenko.Phsyics and other "plugins" are still hardcoded in the editor/compilers. Later they should only be loaded if the game is referencing them, otherwise it should throw an error (just like when you compile code without the proper reference).

xmesaj2 commented 5 years ago

3.1.0.1-beta02-0543 having the same problem by loading JumpyJet example, changing renderer to any other option (even back to the same dx9.3 that was set initially), saving and trying to run the game.