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!

asked 18 Feb '16, 07:51

tzup's gravatar image

tzup
36091324
accept rate: 0%

edited 18 Feb '16, 13:36

Breck%20Carter's gravatar image

Breck Carter
27.3k424585836

Since dbdata16.dll should be matched exactly with the provider that contains it, there would seem to be little possibility that there is a mismatch there. Thre are dependencies on other libraries though. Those would include the ICU libraries (dbicu*16.dll) and the LanGuage libraries (dblgEN16.dll for instance) and if those are not compatable that may cause an issue.

The entry point itself is also not something new so I would lean towards a mixed/broken installation with other such libraries.

HTH

(19 Feb '16, 13:34) Nick Elson S...

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

permanent link

answered 25 Feb '16, 03:42

Stefan's gravatar image

Stefan
81237
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×196
×35

question asked: 18 Feb '16, 07:51

question was seen: 455 times

last updated: 25 Feb '16, 03:46