0

I am trying to write web application in C# for ATEM Mini using their SDK. Finally i can switch video output, but only 5 times. After that, this error was showed:

enter image description here

The code where this error is looks like that

public AtemSwitcher()
 {
 IBMDSwitcherDiscovery discovery = new CBMDSwitcherDiscovery();
 // Connect to switcher
 discovery.ConnectTo("192.168.0.10", out IBMDSwitcher switcher, out _BMDSwitcherConnectToFailure failureReason);
 this.switcher = switcher;
 me0 = this.MixEffectBlocks.First();
 }

The problem is in discovery. Had someone same problem or can someone help me?

Eugene Astafiev
49.8k3 gold badges28 silver badges50 bronze badges
asked Apr 4, 2023 at 14:23
2
  • 1
    E_FAIL is but a teacher's grade for the quality of the error reporting. You'll have to ask Dwain Commented Apr 4, 2023 at 14:34
  • I am trying to ask in their forum, but admin must approve the task and he is not one of the fastest. Commented Apr 4, 2023 at 15:01

1 Answer 1

0

I don't know the details of that COM library. But, use of such in a webforms applications is probably not thread safe.

However, since it "fails" as a few uses?

this suggests you not disposing of the object. You want to do absolute "hand stands" and walk across the valley, the desert, the big valley, and then climb mountains to ensure that the object is disposed after you create, use it, and then are done.

As a result, then wrap your code in a using clause, as that will allow (force) .net to dispose of everything after you use it.

So, say like this (air code warning)

 public void AtemSwitcher()
 {
 using (IBMDSwitcherDiscovery discovery = new CBMDSwitcherDiscovery())
 {
 // Connect to switcher
 discovery.ConnectTo("192.168.0.10", out IBMDSwitcher switcher, out _BMDSwitcherConnectToFailure failureReason);
 this.switcher = switcher;
 me0 = this.MixEffectBlocks.First();
 }
 }

If the above using block does not help, then hit this with even a larger hammer.

Say this:

 {
 using (IBMDSwitcherDiscovery discovery = new CBMDSwitcherDiscovery())
 {
 // Connect to switcher
 discovery.ConnectTo("192.168.0.10", out IBMDSwitcher switcher, out _BMDSwitcherConnectToFailure failureReason);
 this.switcher = switcher;
 me0 = this.MixEffectBlocks.First();
 discovery.Dispose()
 releaseObject(discovery)
 }
 }
answered Apr 4, 2023 at 17:30
Sign up to request clarification or add additional context in comments.

3 Comments

Unfortunately discover has not .Dispose() and releaseObject is not exist in the current context.
Hum, ok, I have to dig up how to do this (its been a while since I used COM objects in asp.net!! - However, you can still add a custom dispose here. However, does the using block help?
'IBMDSwitcherDiscovery': type used in a using statement must be implicitly convertible to 'System.IDisposable'.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.