When an application is run from within the IDE and the debugger is attached the exception 'External exception C0000008' is raised when it tries to connect to an imported ActiveX control.
If the application is ran standalone or the Rad Studio options/ Debugger Options/ Integrated debugging is unchecked, the program works as expected, no exception and the ActiveX control returns the expected result.
There are other ActiveX controls in the project, all of which work fine.
I have tried:
- Reinstalling the ActiveX control
- Re-Importing the ActiveX control
- Removing any software that may be causing conflicts (experts/ plug-ins etc)
- Turning off most running applications and services etc in case they are causing a conflict
Searching Google, It looks like others have been experiencing the same problem, but there is no fix to be found (other than turn off Integrated debugging, but obviously that is not a valid option.
Does any one have any ideas were to look to fix this problem?
I am using Delphi 2007
C0000008 is the status returned for an invalid handle. Make sure that your wrapper when it goes to create the object gives it a proper handle and not nil (assuming it is crashing because of a windows handle).
Since the application runs fine when not attached to the debugger, I'm assuming that the wrapper is handling this condition gracefully so the error is most likely occurring inside a try/except block.
It's a combination of non-obvious function behavior and IDE options.
MSDN CloseHandle
If the application is running under a debugger, the function will throw an exception if it receives either a handle value that is not valid or a pseudo-handle value. This can happen if you close a handle twice, or if you call CloseHandle on a handle returned by the FindFirstFile function instead of calling the FindClose function.
So there's two options - either check the code for a place where some invalid handle is being closed or turn off IDE's notification of this exception. Go to Tools > Options > Debugger options > Emb debuggers > Native OS exceptions, find Invalid Handle item and change On resume option to Run handled. This worked for me.
Credits for this solution go to _Vasilisk_ from sql.ru forum.
Related
I have the community edition 10.3 of Delphi on Windows 10 and trying to use the JEDI (JVCL v3.50) TJvHidDeviceControllerClass (v 1.0.35) to control my HID device in a VCL form application.
This exception also gets thrown when I start up Delphi and when closing it down showing a dialog, provided that the component is already present on the form when loading the project. When ran with the OnDeviceCreateError() event handler assigned, the application behaves OK as I set the debugger to let the application handle this particular exception and setting the "Handled" boolean to true inside the OnDeviceCreateError() handler. It also works fine when run outside the Delphi GUI.
I have been searching for clues about fixing this issue and have seen that other people have encountered it as well. As most of the posts about this is quite old I wonder if I don't have the correct version of the library (https://github.com/project-jedi/jvcl).
The JEDI library was fetched from github just a week ago using the instructions on the readme page. My local repo was cloned from the master branch. I built it and installed it locally with no hassle.
Albeit working fine when running the application this exception is a bit of a nuisance as it messes with the Delphi GUI itself during startup (the exception dialog is shown, parts of the GUI goes missing after clicking OK).
I don't think that my code is the culprit here as the problem presents itself before any application code has even begun executing. I suspect that Delphi itself runs the constructor for the component before the OnDeviceCreateError() handler has been assigned and so the exception propagates all the way up to the GUI during palette placement or startup. Why the exception shows while shutting Delphi down is harder for me to explain.
Is there a fix to this or a setting to prevent Delphi running the constructor at design time?
Should I create the TJvHidDeviceControllerClass instance during form creation instead?
Thanks in advance /Thom
After some trial and error I worked around the problem by removing the component from the form designer and adding the TJvHidDeviceControllerClass manually with method bindings to the class in code instead.
The default constructor should not be used as it does not bind the exception handler at create time. Use the other one that does the binding.
It now works fine without stray exceptions at start/stop times.
When creating manually, be shure to explicitly free the TJvHidDeviceControllerClass object instance at form close.
While testing my delphi application, some Exceptions are raised but the debugger is not showing where (like it used to). Is there a setting which is causing this?
EDIT: When an exception occurs, a message appears alerting me to the fact that an error has occurred and what type of exception it is. Normally, I would be able to click 'break' and it would show me at which line the error had occurred, but when I click break, this doesn't happen.
It might help if you post a screen shot of what you actually do see before and after clicking Break.
And you haven't really answered the very first comment on your question: "What errors are occurring?" The point is if it's specific exceptions that aren't showing the code - they may be occurring in an external DLL.
As a first step check if Delphi will show the exception in the most simple case:
Drop a button on your form.
Write an OnClick handler with the following code: raise Exception.Create('This is a test');
NOTE Make sure you try this in both your existing app, and in a brand new stand-alone app.
If Delphi doesn't show you that exception in the simple app, I'd be very surprised, and some more serious digging will be required.
If it is shown in the simple app, but not in yours, then there's some specific problem in your project:
Ensure you aren't disabling debug info {$D-} or {$DEBUGINFO OFF} somewhere in your project.
You might have exception hooking code in your project that is somehow interfering. Try disabling exception loggers and similar tools to narrow down the problem. (Don't forget to re-enable the appropriate tools once the issue is resolved.)
Verify that your search and browsing paths are correctly configured to find the source code in order to show you the error.
If the simple exception is shown in both apps, then we'll probably need to know exactly what exceptions aren't showing to help further. However, here are a few more pointers (^s):
Go to Tools | Options. Under Debugger Options, look for Native OS Exceptions. Verify you haven't changed any of these settings.
When the exception occurs, open your Thread Viewer, and check if the the exception was raised on the main thread or another thread.
Also open your Call-stack Viewer, and verify you actually do have a call-stack.
Then check if Delphi will show the code for any of the call-stack lines.
NOTE There is still the possibility that Delphi is simply unable to find the source unit depending on where the exception is raised. However, Delphi is supposed to prompt you and ask where it can load the file from in such situations. (It definitely worked in older versions of Delphi.)
But I wouldn't rule it out because a buggy plugin might well be suppressing the prompt.
You can control the reaction of the debugger on exceptions from within the options.
Go to Tools\Options.
Click on the Debugger Options, then on language exceptions.
You probably have unchecked "Notify on language exceptions".
Else you can enable as much as possible.
Be sure to enable all debug information in your project:
Debug information
Symbol reference info
And try without optimizing.
can somebody help me out with this error
Project1.exe faulted with message: 'application-defined exception (code 0xc0000008) at 0x7c90e4ff'. Process Stopped. Use step or Run to continue.
Using Delphi 7 on Win XP. Installed are ony default original Delphi 7 components. I have only a button and opendialog component on my new fresh project. I am using just one line of code in ButtonClick procedure
OpenDialog1.execute;
when this warning on picture occurs. Open dailog shows up for milisecond then Delphi error is reported before I can choose anything from open dialog.
What could be wrong? This behaviour is new, because I used opendialog before without problems.
TIA
P.S.
Program runs OK outside of Delphi IDE.
P.P.S.
I deinstalled GExperts, DelphiSpeedUp but problem remains.
Looking around online, I see that this error seems to happen every now and then. I don't know the real reason, but it seems to be related to the debugger. I'd guess it is some kind of obscure debugger bug that only happens when many different things come together.
FWIW, I've seen reports from D4 to D7 and even D2006. It seems to be gone in higher versions, although that is not sure.
The more reports I see, I notice it always seems to happen in the Delphi debugger. More evidence that it is the debugger, IMO. If that is the case, there is not much you can do.
Your problem could be an Explorer addin that is throwing an exception.
It could be something that adds things to the file context menu, like Tortoise SVN (as an example, I'm not saying that's the culprit), or it could be something creates previews for files or even a trojan or adware.
The file open dialog uses the same code as Explorer to display the file list, so any add in that you have for explorer is also loaded/used for the file open dialog. In explorer, it might throw the exception but not kill anything, but in your program (whilst running in the debugger) you can see it.
How to fix it? Try uninstalling any explorer addins that you know about... If that doesn't work, maybe do a scan for adware and trojans.
Set a breakpoint on the line of code that is crashing. Go into the debugger (run the app).
When you hit this line check these things:
Evaluate expression Self and make sure it is not nil.
Evaluate expression Self.OpenDialog1 and make sure it is not nil.
Also, look for code that frees (destroys) the objects you are working on. If you truly have written no extra code, and have a completely new empty application, then it is very hard indeed to understand how you could have a problem like you describe, on a new fresh project.
Same problem occurred in the office here.
The person facing the problem told me he managed to work around it by telling the debugger to leave error 0xc0000008 up to the app to handle.
/options/Debugger Options/Embarcadero Debuggers/Native OS Exceptions/32bit Windows OS Exceptions/
It occurred with the following configuration:
Windows XP
Rad Studio XE (Delphi)
Just installed Amazon Cloud Drive
I moreless had the same problem with D2007 running W8. I moved the code to and old WXP machine and the program ran fine both inside and outside Delphi. In our case, just for reference, the program reached two times the code that raises an Edatabaseerror
procedure DatabaseError(const Message: WideString; Component: TComponent = nil);
begin
if Assigned(Component) and (Component.Name <> '') then
raise EDatabaseError.Create(WideFormat('%s: %s', [Component.Name, Message])) else
raise EDatabaseError.Create(Message);
end;
After debugging I discovered that the infamous error was created by Delphi as a noncontinuable exception after the Exception.Create constructor but why, remains a mistery
I also tried the proposed solution of leaving the debugger handle the exception but was useless since in our case the exception number changed every time
First of all - sorry for my English.
I get the same error on the same Delph7.
In my case this error was raised by recursion)
I've problem with exception dialogs: I'm using RemObjects SDK for Client/Server -application. When there's connection problem, the client starts throwing "simple" exceptions dialogs, just text and a button. When I'm running the application on my development machine the exceptions dialogs are not shown (as expected). The text on the dialog is simple "Timeout", "Connection refused" etc. That kind of exceptions are raised AND handled inside RemObjects code inside worker thread. I've also EurekaLog activated, but it doesn't help at all.
Any ideas why it works on development machine, but not on "vanilla" client machine? How I can get rid of all exception popups?
I've following
Delphi 2007
RemObjects SDK "Winter 2009"
EurekaLog 6.0.22
I would do the following:
compile your app with debug info (.map file) and copy both to the client
start your app on the "vanilla" client machine
wait till a popup appears
start my sampling profiler:
http://asmprofiler.googlecode.com/files/AsmProfiler_Sampling%20v1.0.6.12.zip
use the "Stack view of process" button and choose your app in the process list
double click or press the "Live view" button
http://code.google.com/p/asmprofiler/wiki/ProcessStackViewer
you can now view the stack of the main thread, so you should see where the popup comes from...
Good luck!
You're going to have to do some debugging. If it's handled inside the worker thread, then it won't raise that dialog. Something's happening that causes the exception objects to escape to a higher level of the call stack.
Try installing on a vanilla machine of your own and trying to reproduce it yourself. You might notice some detail that the client didn't notice or didn't bother to report to you. Once you're able to reproduce it, you can try to figure out what's causing it with remote debugging or a handful of other ways.
A first step would be to use the remote debugger and start or attach to the process on the client machine.
You may have the IDE set to ignore these exceptions. You can check by looking in the debugger options. See Menu Tools/Options and then look in Debugger Options/Language exceptions.
If so, you can uncheck the option to get the exceptions back on the development machine and then use try/except to handle the exceptions programmatically.
When I'm running my COM Office add-in from within the Delphi 5 IDE (using any of the office applications as the host), breakpoints work fine (when using remote debugging symbols and a properly set output folder), but none of the non-delphi exceptions (like access violations) in my code triggers the IDE to break at that point. In stead, the IDE stops at the manual re-raise in the try...except wrappers in any of my outer safecall methods.
I noticed that for some reason the DebugHook global was set to 0 (while as far as I know it should always be set to 1 when running from within the IDE). Moreover, setting it to 1 manually during the initialization of my DLL actually fixes the issue: the IDE now neatly stops at the line where my experimental (read: crappy) code triggers the exception.
The questions is: why? Why do I need to do this manually? Shouldn't the IDE set this for me? Did I forget a major important setting somewhere triggering this behaviour?
If for some reason the Delphi evaluator is unable to lookup the DebugHook global, it would be unable to set that value. Try to compile/run the DLL from the IDE and set the "host application" in the Run|Parameters dialog to the the Office app you intend to call your DLL from. It is possible that this may be a bug in how the evaluator uses the remote debug symbols.
In recent versions of Delphi there's an Option under Debugger for "Debug spawned processes" or something to that effect. Is that option present in Delphi5, and is it set?
Not sure whether this will help, because I have not encountered the behavior you describe.