Skip to content

The type initializer for 'Stride.Audio.AudioEngine' threw an exception. (Could not locate or load native library libstrideaudio) #3099

@MsEpsilon

Description

@MsEpsilon

Release Type: Github

Version: f16ec52

Platform(s): Windows

Describe the bug
When working with projects that are upgraded from 4.2.0.X, this exception is thrown upon debugging the project. This is an regression since this is not reproductible in v4.3.0.2507.

To Reproduce

  1. Clone and run https://github.com/MsEpsilon/TR.Stride/tree/master

Expected behavior
No crash.

Screenshots

Log and callstacks
What is shown in the debug terminal:

Unhandled exception. System.TypeInitializationException: The type initializer for 'Stride.Audio.AudioEngine' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'Stride.Audio.AudioLayer' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'Stride.Audio.NativeInvoke' threw an exception.
 ---> System.DllNotFoundException: Could not locate or load native library libstrideaudio
   at Stride.Core.NativeLibraryHelper.PreloadLibrary(String libraryName, Type ownerType) in D:\Dev\stride\sources\core\Stride.Core\Native\NativeLibraryHelper.cs:line 188
   at Stride.Audio.NativeInvoke.PreLoad() in D:\Dev\stride\sources\engine\Stride.Audio\NativeInvoke.cs:line 18
   at Stride.Audio.NativeInvoke..cctor() in D:\Dev\stride\sources\engine\Stride.Audio\NativeInvoke.cs:line 23
   --- End of inner exception stack trace ---
   at Stride.Audio.NativeInvoke.PreLoad() in D:\Dev\stride\sources\engine\Stride.Audio\NativeInvoke.cs:line 17
   at Stride.Audio.AudioLayer..cctor() in D:\Dev\stride\sources\engine\Stride.Audio\Native\AudioLayer.cs:line 37
   --- End of inner exception stack trace ---
   at Stride.Audio.AudioLayer.Init()
   at Stride.Audio.AudioLayer.Init()
   at Stride.Audio.AudioEngine..cctor() in D:\Dev\stride\sources\engine\Stride.Audio\AudioEngine.cs:line 27
   --- End of inner exception stack trace ---
   at Stride.Audio.AudioEngine..ctor(AudioDevice device, UInt32 sampleRate) in D:\Dev\stride\sources\engine\Stride.Audio\AudioEngine.cs:line 63
   at Stride.Audio.AudioEngineFactory.NewAudioEngine(AudioDevice device, DeviceFlags deviceFlags) in D:\Dev\stride\sources\engine\Stride.Audio\AudioEngineFactory.cs:line 18
   at Stride.Audio.AudioSystem.Initialize() in D:\Dev\stride\sources\engine\Stride.Engine\Audio\AudioSystem.cs:line 58
   at Stride.Games.GameSystemCollection.GameSystems_ItemAdded(Object sender, TrackingCollectionChangedEventArgs e)
   at Stride.Games.GameSystemCollection.GameSystems_CollectionChanged(Object sender, TrackingCollectionChangedEventArgs e)
   at Stride.Core.Collections.TrackingCollection`1.InsertItem(Int32 index, T item) in D:\Dev\stride\sources\core\Stride.Core\Collections\TrackingCollection.cs:line 40
   at Stride.Core.Collections.FastCollection`1.Add(T item) in D:\Dev\stride\sources\core\Stride.Core\Collections\FastCollection.cs:line 108
   at Stride.Engine.Game.Initialize() in D:\Dev\stride\sources\engine\Stride.Engine\Engine\Game.cs:line 390
   at Stride.Games.GameBase.InitializeBeforeRun()
   at Stride.Games.GamePlatform.OnInitCallback()
   at Stride.Games.GameWindowWinforms.Run()
   at Stride.Games.GamePlatform.Run(GameContext gameContext)
   at Stride.Games.GameBase.Run(GameContext gameContext)

Debugger breaks with this exception.

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Stride.Engine
  StackTrace:
   at Stride.Audio.AudioSystem.Destroy()
   at Stride.Core.DisposeBase.Stride.Core.IReferencable.Release() in D:\Dev\stride\sources\core\Stride.Core\DisposeBase.cs:line 82

Additional context
This doesn't seem to happen with newly created projects?

Workaround
Full rebuild (clean+rebuild).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions