Possible ASCOM/COM lifecycle problem (0x800706BA)

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
StarFlea
Posts: 169
Joined: Wed Dec 21, 2022 12:22 pm

Possible ASCOM/COM lifecycle problem (0x800706BA)

#1

Post by StarFlea »

Hi Robin,

Lately, I’ve been having recurring issues connecting the mount via the sequencer. I use GreenSwampServer (GSS).

I usually connect to it using the following sequence steps:

Code: Select all

MOUNT SELECT "ASCOM GS Sky Telescope"
MOUNT CONNECT
If GSS crashes while the sequence is running, I am generally forced to reload the same sequence, which generates a new instance of GSS.
On this second attempt, the SharpCap sequence seems unable to establish a proper connection to this new instance (#2). However, no error is displayed.

It is only when a step like

Code: Select all

MOUNT TRACKING None
is reached that the entire sequence terminates with the error message "RPC-Server not available. (0x800706BA)."
Could it be that a reference to the original instance (#1) still persists?

The error can easily be reproduced with a minimal sequence:

Code: Select all

SEQUENCE
    MOUNT SELECT "ASCOM GS Sky Telescope"
    MOUNT CONNECT
    MOUNT TRACKING None
END SEQUENCE
Once the sequence has finished running, you can disconnect, close, and restart GSS via its own GUI.

If you then run the sequence above again, the problem occurs.

If you don't start GSS yourself but let the sequence handle it, no new instance is created at all.

The only workaround I’ve found so far is to restart SharpCap as well.
Log_2026-10-06T22_46_40-12372.log
(118.57 KiB) Downloaded 4 times
Regards,
StarFlea
User avatar
admin
Site Admin
Posts: 17510
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Possible ASCOM/COM lifecycle problem (0x800706BA)

#2

Post by admin »

Hi,

what happens if you try a 'MOUNT DISCONNECT' (or use the SharpCap UI to untick the 'Connected' check box) after the error has occurred? I think that would clear out the previous (now broken since it was connecting to the dead GSServer.exe) COM proxy in SharpCap, allowing a new one to be created when you try to connect again.

On my side, I am going to revisit the code that handles reporting the connected state of the mount - at the moment it is too trusting that the state will remain connected once it has been set to connected, which masks the issue of the GS Server application having crashed from lots of things in SharpCap until you try to actually do something with the mount.

cheers,

Robin
StarFlea
Posts: 169
Joined: Wed Dec 21, 2022 12:22 pm

Re: Possible ASCOM/COM lifecycle problem (0x800706BA)

#3

Post by StarFlea »

Yes, I’ve actually tried that already. Everything works again after a DISCONNECT.

The problem, of course, is that you don't know when the server might drop the connection during a sequence. If the DISCONNECT is scheduled for the end, it won't even be reached if the server crashes.

Does it make sense to include a blanket DISCONNECT at the very beginning of the sequence—before the CONNECT—something like this:

Code: Select all

SEQUENCE
MOUNT SELECT "ASCOM GS Sky Telescope"
MOUNT DISCONNECT
MOUNT CONNECT
MOUNT TRACKING None
END SEQUENCE
?
User avatar
admin
Site Admin
Posts: 17510
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Possible ASCOM/COM lifecycle problem (0x800706BA)

#4

Post by admin »

Hi,

it certainly wouldn't hurt as it would ensure that a new connection is made if necessary - you could also put a disconnect into any error handling blocks in the sequence.

Have you reported the issue with the GSServer crashing to the GSServer developer(s)? While looking at this has turned up an anomaly in how SharpCap deals with the problem, once other software starts crashing you are likely to end up in a situation where full recovery may not be possible, so it's best for the crash not to happen in the first place!

By the way, for the next update of SharpCap 4.2 I have changed the behaviour around how SharpCap deals with this sort of situation. Instead of assuming the mount stays properly connected once it has connected, SharpCap will check the mount for connection a couple of times per second (as it checks the current RA/Dec/Alt/Az co-ordinates regularly). If the mount driver starts to give errors (rather than a valid yes/no answer) on the connection check, SharpCap will assume it has disconnected (or at least failed in some way), show an error notification and update UI to show the mount as no longer connected. This will clean up the lingering broken COM connection to the mount so that a reconnect will work if the original issue has been resolved.

As a relatively significant change, we will have to see if this works out OK or if it surfaces more issues that have been lurking without being reported.

cheers,

Robin
StarFlea
Posts: 169
Joined: Wed Dec 21, 2022 12:22 pm

Re: Possible ASCOM/COM lifecycle problem (0x800706BA)

#5

Post by StarFlea »

Hi,

I’m actually not sure if I can reproduce the issue with the GSS. The GSS had originally hung—possibly a deadlock—and I had to restart it manually. That’s when I noticed the problem with the sequencer...

You’ve certainly put a lot of work into this!
How would SharpCap react if the connection to the original instance could be restored (e.g., after a temporary disconnection)? Is that possible, or would it explicitly require a new instance?

In any case, this will make SharpCap a bit more robust, even though such incidents can never be completely avoided! Thanks! :)
User avatar
admin
Site Admin
Posts: 17510
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Possible ASCOM/COM lifecycle problem (0x800706BA)

#6

Post by admin »

Hi,

I think that SharpCap would happily reconnect to the original instance if it suddenly came back to life (at least if you disconnect then reconnect). This is all a byproduct of the GSServer.exe being an out-of-process COM singleton server for the ASCOM driver, so as long as it is still running and alive, other applications requesting to talk to that COM object should get routed to it. The funny thing is that this sort of COM stuff was all rapidly becoming 'legacy' technology when I started doing Windows development back around 2000, yet we still use it...

I am thinking that I may allow one or two retries (ie that the connection check has to fail 3 times in a row over a second or two) before flagging the mount connection as lost - that should reduce the chance of false positives if something fails to respond once.

cheers,

Robin
StarFlea
Posts: 169
Joined: Wed Dec 21, 2022 12:22 pm

Re: Possible ASCOM/COM lifecycle problem (0x800706BA)

#7

Post by StarFlea »

Hi Robin!

I've thoroughly tested your changes, and as far as I can see, everything works perfectly, even when I manually close GSS occasionally.

Thanks a lot! :)

Cheers!

Flo
(StarFlea)
User avatar
admin
Site Admin
Posts: 17510
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Possible ASCOM/COM lifecycle problem (0x800706BA)

#8

Post by admin »

Hi,

glad to hear that worked - I will give it some time to get settled in and have some wider testing to see if any new issues arise due to this change. If that all works well then I will make some changes to make sure that all the other hardware devices follow a similar pattern of checking the connection status.

cheers,

Robin
Post Reply