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.43k stars 433 forks source link

"Error resolving name servers" in Unity (UWP netstandard IL2CPP) #688

Closed camnewnham closed 2 years ago

camnewnham commented 2 years ago

I've been experimenting with SIPSorcery's WebRTC+DataChannel implementation with Unity / ARM64 UWP and run into an interesting issue.

The configuration here is: Unity 2020.3.15f2 UWP ARM64 (.net standard 2.0 backend, IL2CPP) SIPSorcery6.0.6 ( fetched via nuget and copied with dependencies into the Unity project)

When using the .NET Framework 4.6.1 version of this library everything functions correctly in editor and build.

When using the NetStandard 2.0 version of this library, it functions as expected in the Windows editor, but when running on a UWP ARM64 device I get the following error when calling addIceCandidate() or peerConnection.setLocalDescription(peerConnection.createOffer()).

Error resolving name servers ---> System.DllNotFoundException: Unable to load DLL 'advapi32.dll': The specified module could not be found.

The stack trace is here.

The only change between the two test scenarios is swapping the DLLs between the net461 and netstandard versions.

My interpretation of the log message is that the DnsClient.dll is attempting to call a native library which doesn't exist on the target platform. Why this would differ between net461 and netstandard2.0 I don't know. I'm not sure if this is an issue with SIPSorcery, Unity/IL2CPP or DnsClient.

I'm happy to do some further investigation/testing if someone can point me in the right direction :)

sipsorcery commented 2 years ago

I'm happy to do some further investigation/testing if someone can point me in the right direction :)

Great 👍.

First place to start would be to check if anyone has mentioned anything similar on the DnsClent.NET issues. It's the librbary sipsorcery uses for DNS resolution.

camnewnham commented 2 years ago

Thanks. Looking at the source code over there there confusion would be coming from this code path:

#if !NET45
 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
....

I'll raise an issue to discuss over there.