WPF发布后部分Windows设备无法加载pjsua2 DLL求助
问题:WPF应用发布后部分设备无法加载pjsua2 DLL
我基于PJSIP-PJSUA2-CSharp项目创建了DLL并用于WPF应用,本地编译运行完全正常。但用Msix打包、ClickOnce或文件夹方式发布后,本地能正常运行,发送到其他Windows设备时,部分设备无论系统版本如何都无法启动。已确认安装所有框架依赖,问题依然存在。
查看这些设备的Windows事件查看器,核心错误摘要如下:
System.DllNotFoundException: 无法加载 DLL“pjsua2”或其依赖项之一: 找不到指定的模块。(0x8007007E)
该错误仅出现在启动失败的设备上。
补充信息:
- 所有相关方法均在代码后台调用
- 项目以x86为目标平台编译和发布
- 项目引用的程序集已设置
Copy Local = True
.NET Runtime 完整错误日志
CoreCLR Version: 6.0.1322.58009 .NET Version: 6.0.13 Description: 进程因未处理的异常而终止。 Exception Info: System.Windows.Markup.XamlParseException: 对与指定绑定约束匹配的类型“MYAPP.Views.Container”的构造函数的调用引发了异常。行号“10”,行位置“5”。 ---> System.TypeInitializationException: “MYAPP.Services.SIPServices.Sip.SipManager”的类型初始值设定项引发异常。 ---> System.TypeInitializationException: “pjsua2PINVOKE”的类型初始值设定项引发异常。 ---> System.TypeInitializationException: “SWIGExceptionHelper”的类型初始值设定项引发异常。 ---> System.DllNotFoundException: 无法加载 DLL“pjsua2”或其依赖项之一: 找不到指定的模块。(0x8007007E) 在 pjsua2PINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_pjsua2(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) 在 pjsua2PINVOKE.SWIGExceptionHelper..cctor() 位置 E:\rnd23Jan\MYAPP\MYAPP\Services\SIPServices\Classes\pjsua2PINVOKE.cs:行号 104 --- 内部异常堆栈跟踪的结尾 --- 在 pjsua2PINVOKE.SWIGExceptionHelper..ctor() 在 pjsua2PINVOKE..cctor() 位置 E:\rnd23Jan\MYAPP\MYAPP\Services\SIPServices\Classes\pjsua2PINVOKE.cs:行号 124 --- 内部异常堆栈跟踪的结尾 --- 在 pjsua2PINVOKE.new_Endpoint() 在 Endpoint..ctor() 位置 E:\rnd23Jan\MYAPP\MYAPP\Services\SIPServices\Classes\Endpoint.cs:行号 52 在 MYAPP.Services.SIPServices.Sip.SipManager..cctor() 位置 E:\rnd23Jan\MYAPP\MYAPP\Services\SIPServices\Sip\SipManager.cs:行号 26 --- 内部异常堆栈跟踪的结尾 --- 在 MYAPP.Services.SIPServices.Sip.SipManager..ctor(EpConfig config, pjsip_transport_type_e tType) 位置 E:\rnd23Jan\MYAPP\MYAPP\Services\SIPServices\Sip\SipManager.cs:行号 72 在 MYAPP.Services.PjServices.Sip.SipSingletone..ctor() 位置 E:\rnd23Jan\MYAPP\MYAPP\Services\PjServices\Sip\SipSingletone.cs:行号 14 在 MYAPP.Services.PjServices.Sip.SipSingletone.get_GetSipInstance() 位置 E:\rnd23Jan\MYAPP\MYAPP\Services\PjServices\Sip\SipSingletone.cs:行号 23 在 MYAPP.Views.Container..ctor() 位置 E:\rnd23Jan\MYAPP\MYAPP\Views\Container.xaml.cs:行号 56 在 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) --- 内部异常堆栈跟踪的结尾 --- 在 System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri) 在 System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri) 在 System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri) 在 System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream) 在 System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc) 在 System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties) 在 System.Windows.Application.DoStartup() 在 System.Windows.Application.<.ctor>b__1_0(Object unused) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 在 System.Windows.Threading.DispatcherOperation.InvokeImpl() 在 System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 在 MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- 来自之前位置的堆栈跟踪结束 --- 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 在 MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) 在 System.Windows.Threading.DispatcherOperation.Invoke() 在 System.Windows.Threading.Dispatcher.ProcessQueue() 在 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 在 System.Windows.Threading.Dispatcher.Run() 在 System.Windows.Application.RunDispatcher(Object ignore) 在 System.Windows.Application.RunInternal(Window window) 在 System.Windows.Application.Run() 在 MYAPP.App.Main()
应用程序错误日志
Faulting application name: MyApp.exe, version: 1.0.0.0, time stamp: 0x6387d16c Faulting module name: KERNELBASE.dll, version: 10.0.19041.572, time stamp: 0x979ddb1d Exception code: 0xe0434352 Fault offset: 0x00129ab2 Faulting process id: 0xb8c Faulting application start time: 0x01d92f1948c04dcc Faulting application path: C:\Users\TestVm\Desktop\net6.0-windows10.0.22621.0\MyApp.exe Faulting module path: C:\Windows\System32\KERNELBASE.dll Report Id: 88fd7660-b834-434b-8b37-58626cb7408b Faulting package full name: Faulting package-relative application ID:
内容的提问来源于stack exchange,提问作者Turash
相关产品推荐
相关产品推荐

