locked
FileNotFoundException and ExecuteScalar RRS feed

  • Question

  • I'm developing a win ce 5 app with SqlCE 3.5, and debugging on the win ce device, using visual studio 2008.

    When I debug interactively, I'm having trouble with a FileNotFound exception (see stack trace below), when I call ExecuteReader() on a command object.

    Many other db commands have worked up to here- creating the db, creating tables, etc. So the actual connection is working fine.

    From what I understand, this is probably due to it trying to find the localized version of the error string?  I've tried installing sqlce.dev.ENU.wce5.armv4i.CAB, but thats not helped - still get the same error.

    Many thanks in advance for any help.

     

    at System.Reflection.Assembly.InternalGetSatelliteAssembly()
    at System.Reflection.Assembly.GetSatelliteAssembly()
    at System.Resources.ResourceManager.InternalGetResourceSet()
    at System.Resources.ResourceManager.GetString()
    at System.Resources.ResourceManager.GetString()
    at System.SRSupport.HasString()
    at System.SRSupport.HasString()
    at System.Data.Res.HasString()
    at System.Data.SqlTypes.SQLResource..cctor()
    at System.Data.SqlServerCe.SqlMetaData..cctor()
    at System.Data.SqlServerCe.MetaData..ctor()
    at System.Data.SqlServerCe.SqlCeDataReader.PopulateMetaData()
    at System.Data.SqlServerCe.SqlCeDataReader.FillMetaData()
    at System.Data.SqlServerCe.SqlCeDataReader.FillMetaData()
    at System.Data.SqlServerCe.SqlCeCommand.InitializeDataReader()
    at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand()
    at System.Data.SqlServerCe.SqlCeCommand.ExecuteScalar()
    at TM1.DataStore.SQLCE.ExecuteScalar()
    at TM1.DataStore.DataStore.TableExists()
    at TM1.DataStore.DataStore.CreateStore()
    at TM1.Business.PrintProfile.CreateStore()
    at TM1.Business.Business.CreateStores()
    at TM1.Controllers.SplashScreenController.BackgoundInit()

    Friday, June 4, 2010 11:47 AM

Answers

  • It looks like this is the culprit:

    http://social.msdn.microsoft.com/Forums/en-US/netfxcompact/thread/e319b84a-c38b-4fb6-a080-dfa71bfe090f/

    The exceptions are actually "normal" as part of the resource finding process in the framewrok.

    What threw me is that in the IDE, when you trap all errors, and hit continue on these, it all fails fatally. Don't catch these first chance exceptions, and does not fail.  Am now forced to not trap filenotfoundexceptions in the IDE, even though they could originate from non-framework code.

    • Proposed as answer by ErikEJMVP Monday, June 7, 2010 12:12 PM
    • Marked as answer by Nik Sm Monday, June 7, 2010 1:08 PM
    Monday, June 7, 2010 10:14 AM

All replies

  • Bump... any help please?

    Many thanks.

    Monday, June 7, 2010 8:37 AM
  • Can you change the regional settings on the device?

    Try running the SQL statement in Management Studio on your dekstop - is there a problem with it ?

    Implement correct error handling: http://msdn.microsoft.com/en-us/library/ms174079(v=SQL.100).aspx


    http://erikej.blogspot.com Erik Ejlskov Jensen - Please mark as answer, if this was it.
    Monday, June 7, 2010 9:07 AM
  • Hi Erik,

    Thanks for the reply.

    a) Which regional setting should I change it to? I currently have it as EN-us. Are there settings in my project somewhere that might be in conflict with this? (This is a UK project that I've picked up - I'm not that familiar with all the code). That would seem to make sense - the stacktrace seems to be looking for a localized satellite assembly that it never finds.   However, when the exception is thrown, I've examined the thread's culture, and it is indeed en-US, so its probably not that.

    b) No problem with statement - its a simple "select count(*) from tablename where 1=2"

    c) The exception thats thrown is actually a FileNotFoundException (not SqlCEException), coming from System.SRSupport (see stack trace above).

     

    Monday, June 7, 2010 9:50 AM
  • It looks like this is the culprit:

    http://social.msdn.microsoft.com/Forums/en-US/netfxcompact/thread/e319b84a-c38b-4fb6-a080-dfa71bfe090f/

    The exceptions are actually "normal" as part of the resource finding process in the framewrok.

    What threw me is that in the IDE, when you trap all errors, and hit continue on these, it all fails fatally. Don't catch these first chance exceptions, and does not fail.  Am now forced to not trap filenotfoundexceptions in the IDE, even though they could originate from non-framework code.

    • Proposed as answer by ErikEJMVP Monday, June 7, 2010 12:12 PM
    • Marked as answer by Nik Sm Monday, June 7, 2010 1:08 PM
    Monday, June 7, 2010 10:14 AM