diff --git a/src/runtime/runtime.cs b/src/runtime/runtime.cs index a8d861770..b779c6707 100644 --- a/src/runtime/runtime.cs +++ b/src/runtime/runtime.cs @@ -2518,7 +2518,19 @@ static Delegates() } static global::System.IntPtr GetFunctionByName(string functionName, global::System.IntPtr libraryHandle) - => libraryLoader.GetFunction(libraryHandle, functionName); + { + try + { + return libraryLoader.GetFunction(libraryHandle, functionName); + } + catch (MissingMethodException e) when (libraryHandle == IntPtr.Zero) + { + throw new MissingMethodException( + "Did you forget to set Runtime.PythonDLL?" + + " See https://github.com/pythonnet/pythonnet#embedding-python-in-net", + e); + } + } internal static delegate* unmanaged[Cdecl] PyDictProxy_New { get; } internal static delegate* unmanaged[Cdecl] Py_IncRef { get; }