C# Music Stream Bug, Program crash.
ChinaChenMingQuan opened this issue · comments
system version: windows 7 x64.
sfml version: release 2.5.
c# version: 7.3.
.net version: .net core 2.2.107 x64.
visual studio version: vs2017
From https://github.com/SFML/SFML.Net/releases/tag/2.5 download.
Open SFML.Net-2.5\examples\Examples.sln.
Set start project is sound.
I am modifying the code:
using System;
using System.IO;
using System.Threading;
using SFML.Audio;
namespace sound
{
static class Program
{
static void Main(string[] args)
{
PlayMusic();
}
private static void PlayMusic()
{
using (FileStream fileStream = File.Open("resources/orchestral.ogg", FileMode.Open))
{
using (Music music = new Music(fileStream))
{
music.Play();
Console.ReadKey();
}
}
// next step.
// program crash.
Console.WriteLine("Next Message.");
Console.ReadKey();
}
}
}
crush with exception
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'csfml-audio' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libcsfml-audio: cannot open shared object file: No such file or directory
at SFML.Audio.SoundBuffer.sfSoundBuffer_createFromFile(String Filename)
Ubuntu 18.04
Dotnet core 3.0
@CreateLab this is unrelated to this issue. As the error says you're missing the CSFML libraries.
@ChinaChenMingQuan We need more information than "program crash". Where does it crash? What's the call stack? Does your audio work otherwise? Can you run the C++ SFML audio examples?
omg! 2 months passed, copy my code to c# running. program crash.
using System;
using System.IO;
using System.Threading;
using SFML.Audio;
namespace sound
{
static class Program
{
static void Main(string[] args)
{
PlayMusic();
}
private static void PlayMusic()
{
using (FileStream fileStream = File.Open("resources/orchestral.ogg", FileMode.Open))
{
using (Music music = new Music(fileStream))
{
music.Play();
///////
// this code
// Music play end or not end.
Console.ReadKey();
// life cycle end
// program crash.
}
}
// next step.
// program crash.
// Program breakpoint not to this.
Console.WriteLine("Next Message. Display");
Console.ReadKey();
}
}
}
look code note.
c++ no BUG.
--from google translate.
Do you have a call stack or an error message?
not have message, before display message. program crash. but, dotnet exit code is 0x3.
not exception. direct program crash.
you can try running C# code.
I estimate c language csfml callback order have question.
now is china night time 23:28, i need sleep, if you have time, update version to sfml 2.5.1, try.
not here? no solution? oh my god.
no people solve this bug, close comment. i remove sfml library. use sdl library.