none
Native Exception in GetKeyInfo()

    Question

  • We developed a product on Win CE 5 using Visual Studio 2005. I am evaluating an upgrade to Visual Studio 2008 because we believe the SQL Server CE 3.5 database format is better supported.

    We installed updates in platform builder to get SQL Server CE 3.5 and we rebuilt the platform. I have installed Visual Studio 2008 with SP1 for both .net and SQL Server CE.

    I tried making an entirely new project with a fresh DB for testing, so that everything will agree and there won't be any strange faults lingering from settings in any old project. All the Properties sheets seems to indicate that my database is a 3.5 database. The project builds and deploys with no problems, but after the connection is open, any attempt to fill a table from the database results in this exception:

    Exception Code: 0x80000002
    Exception Address: 0x03194008
    Faulting Module: sqlceme35.dll
    at NativeMethods.GetKeyInfo( IntPtr pTx, String pwszBaseTable, IntPtr prgDbKeyInfo, Int32 cDbKeyInfo, IntPtr pError )
    at SqlCeDataReader.FillMetaData( SqlCeCommand command )
    at SqlCeCommand.InitializeDataReader( SqlCeDataReader reader, Int32 resultType )
    ...

    The fault is happening in MS code that I cannot step into...anyone recognize this problem?
    Tuesday, November 25, 2008 7:28 PM

Answers

  • This error happens when there is mismatch in the version of SQLCE components being used.

     

    What is the exact version of SQLCE components being used on device/desktop?

    File version of all native components and managed components need to be same.

    Are you using 3.5 RTM (3.5.5386) or 3.5 SP1 (3.5.5692)?

     

    Ensure that all SQLCE assemblies loaded by your application are of same version.

    This should ideally resolve the issue.

     

    Hope this helps,

    Vamshi Krishna, SQL Compact, MSFT.

    Wednesday, November 26, 2008 5:35 AM
    Answerer
  • Hi Charles,

     

    Could you please check that you are using the same version of native (sqlceme35.dll, sqlceqp35.dll etc)and managed dll (System.Data.SqlServerCe.dll). Please be aware that you are using Compact 3.5 RTM (File Version 5386 ) or Compact 3.5 SP1 (File Version  no 5692). 

     

    If there is not issue with the Compact version then please provide the sample Application and the call stack for the error.

     

    Please contact "Sql Server Compact Blog" from the following link http://blogs.msdn.com/sqlservercompact/contact.aspx

     

    You will able to send the repro application after any one from the SQL Compact team replies to your mail.

     

    Thanks & regards,

    Devesh Anand

    Wednesday, November 26, 2008 5:29 AM
    Answerer
  • For me, the issue was caused by having the 3.5 SP1 components installed on the device, but then referencing the 3.5 RTM managed DLL in the assembly.  The trick was that the device had the SP1 native components installed but the SP1 managed components were not installed on my PC.  

    My resolution was to install the SP1 components on the desktop and re-reference them in my assemblies.
    Wednesday, November 26, 2008 5:05 PM

All replies

  • I'm having the same problem.
    Tuesday, November 25, 2008 9:05 PM
  • Hi Charles,

     

    Could you please check that you are using the same version of native (sqlceme35.dll, sqlceqp35.dll etc)and managed dll (System.Data.SqlServerCe.dll). Please be aware that you are using Compact 3.5 RTM (File Version 5386 ) or Compact 3.5 SP1 (File Version  no 5692). 

     

    If there is not issue with the Compact version then please provide the sample Application and the call stack for the error.

     

    Please contact "Sql Server Compact Blog" from the following link http://blogs.msdn.com/sqlservercompact/contact.aspx

     

    You will able to send the repro application after any one from the SQL Compact team replies to your mail.

     

    Thanks & regards,

    Devesh Anand

    Wednesday, November 26, 2008 5:29 AM
    Answerer
  • This error happens when there is mismatch in the version of SQLCE components being used.

     

    What is the exact version of SQLCE components being used on device/desktop?

    File version of all native components and managed components need to be same.

    Are you using 3.5 RTM (3.5.5386) or 3.5 SP1 (3.5.5692)?

     

    Ensure that all SQLCE assemblies loaded by your application are of same version.

    This should ideally resolve the issue.

     

    Hope this helps,

    Vamshi Krishna, SQL Compact, MSFT.

    Wednesday, November 26, 2008 5:35 AM
    Answerer
  • For me, the issue was caused by having the 3.5 SP1 components installed on the device, but then referencing the 3.5 RTM managed DLL in the assembly.  The trick was that the device had the SP1 native components installed but the SP1 managed components were not installed on my PC.  

    My resolution was to install the SP1 components on the desktop and re-reference them in my assemblies.
    Wednesday, November 26, 2008 5:05 PM
  • Thank you all for your replies. I felt that there was a version mismatch SOMEWHERE, but just could not find it.

    Here is what I have done, and a followup question:

    Although the 3.5 SP 1 components are included in our platform, they do not seem to work. So I asked our guy with Platform Builder (PB) to make me a version with NO database support whatsoever, and I used the CAB files to install 3.5 SP1 myself after booting the device. That worked.

    If PB thinks it is installing the correct version of SQL CE but obviously is not, what can we do to fix it? Are the dll files themselves stored in a place we could get to them on our system running PB and upgrade them before building a platform?

    Thanks!
    Monday, December 01, 2008 6:11 PM
  • For me, the issue was caused by having the 3.5 SP1 components installed on the device, but then referencing the 3.5 RTM managed DLL in the assembly.  The trick was that the device had the SP1 native components installed but the SP1 managed components were not installed on my PC.  

    My resolution was to install the SP1 components on the desktop and re-reference them in my assemblies.

    Thanks for your explanation! Now I got it.
    Friday, October 08, 2010 1:24 AM
  •   thanks  Vamshi Krishna ,

    your post is worked in my problem . thanks once again.

    Tuesday, February 28, 2012 11:28 AM
  • Thanks Vamshi, that was a real tough one for me to fix ;-)
    Thursday, February 20, 2014 7:37 PM
  • Hi Vamshi Krishna,

    I am also facing similar error and I checked the properties of all the below files but all are having the same version:

    sqlceme35.dll

    sqlceqp35.dll

    sqlcese35.dll

    version: 3.5.5386.0

    I'm seeing prefetch abort in sqlceme35.dll in the logs. But on screen the error is same as mentioned above. Please let me know your thoughts.


    Seeth

    Monday, February 20, 2017 2:40 PM