Hi I have looked at other answers and I don't see anything that would answer this, I have code that executes correctly when initiated by a unit test but throws
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
When the same method is called with the same values in debug mode the line that throws the error :
dbConnection = new SQLiteConnection(@"Data Source = " + pathtoDB + "; version=3;");
In both cases where it is called there is no difference in pathtoDB, as I say my unit test has no problem with this method but debug fails. I have no idea why.
Edit - Thanks for the links, but it's not actually answering the question, I accept that it's possible that the dll for SQLite may not be x64 but that does not explain why this runs correctly from a unit test but not from a debug session with exactly the same parameters. It is this that I am seeking an answer to. I have also updated the title
Edit - The Sqlite stuff is x64 it's not that that is causing it, just an update it's not changing the question.
With reference to [Dave M] who has explained the reason, this is closing off the question with the steps to rectify the issue.
To correct the problem, the [Solution Properties] was opened (VS2017) - an additional configuration was created from the [Configuration manager] with the platform set to x86 for the Project and Unit tests.
The solution was run in Debug and successfully completed the connection to the Database.
User contributions licensed under CC BY-SA 3.0