Reputation: 7622
When I run my command-line application from within Visual Studio, one command always fails with below error:
The program '[7316] MyProgram.vshost.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
When I debug the code, this happens after the last execute line. Meaning the application performs it's function correctly but then crashes. When I build the project and run the exe file in the command-line I get no error and it works fine.
The project uses a 3rd party dll which in turn AFAIK calls a C or C++ dll, eg. something not coded in .Net.
My questions: Can I ignore this error since the app works fine when built? If not, what could be the potential issue and how can I solve it?
Upvotes: 4
Views: 10022
Reputation: 156928
Can I ignore this error since the app works fine when built?
I wouldn't ignore the issue. If your application fails during closing, there is possibly something wrong in destructing the objects and returning the handles to Windows (most likely the latter). This might get you in a production scenario eventually.
If not, what could be the potential issue and how can I solve it?
As said, I think releasing handles is the issue. If you use some third party DLL which is written in C++, possibly there is the issue. Try to set up some logging and see what the stack trace of the exception is. This might give you an idea where the problem is caused. Maybe this is even an issue you can report back to the vendor of the DLL.
Upvotes: 3