• Advertisement
Sign in to follow this  

Program Stops Without Exception

This topic is 746 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What would cause a program to stop executing after a certain line, but without an error or exception?

 

It doesn't actually stop running - the form is still there, and if I click buttons everything works, but in the form load event, it hits a certain line and won't proceed beyond that.

 

If I tell it to display a message box before the line, it works, but afterwards it doesn't.  If I break before it and debug, I can step up to the line, but then when I try to step through it, it won't break at the next line, but instead shows the form and expects further interaction, as if I had clicked the resume button instead of stepping.

 

It only seems to happen whenever I try to execute any function of a DLL in the project.  However, the code recognizes the function names and arguments, and everything compiles correctly, so it should work fine.

Share this post


Link to post
Share on other sites
Advertisement

Can you paste the relevant code?  My guess is that you are calling a blocking function, but your app is still running and processing messages in another thread or system.

Share this post


Link to post
Share on other sites

It's just SQLite.  Here's what I'm doing:

 

            MessageBox.Show("BEFORE");

            SQLiteConnection c = new SQLiteConnection(cs);

            MessageBox.Show("AFTER");
 

It prints "BEFORE" but not "AFTER", and it will never break on or step to the second message box.

Share this post


Link to post
Share on other sites

It's obvious that your program is trying to create a connection to the SQLite defined by "cs", but it can't for some reason, so it blocks until it does connect.

 

You need to figure out why it can't connect to whatever is defined by "cs".  Do you have a SQLite DB running, and does cs properly point to that DB?  That is where the issue is IMO.

Share this post


Link to post
Share on other sites

Maybe it is a freez (infinite loop)..

Are you sure that you've enabled all excetions (Ctr+Alt+E in VS)?

Edited by imoogiBG

Share this post


Link to post
Share on other sites

BeerNutts: but if it blocked, wouldn't that cause it to load and not respond?  What I'm seeing is that it just shows me the form and allows me to keep clicking buttons and things, and they work, but it just doesn't seem to execute the rest of the code in whatever function I make a call to the DLL from.

 

And actually, I'm trying to set up a new database.  This is all just a test for now - I'm trying to figure out how to use SQLite.  But I've followed examples and it just doesn't work.  The cs variable is "URI=File:test.db", and supposedly that will create the file that doesn't already exist, won't it?  So that I can have a new database?  (Actually, I'm not even sure what directory it's referring to, so I have no idea where the file is or is supposed to be, but I was told this would work).

 

 

 

imoogiBG:  It's not throwing any exceptions, and there aren't any unhandled ones or anything, so I'm not sure how it could be a problem, or are you saying that it's not throwing an exception at all, because I disabled it?  That doesn't sound right.  If the code throws an exception, it would be thrown.  But I'll check anyway.

 

 

 

Update:  I tried enabling the exceptions, and now when it gets to that line, it says "Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)".  I already had System.Data.SQLite imported into the project, but none of the other DLLs that came with it (I wasn't entirely sure whether or which ones I would need).

 

But then When I tried to import that DLL, I got an error that said something like "A reference to blah blah could not be added.  Please make sure it's accessible and a valid assembly or COM component."  So it's implying it's somehow incompatible, even though the first DLL was imported with NO problem at all, and they were from the same ZIP file I got directly from SQLite's website!  How can that happen?

Edited by myvraccount

Share this post


Link to post
Share on other sites

Most of the times this is due to bad references in the project.

Check your references, I advise you to download packages from Nuget. 

Or if you cant, than from reliable source. 

Share this post


Link to post
Share on other sites
It looks like you're using C# for your main program. When a DLL fails to load, the first thing to check (after making sure the DLL exists at all) is to see if your C# app is running in 64-bit mode and trying to load a 32-bit DLL (or vice-versa) (which will fail).

To try this, if you're using Visual Studio, find the "Any CPU" drop-down, go into the Configuration Manager and change things to x86. Edited by Nypyren

Share this post


Link to post
Share on other sites

I am running 64 bit mode and downloaded the correct files.  The thing is that when I try to import the DLLs, all of them go into the project without any complaint, except that one.  And they were all from the same compressed file.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement