on 2016 Feb 18 7:51 AM
Hello,
I built a Windows Service that tries to connect to a SA 16 database server (64bit) running on a 64bit Windows Server 2008 R2 (with full .Net framework 4.5) and it fails to open a connection:
*Connect : System.MissingMethodException: Method not found: 'IntPtr System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(!!0)'. at iAnywhere.Data.SQLAnywhere.SACommand._ExecuteReader(CommandBehavior commandBehavior, Boolean isExecuteScalar, Boolean isBeginExecuteReader) at iAnywhere.Data.SQLAnywhere.SACommand.ExecuteScalar() at iAnywhere.Data.SQLAnywhere.SAConnection.Open()*
My application references thr ADO.NET provider: iAnywhere.Data.SQLAnywhere.v4.5.dll (Ver 16.0.0.21584)
Based on the decompiler, SACommand._ExecuteReader calls at one point PInvokeMethods.AsaCommand__ExecuteReader which is defined as:
[DllImport("dbdata16.dll", CharSet=CharSet.None, ExactSpelling=false)] public static extern int AsaCommand_ExecuteReader(int idCmd, int inputParmCount, IntPtr inputParmValues, ref int outputParmCount, ref IntPtr outputParmValues, ref int idReader, ref int rowCount);
As the documentation describes and upon starting the service, the ADO.NET provider unpacks the file dbdata16.dll (64bit, 16.0.0.2158) under C:\\Windows\\Temp{GUID}_1600.x64__1
Looking at this file with DependencyWalker there sure is an AsaCommand_ExecuteReader function in this library, which I think the PInvoke call is trying to reach.
Is it possible the service is loading a different version of dbdata16.dll? (not likely since I can't find other dbdata16.dll files on the system)
Thank you!
Request clarification before answering.
Please try target .NET Framework 4.5.1 or higher in Visual Studio for your project.
https://msdn.microsoft.com/en-us/library/dn261459(v=vs.110).aspx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
54 | |
6 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.