JeffreySu/WeiXinMPSDK · critical · EntryPointNotFoundException
企业微信 Finance 原生库缺少导出函数:
Error message
企业微信 Finance 原生库缺少导出函数:{exportName}。 What it means
The native library loaded, but GetProcAddress/dlsym could not find the required exported function (exportName) in the WeChat Work Finance SDK. The wrapper throws EntryPointNotFoundException. This means the file at the path is not the expected Finance SDK binary, or it is a different/incompatible version that lacks the C ABI export.
Solutions
- Verify you downloaded the official WeWorkFinanceSdk of the matching version and point LibraryPath directly at it.
- Check exports with dumpbin /exports (Windows) or nm -D (Linux) to confirm exportName exists.
- Replace the file if it is corrupted or a same-named different library; do not rely on bare-name search order.
- Update the SDK binary to the newest version when a newly added wrapper API calls a new export.
Example fix
// before
var api = MsgAuditFinanceNativeApi.Create("bin/libWeWorkFinanceSdk_Csharp.dll"); // wrong file, no exports
// after
var api = MsgAuditFinanceNativeApi.Create(@"libs\WeWorkFinanceSdk\libWeWorkFinanceSdk.dll"); // official SDK dll Defensive patterns
Strategy: fallback
Validate before calling
// verify exports before wiring the API (Linux)
var output = Process.Start(new ProcessStartInfo("nm", $"-D {path}")) // ensure expected export exists in output Type guard
static bool HasExpectedExports(string path, params string[] exports) => /* dumpbin/nm output contains all export names */ true;
Try / catch
try { return library.GetDelegate<TDelegate>(name); }
catch (EntryPointNotFoundException ex) { throw new InvalidOperationException($"{path} is not the official WeWorkFinanceSdk or is an old version (missing {name})", ex); } Prevention
- Download the official SDK from Tencent and version-pin it next to the app.
- After SDK upgrades, redeploy the matching native binary together with the NuGet update.
- Inspect exports (dumpbin /exports, nm -D) when the deployment is in doubt.
When it happens
Trigger: LibraryPath points to a wrong file (e.g. the C# wrapper dll instead of the SDK dll, or an unrelated dll with the same name); using an old SDK version missing a newer export such as GetMediaData; a partially downloaded/corrupted SDK file.
Common situations: Upgrading Senparc.Weixin.Work while keeping an old WeWorkFinanceSdk binary; renaming the SDK file manually so the wrong dll is picked up from the search path; NuGet/runtime pack shipping a stub.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- 未知的InfoType请求类型
- InfoType: 在RequestMessageFactory中没有对应的处理程序!
- 企业微信官方未提供当前操作系统可用的 Finance 会话内容存档原生库。请在 Windows 或 Linux…
- 无法加载企业微信 Finance 原生库:
- 企业微信 Finance 会话内容存档原生库仅支持 Windows 和 Linux。
AI-assisted analysis of JeffreySu/WeiXinMPSDK@be573f6f94 (2026-09-12).
Data as JSON: /api/errors/c511145c8fdb59ac.
Report an issue: GitHub.
Appendix: source
Thrown at src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/MsgAudit/MsgAuditFinanceNativeApi.cs:410
/// <returns>绑定到导出函数的托管委托。</returns>
public TDelegate GetDelegate<TDelegate>(string exportName) where TDelegate : Delegate
{
ThrowIfDisposed();
IntPtr symbol;
if (_isWindows)
{
symbol = WindowsNative.GetProcAddress(_handle, exportName);
}
else
{
symbol = _useLegacyLibDl
? LinuxLegacyNative.DlSym(_handle, exportName)
: LinuxNative.DlSym(_handle, exportName);
}
if (symbol == IntPtr.Zero)
{
throw new EntryPointNotFoundException(
$"企业微信 Finance 原生库缺少导出函数:{exportName}。");
}
return Marshal.GetDelegateForFunctionPointer<TDelegate>(symbol);
}
/// <summary>
/// 释放动态库句柄。
/// </summary>
public void Dispose()
{
var handle = _handle;
if (handle == IntPtr.Zero)
{
return;
}
_handle = IntPtr.Zero;View on GitHub (pinned to be573f6f94)