ASCOM driver hangs SharpCap

A place to report problems and bugs in SharpCap
Forum rules


If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs

Please also read about Troubleshooting USB Issues before posting.

*** Please do not post license keys - please report any problems with licensing to 'admin' by private message ***

Please include the following details in any bug report:

* Version of SharpCap
* Camera and other hardware being user
* Operating system version
* Contents of the SharpCap log after the problem has occurred.
[If SharpCap crashes, please send the bug report when prompted instead of including the log]
Post Reply
Analitex
Posts: 1
Joined: Wed Jan 16, 2019 8:18 pm

ASCOM driver hangs SharpCap

#1

Post by Analitex »

The version of SharpCap - 3.2.5911
Camera and other hardware being used - FLI Kepler 400, FLI Kepler 4040.
Operating system version - Windows 10
Contents of the SharpCap log after the problem has occurred - attached.

The problem description.

I am developing the ASCOM driver for FLI sCMOS cameras. The current driver works fine with MaximDL, SkyX etc.
The problem has been reported by 2 users of the FLI camera.
I experience the same issue.

When I try to use my ASCOM driver with SharpCap, the following happens:
1. The Camera Control Panel is empty;
2. The image rectangle is shown as black;
3. The UI of the program hangs (not crashing).
The ASCOM log shows that capturing is running (I can see consequent calls to StartAcquisition, ImageReady, ImageArray).
The log shows that the frame has correct pixel values in the ImageArray buffer.
It means that the capture thread is running, but the UI is hanging.
I narrowed down the issue to the point when ASCOM camera property "Connected" is called for the camera initialization.
The camera initialization calls external FLI DLL functions via C# DllImport to get access to the FLI camera.
If I comment out these calls everywhere in my ASCOM camera code (Connected, StartExposure etc.) then SharpCap works fine.
If I uncomment a single (main) initialization function call from the external FLI DLL in the ASCOM camera "Connected" property - SharpCap stops working (hangs, no crash).
Now, if I load the FLI DLL dynamically (LoadLibrary) into the process - SharpCap works fine.
If I get the address of the main initialization function in the above dynamically loaded DLL and call it - SharpCap stops working.
It looks like making this call by any method (LoadLibrary or DllImport) blocks the UI of SharpCap.
I cannot see why this happens, because the same ASCOM driver works fine in other astronomy software.
Loading a DLL dynamically doesn't cause the problem, the problem is in the call.
Does SharpCap have some kind of protection that will block the UI if an external DLL call occurs?

Any help would be appreciated.
Attachments
Log_2019-01-16T21_25_42-9636.log
(14.36 KiB) Downloaded 96 times
User avatar
admin
Site Admin
Posts: 13271
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: ASCOM driver hangs SharpCap

#2

Post by admin »

Hi,

That's a bit odd – there's nothing in SharpCap that should stop you from loading external DLLs for this sort of purpose in general, but obviously something that that DLL is doing is causing a clash with the main SharpCap application. From your description it sounds like it should be possible to get to the problem point without actually having an fli camera to work with. If that's the case then it might just be easiest for you to appoint me to the installs for your Ascom driver and I can then try running SharpCap under the debugger and see if I can work out what's going on as I think that may be the fastest way to get to the root cause of the problem.

Cheers, Robin
Post Reply