sipsorcery-org / sipsorcery

A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
https://sipsorcery-org.github.io/sipsorcery
Other
1.42k stars 432 forks source link

Getting exception when creating SDL2AudioEndPoint instance when SIPSorcery package is installed. #1155

Open hossam14102010 opened 1 month ago

hossam14102010 commented 1 month ago

I was trying to use SIPSorceryMedia.SDL2 library in a simple console application:

using SIPSorcery.Media;
using SIPSorceryMedia.SDL2;

SDL2Helper.InitSDL();
SDL2AudioEndPoint endpoint = new("Speakers (Realtek High Definition Audio)", new AudioEncoder());

but on the fifth line I get this exception:

System.MissingMethodException HResult=0x80131513 Message=Method not found: 'Microsoft.Extensions.Logging.ILogger SIPSorcery.LogFactory.CreateLogger()'. Source=SIPSorceryMedia.SDL2 StackTrace: at SIPSorceryMedia.SDL2.SDL2AudioEndPoint..ctor(String audioOutDeviceName, IAudioEncoder audioEncoder) at Program.Main(String[] args) in C:\Users\\source\repos\ConsoleApp4\ConsoleApp4\Program.cs:line 5

I am using .NET 8, and I tried both SDL2-2.0.20-win32-x64 (as mentioned in the README) and SDL-2.30.5-win32-x64 (lates version) I have also tried .NET 9.0-Preview and I have tried to install Microsoft.Extensions.Logging, Microsoft.Extensions.Logging.Console and I got the same exception on the same line.

Edit:

The Exception is only thrown when SIPSorcery package is installed. when I remove it no exception is thrown.

hossam14102010 commented 1 month ago

I have downloaded this repository and created a new .NET class library and added the classes under src folder into it and built DLLs when I add those DLLs to the Console app and remove the NuGet package I can use the SDL2AudioEndPoint successfully